A wooden rectangular sieve with a wire mesh floor, with the article title about writing Caido HTTPQL queries with an LLM
Cover based on a photo by Nana Pearls, via Wikimedia Commons, CC0 1.0

You can generate Caido HTTPQL with an LLM in seconds, and the hard part is knowing whether the query does what you asked. HTTPQL is Caido's filter language for proxied traffic. It looks close enough to SQL or a log query language that a model will happily invent operators, and the failure modes are different: sometimes Caido rejects the query, and sometimes it accepts it and quietly returns the wrong rows.

This guide runs both cases. We started the Caido CLI (0.59.1, the current release) headless on localhost, sent ten requests from a small app we wrote and own through its proxy, and ran every query below against that project. The drafts were written for this guide to show mistakes models commonly make with HTTPQL. They are not a captured model transcript, and no model was called. Caido's results are the evidence.

Authorized work only. Filters read traffic you already captured, but capturing it is the part that needs scope. Use your own lab or assets your written scope covers.

If you already use a model for scanner work, Burp BChecks covers writing checks, and this post is the other half: finding the right requests in the history.

Why generate Caido HTTPQL with an LLM

HTTPQL statements follow one shape, from the HTTPQL reference: a namespace, a field, an operator and a value, joined with dots and a colon, such as req.path.cont:"/api". The reference lists these:

  • Namespaces: req, resp, row, preset and source. The preset and source namespaces have no fields and take a value directly.
  • req fields: created_at, ext, host, len, body, method, path, port, header, query, raw, tls.
  • resp fields: code, len, body, header, raw, roundtrip.
  • Operators: eq, ne, gt, gte, lt, lte, cont, ncont, like, nlike, regex, nregex. Statements combine with AND and OR, and parentheses group them.

Writing these by hand is fine for one clause. It gets slow when you want "API calls that returned 200, carried a bearer token, and are not static files". A model turns that sentence into a filter fast. Two things make it risky:

  • Models borrow from other query languages. contains, resp.status, NOT and look-ahead regexes all feel natural and none of them are in HTTPQL.
  • Valid is not the same as right. A query that parses can still match too much, or nothing.

The lab

The target is a Python HTTPServer on 127.0.0.1:8770. It serves a JavaScript file, a PNG, a few JSON API routes (/api/users/me, /api/admin/users, /api/orders, /api/export, /api/login) and a 404 for anything else. We sent ten requests through the Caido proxy listener, then checked what the project held:

row 1  GET  /static/app.js              200
row 2  GET  /static/logo.png            200
row 3  GET  /api/users/me               200
row 4  GET  /api/admin/users            200
row 5  GET  /api/orders?id=5&status=open   200
row 6  GET  /api/export?format=csv      500
row 7  POST /api/login                  200
row 8  POST /api/orders                 201
row 9  GET  /api/missing                404
row 10 GET  /api/orders?id=6&status=closed 200

Responses from /api/users/me and /api/login contain an isAdmin field set to false, the admin route returns isAdmin as true, and /static/app.js contains the text admin panel. That is deliberate noise for the test.

To make it repeatable we ran caido-cli --listen 127.0.0.1:8080 --no-open --allow-guests with a throwaway data directory. --allow-guests lets anyone who can reach the port use the instance without logging in, so use it only on loopback for a disposable lab, never on a shared network. Caido's CLI reference lists the flag. In normal use you paste the query into the filter bar in the Caido app and skip all of this.

The goal for the model: show me successful requests to the admin API.

Draft 1: invalid on three counts

A typical first answer, in the style of a model that knows SQL and other query languages better than HTTPQL:

req.path.contains:"/api/admin" AND resp.status.eq:"200"

Caido returned Invalid HTTPQL query with no position or hint, so we tested each clause alone:

ClauseResultProblem
req.path.contains:"/api/admin"Invalid HTTPQL queryThe operator is cont, not contains
resp.status.eq:200Invalid HTTPQL queryThe response field is code, not status
resp.code.eq:"200"Invalid HTTPQL querycode is an integer, so the value is unquoted

