Blog
· Onlist Team

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"
  }
}

The last entry trims telemetry and update-check calls that make no sense through a gateway.

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

Model ids on Onlist follow the author/model convention. Browse the Claude-family listings on /models for the exact strings, then switch inside Claude Code with the /model command, or set a default via the ANTHROPIC_MODEL environment variable.

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. An sk- 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. 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.

Get an API key →