How to use Claude Code with Onlist
Point Claude Code at Onlist with two environment variables: no local proxy, competing providers for the same models, wallet billing, and full usage logs.
Claude Code speaks the Anthropic Messages API to whatever backend you point it at. Onlist serves that API natively: POST /v1/messages is a first-class endpoint on the same marketplace routing as everything else, not a translation shim in front of a Chat Completions core. That keeps the integration short: two environment variables, no local proxy.
One disclosure up front. Onlist is developed with Claude Code pointed at Onlist, so the configuration below is copied out of a working shell profile, not reconstructed for a blog post.
Setup
Get a key from your dashboard, then:
export ANTHROPIC_BASE_URL=https://onlist.io
export ANTHROPIC_AUTH_TOKEN=your-onlist-key
Start claude and it routes through Onlist. If you are in mainland China, use https://api.onlist.net as the base URL; it is a direct line to the same platform.
To make the change permanent, put the same values in ~/.claude/settings.json instead of your shell profile:
{
"env": {
"ANTHROPIC_BASE_URL": "https://onlist.io",
"ANTHROPIC_AUTH_TOKEN": "your-onlist-key",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
"CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY": "1"
}
}
DISABLE_NONESSENTIAL_TRAFFIC trims telemetry and update-check calls that make no sense through a gateway. ENABLE_GATEWAY_MODEL_DISCOVERY makes Claude Code fetch Onlist's model list at startup, so /model offers every model on the marketplace instead of only the built-in Claude aliases.
Two details that save a support ticket
Use the bare domain in ANTHROPIC_BASE_URL. Claude Code appends /v1/messages itself, so setting https://onlist.io/v1 produces requests to /v1/v1/messages and a 404.
Use ANTHROPIC_AUTH_TOKEN, not ANTHROPIC_API_KEY. The two variables send different headers (Authorization: Bearer versus x-api-key). Onlist normalizes both to the same account, so either happens to work, but AUTH_TOKEN is the variable intended for third-party endpoints and is what our key generator emits.
What you get for the trouble
The same Claude-family models, served by competing providers. On Onlist a single model id can be listed by several independent operators at different prices. By default the router picks by price and availability and fails over when an upstream degrades; you can also pin a specific provider when you have found one you trust.
Billing comes out of the same prepaid wallet as every other Onlist call. Coding agents burn tokens in bursts, and a wallet you top up beats a surprise at the end of the month; the reasoning is in an earlier post. Every call lands in your usage log with token counts and the provider that actually served it, so when a session feels slow or odd, you can see who fulfilled it rather than guessing.
Picking a model
With model discovery on, /model lists every model on Onlist by its display name, non-Claude models included, and picking one there is the simplest route. The ids behind the menu look like anthropic/claude-opus-5-5[1m] or anthropic/openai/gpt-5.6-sol[1m]: the anthropic/ wrapper is what Claude Code needs before it accepts a gateway model, and [1m] tells it the model has a one-million-token window.
If you set a default with the ANTHROPIC_MODEL environment variable instead, write Claude models in Anthropic's hyphen form, claude-opus-5-5, with or without the anthropic/ prefix. Avoid the dotted form shown on the model pages, anthropic/claude-opus-5.5. Onlist routes both to the same model, but Claude Code reads the dotted form as an older model (Opus 5.5 as Opus 5) and tunes its prompts and effort defaults for the wrong one. On Opus 5.5 and Sonnet 5.5 it also breaks WebSearch: Claude Code forces the search tool, which those models refuse, so every search fails with a 400.
One marketplace-specific wrinkle: some listings carry a "Claude Code only" badge. Those providers accept traffic from the Claude Code client and nothing else, which is why the same listings appear greyed out in the web chat. From your terminal they work normally. If the listing you want carries that badge, this setup is the way to reach it.
When something fails
401: the key is wrong or was deleted. Ansk-prefix is stripped silently, so pasting the key with or without it makes no difference; if you are getting 401 the problem is the key itself.- Model not found: the id is not listed on the marketplace. Pick it from
/modelwith discovery on, or copy the exact string from /models; guessing rarely works because listings, not us, decide what is available. - 404 on every request: almost always the base URL rule above. Bare domain, no
/v1.
One thing that surprises people coming from a direct Anthropic key: the response body reports token usage but not cost. Cost is settled out of band against the listing price; the usage docs explain how to read it from your logs.
That is the whole integration. Two environment variables, one optional settings file, and Claude Code is running on a marketplace where providers compete for its traffic.