NOT req.ext.eq:".js" was also rejected. The reference defines AND and OR and no negation keyword. For "not", use the negated operators (ne, ncont, nlike, nregex).

An error with no detail is the reason to keep a human or script in the loop. Whatever you send back to the model has to be specific: "contains is not an HTTPQL operator. Use only the operators in this table."

Draft 2: valid and wrong

After the model fixed the syntax, it wrote this to search for admin traffic:

(req.raw.cont:"admin" OR resp.raw.cont:"admin") AND resp.code.eq:200

That is exactly what Caido runs when you type a bare string such as "admin" into the filter box, per the reference, with the status check added. It parsed and returned four rows, not one:

row 1 GET  /static/app.js    200   (response body says "admin panel")
row 3 GET  /api/users/me     200   (response contains "isAdmin": false)
row 4 GET  /api/admin/users  200   (the one we wanted)
row 7 POST /api/login        200   (response contains "isAdmin": false)

cont is case-insensitive per the reference, so admin also matched the Admin inside isAdmin. The query answered "where does the word admin appear anywhere", which is not the goal. On a real project with thousands of rows this is the failure that costs time, because nothing tells you the filter is too wide.

Fixed: say which field you mean

req.path.cont:"/api/admin" AND resp.code.eq:200

It returned one row, row 4, GET /api/admin/users. The fix was to name the field the intent lives in. The path says "admin API". The response body says nothing reliable about it.

Diagram of an LLM-written Caido HTTPQL filter: a first draft using contains and resp.status is rejected as an invalid query, a bare admin string matches four of ten rows, and req.path.cont plus resp.code.eq matches the one intended admin request
The first filter was invalid, the second matched four of ten requests, and the fixed filter matched only the admin request. Image: RedRouter, Original

More checks that surprised us

Each of these ran on the same ten rows:

  • Look-ahead regex returns zero rows, with no error. req.path.regex:"^/api/(?!admin)" matched nothing. The reference says look-ahead is not supported because Caido uses Rust-flavored regex. Models write look-aheads all the time. Use req.path.regex:"^/api/" AND req.path.ncont:"/admin", which returned seven rows, every /api request except row 4. The regex side is documented in the Rust regex syntax.
  • eq is case-sensitive, cont is not. req.path.cont:"/API/ADMIN" matched row 4. req.path.eq:"/API/ADMIN/users" matched nothing.
  • ext needs the dot with eq. req.ext.eq:"js" returned zero rows and req.ext.eq:".js" returned row 1, matching the reference note.
  • Whitespace in JSON bodies matters. The doc example resp.raw.cont:"\"isAdmin\":true" returned zero rows here, because our server wrote "isAdmin": true with a space. resp.body.regex:"\"isAdmin\":\\s*true" matched row 4. Check the real formatting before trusting a literal.
  • Mixed AND and OR follow precedence. req.method.eq:"POST" OR req.path.cont:"/admin" AND resp.code.eq:404 returned rows 7 and 8, the two POSTs, since AND binds first. Ask the model for parentheses and read them: (req.method.eq:"POST" OR req.path.cont:"/admin") AND resp.code.eq:200 returned rows 4 and 7.
  • Header lookups take a quoted name. req.header["authorization"].cont:"bearer lab" matched the two requests we sent with that header.
  • preset did not filter in our project. preset:"no-images" returned all ten rows, including the PNG, because the fresh CLI project had no preset by that alias. A preset only filters if it exists in your project.

How to generate Caido HTTPQL with an LLM

Keep the model in a short loop with Caido as the checker.

  1. Paste the reference. The namespace, field and operator tables from the HTTPQL reference, and the two notes about look-ahead and the ext dot. Add the shape from Writing HTTPQL Queries, <namespace>.<field>.<operator>:"<value>".
  2. Describe the traffic, not the query. "Successful requests whose path is under /api/admin. Ignore everything else. Return one HTTPQL statement."
  3. Say what is forbidden. "Use only fields and operators from the table. No NOT, no look-aheads, no SQL keywords."
  4. Run it and count. Compare the match count to what you expect. Send Caido's error text, or the surprising rows, back unchanged.
  5. Name the row you wanted. If you know row 4 is the target, check that it matches and that obvious non-targets do not.

