Our gateway missed new OpenCode: coding agent User-Agents

Short answer: Lazu labels every request with the tool that sent it, such as Claude Code, Codex or OpenCode. On October 29, 2026 we found that several of our detection rules did not match what those tools send today. Requests from new OpenCode releases, from Gemini CLI since the rule was added, and from Kilo Code when it talks to Claude were all recorded as "unrecognized".
The cause was simple. We wrote the rules from the User-Agent strings we expected, and our tests used strings we made up. Nobody had checked them against what the tools actually send. v0.7.260 fixed it on October 30, and we relabelled the affected history.
This post covers what went wrong and how we fixed it. At the end is a table of the User-Agent strings coding agents really send to third-party endpoints, checked against each tool's source code. If you run a gateway, a proxy or a usage dashboard, you can use it as is.
How a gateway tells agents apart #
A request carries three useful signals:
- the
User-Agentheader, where most tools put their name and version; - tool-specific headers, such as Codex's
originatorand Claude Code'sx-app; - the header that carries a session ID, which differs per tool (Goose uses
agent-session-id).
Lazu matches the User-Agent against an ordered list of regular expressions, and the first match wins. The console's "top clients", per-agent session costs and the weekly usage digest all read that label.
What went wrong #
We read each tool's source to see the User-Agent it sends to a third-party endpoint:
| Tool | What it actually sends | Our old rule | Result |
|---|---|---|---|
| OpenCode (new releases) | opencode/latest/1.19.5/cli … |
opencode/ followed directly by a version |
Old opencode/1.4.2 matched; the new latest/ segment broke it |
| Gemini CLI | GeminiCLI-tui/0.66.0/gemini-2.5-pro (…) |
GeminiCLI/ |
The -tui suffix broke it |
| Kilo Code (Claude models) | kilo/<channel>/<version>/cli … |
only Kilo-Code/ |
Matched for other providers, missed for Claude |
| Roo Code (native OpenAI) | roo-code/3.45.0 (…) |
only RooCode/ |
Missed |
Two more problems turned up:
- No word boundaries. Short names like
ZedandClinematched inside other words, such as optimized and decline. - Invented test strings. One test used
Cursor/0.42.0 (mac), a string not taken from any real request. The tests stayed green because they tested our assumptions.
How much it mattered #
We re-ran the new rules over the last 60 days of requests. About 0.2% of requests would change label, and only a little over a hundred were newly recognised as an agent. The impact was small for two reasons:
- few people used OpenCode or Gemini CLI with Lazu in that period;
- most "unrecognized" traffic is not an agent at all. It is people's own scripts:
python-httpx, the OpenAI Python SDK,curl. Leaving those unlabelled is correct.
No charge was affected. The client label is used for statistics and display only; billing depends on the model and the tokens, not on which tool sent the request.
The fix #
- Every rule now comes from a string checked against the tool's source, with anchors and word boundaries. The tests use the same real strings, and the invented ones are gone.
- Two generic headers as a fallback. Roo Code, pi and others send
originator; Cherry Studio and others sendX-Title. Both are read only for tools we have checked, so arbitrary headers cannot create endless "clients". - Session headers as a last resort. When a request carries a Goose, Kilo or OpenCode session header but its User-Agent only names an SDK, the session source decides. Goose sends no User-Agent at all, so this is the only way to recognise it.
- One list for every view. The weekly digest used to keep its own list of nine names and filed everything else under "API". The badges, the dashboard and the digest now read the same table.
v0.7.260 shipped on October 30, v0.7.261 fixed how some versions were displayed, and v0.7.262 added OpenHands, Kode and a few more. Requests from the last 60 days were relabelled with the new rules; hourly usage totals did not change.
Tools no gateway can recognise #
These tools do not put their own name in requests to third-party endpoints:
| Tool | What it sends |
|---|---|
| Goose | no User-Agent at all |
| Cline v4 | only the Vercel AI SDK default, without "Cline" |
| Continue | OpenAI/JS … or node-fetch, no name of its own |
| Aider | goes through litellm, so you see litellm/… or OpenAI/Python |
| Kimi CLI, OpenClaw | the SDK default when pointed at a custom endpoint |
One case is easy to get wrong: Qwen Code sends claude-cli as its User-Agent to Anthropic-format third-party endpoints, together with x-app: cli. Its source explains why: some proxies restrict usage by client identity, and this lets Qwen Code through. Against Anthropic's own API it still says QwenCode (source). The version number tells them apart: Claude Code is on 2.x, while Qwen Code puts its own 0.x version there.
If you use one of these tools and want your usage split by tool, add a custom header X-Title: <tool name> in the tool's settings.
Appendix: User-Agent strings by agent #
Checked against each tool's source in October 2026. Version numbers are examples.
| Tool | User-Agent and headers sent to third-party endpoints |
|---|---|
| Claude Code | claude-cli/2.1.x (external, cli), headers x-app: cli, X-Claude-Code-Session-Id |
| Codex | codex_cli_rs/…, codex_exec/… or codex-tui/…, header originator |
| OpenCode | opencode/<channel>/<version>/cli, header x-opencode-session-id |
| Kilo Code | Claude: kilo/<channel>/<version>/cli; other providers: Kilo-Code/<version> |
| Gemini CLI | GeminiCLI-tui/<version>/<model> (…); in VS Code, CloudCodeVSCode/… |
| Qwen Code | OpenAI format: QwenCode/<version>; Anthropic-format third-party endpoints: claude-cli/<Qwen Code version> (external, cli) with x-app: cli |
| Crush | Charm-Crush/<version>, header x-session-id |
| Zed | Zed/<version> (macos; aarch64) |
| GitHub Copilot (bring your own key) | GitHubCopilotChat/<version> |
| Cherry Studio v1 | Electron User-Agent containing CherryStudio/<version>, plus X-Title: Cherry Studio |
| Goose | no User-Agent, header agent-session-id |
FAQ #
Can a wrong label change what I pay? #
No. The label is used for statistics and display. Billing depends on the model and the tokens, not on the tool.
Why not let users pick their tool? #
They can, but most people never do. Detecting it per request keeps the numbers right; when detection fails, an X-Title header tells us.
How do you know it is fixed now? #
Every test string now comes from a tool's source. After the release we also sent real requests from OpenCode, Goose, Gemini CLI and Cherry Studio to production, and all four were labelled correctly.