Here is the checker we used, a few lines against our local instance. It calls the instance's GraphQL endpoint, which we found by trial rather than from the HTTPQL docs, so treat it as lab tooling and expect it to change between Caido versions:

import json, sys, urllib.request

QUERY = 'query($f:HTTPQLInput){ requests(first:100, filter:$f){ count{value} edges{node{id method path query response{statusCode}}} } }'

def check(httpql, token):
    body = json.dumps({"query": QUERY, "variables": {"f": {"code": httpql}}}).encode()
    req = urllib.request.Request("http://127.0.0.1:8080/graphql", body,
        {"Content-Type": "application/json", "Authorization": "Bearer " + token})
    data = json.load(urllib.request.urlopen(req))
    if data.get("errors"):
        return "ERROR: " + data["errors"][0]["message"]
    rows = data["data"]["requests"]["edges"]
    return [(e["node"]["id"], e["node"]["method"], e["node"]["path"]) for e in rows]

print(check(sys.argv[1], open("token.txt").read().strip()))

The model-calling half is simple to add on top: send the prompt, take the statement from the reply, run check, and feed any error or wrong count back. We did not run that half against a model API for this post.

Keep it pointed at traffic you are cleared to analyze, and read the final statement before you rely on it, since the model chose every field in it.

What to send the model

Send the HTTPQL tables, your goal in one sentence, and a few representative rows with the method, path, status and headers you care about. Strip client hostnames, session tokens, cookies and response bodies that hold real data before you paste anything. A row like GET /api/admin/users 200 is enough. If you want a summary of how long prompts are kept, Zero Data Retention is an opt-in setting, off by default, and what RedRouter keeps explains the rest.

If your scanner of choice is ZAP rather than Caido, the equivalent setup question is covered in ZAP with an OpenAI-compatible API. And if you drive Burp with an agent instead, see Claude Code for bug bounty with Burp.

Choosing a model for HTTPQL generation

HTTPQL statements are short, so cost is small and iteration speed matters more. GLM 5.3 Flash Red (glm-5.3-flash-red) is a good first choice for the load-and-fix loop: at the time of writing it lists $0.25 input, $0.13 cached input and $1.00 output per 1M tokens. red-cyber-1, listed at $0.28 / $0.13 / $1.10 and marked Beta, is the featured model for authorized penetration-testing work when your prompt carries more engagement context. The models docs list current rates; plans are on /pricing. RedRouter is built for this kind of authorized security work.

FAQ

Can I generate Caido HTTPQL with an LLM?

Yes, as a first draft. In our lab the first draft was rejected as an invalid query, the second parsed but matched four rows instead of one, and a path-based filter found the single intended request. Run every statement against your own captured traffic and count the rows.

What HTTPQL operators exist?

eq, ne, gt, gte, lt, lte, cont, ncont, like, nlike, regex and nregex, per the HTTPQL reference. There is no contains, NOT or matches.

Does Caido regex support look-aheads?

No. The reference says Caido uses Rust-flavored regex, which has no look-ahead. In our lab a look-ahead pattern returned zero rows instead of an error, so negate with ncont or nregex.

Why did my HTTPQL filter return too many rows?

cont is case-insensitive and a bare string searches the whole raw request and response. Name the field that carries the meaning, such as req.path or resp.code, and add a second condition.

Is this the same as writing Burp BChecks?

No. HTTPQL filters traffic Caido has already captured. A BCheck is a scan check that sends requests. They solve different problems; the BChecks guide is linked above.

Which model should I use?

Start with GLM 5.3 Flash Red, and move to red-cyber-1 when the prompt needs more context. Check the models docs for current rates.