Skip to main content

Run Claude Code on any model

Anthropic's official CLI agent - point it at your Antseed gateway, or launch it with antseed claude.

Coding agentsAnthropic Messages~2 min

Claude Code is the official CLI coding agent from Anthropic. It speaks the Anthropic Messages API natively, so it connects to Antseed with two environment variables: ANTHROPIC_BASE_URL for the endpoint and ANTHROPIC_AUTH_TOKEN for the key.

Using Antseed Desktop on the same computer? Its local gateway works here too, with an API key from Settings. The app does not connect Claude Code for you, because Claude Code's model list only takes Claude-named models, but you can add Antseed's skills to it under Agents & apps, so it keeps its own model and calls Antseed when you ask.

Otherwise, the recommended endpoint is a gateway: it gives Claude Code its own API key with budgets and usage logs, and it works from any machine. The gateway only accepts the key as Authorization: Bearer, which is what ANTHROPIC_AUTH_TOKEN sends. When Claude Code runs on the same computer as a buyer, antseed claude launches it against the local buyer proxy instead, with no key.

No Anthropic API key or subscription is needed. Antseed pays sellers per request in USDC from your gateway workspace wallet or your buyer deposit.

When Claude Code calls the Messages API, Antseed selects the highest-ranked eligible offer under your Price + Trust preferences. Stable session metadata gives the conversation soft affinity to the seller that actually served it, with failover when needed. Every model on the network (listed by GET /v1/models) is a valid --model value; prefix it with a peer id (<peerId>@<service-id>) only when you want to force a specific seller.

Run Antseed first

Every integration needs an Antseed endpoint: a gateway, best on a small server so every tool on every machine can reach it, or the local buyer proxy (same computer only). One-time setup, a few minutes.

Step 1

Install Claude Code

  • Install Claude Code globally
    npm install -g @anthropic-ai/claude-code
  • Verify it runs
    claude --version

Step 2

Point Claude Code at Antseed

Recommended: a gateway

ANTHROPIC_BASE_URLhttps://gateway.example.com
ANTHROPIC_AUTH_TOKENantseed_…
Show as shell exports
export ANTHROPIC_BASE_URL="https://gateway.example.com" export ANTHROPIC_AUTH_TOKEN="antseed_…"

Your gateway's address without /v1 (Claude Code adds /v1/messages itself) and an API key from the Keys page of its console. For a gateway on this computer use http://localhost:8379. Use ANTHROPIC_AUTH_TOKEN, not ANTHROPIC_API_KEY: the gateway reads the key from Authorization: Bearer, and ANTHROPIC_API_KEY sends it as x-api-key. Then run claude --model deepseek-v4.1-flash.

Same computer, no gateway: the local buyer proxy

antseed claude --model deepseek-v4.1-flash

The wrapper reads the running buyer proxy from buyer.state.json or config, sets ANTHROPIC_BASE_URL and a placeholder ANTHROPIC_API_KEY for Claude Code, and forwards extra Claude args. The proxy only listens on localhost and checks no key. Manual equivalent: ANTHROPIC_BASE_URL=http://localhost:8377 ANTHROPIC_API_KEY=antseed claude --model deepseek-v4.1-flash. The wrapper always targets a buyer proxy; for a gateway use the variables above.

Background tasks, subagents and context window

ANTHROPIC_DEFAULT_HAIKU_MODELdeepseek-v4.1-flash
CLAUDE_CODE_SUBAGENT_MODELdeepseek-v4.1-flash
CLAUDE_CODE_MAX_CONTEXT_TOKENS128000
Show as shell exports
export ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek-v4.1-flash" export CLAUDE_CODE_SUBAGENT_MODEL="deepseek-v4.1-flash" export CLAUDE_CODE_MAX_CONTEXT_TOKENS="128000"

Claude Code also sends background tasks and subagents to other model names (Claude Haiku, for example), and those requests reach Antseed too. Set the first two so they use an open model as well. Claude Code does not know open model ids and assumes a 200k context window; set CLAUDE_CODE_MAX_CONTEXT_TOKENS to the context length on the model card so it compacts at the right point.

~/.claude/settings.json
{ "env": { "ANTHROPIC_BASE_URL": "https://gateway.example.com", "ANTHROPIC_AUTH_TOKEN": "antseed_…", "ANTHROPIC_MODEL": "deepseek-v4.1-flash", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-v4.1-flash", "CLAUDE_CODE_SUBAGENT_MODEL": "deepseek-v4.1-flash", "CLAUDE_CODE_MAX_CONTEXT_TOKENS": "128000" } }

Optional: to run plain claude through Antseed every time, put the settings in Claude Code's own settings file instead of the environment. For the local buyer proxy, use "ANTHROPIC_BASE_URL": "http://localhost:8377" and "ANTHROPIC_API_KEY": "antseed" instead of the first two.

Step 3

Pick a model

deepseek-v4.1-flashglm-5.3-flashglm-5.2kimi-k3

--model is passed to Claude Code unchanged, so any id returned by GET /v1/models works; pick a seller that lists tool use, since Claude Code needs it for every file edit and command. Route to a specific peer per session with --model <peerId>@<service-id>. On a gateway you can also use a preset: --model @preset/<slug>.

The full list is every model on the network. Run GET /v1/models on your endpoint, antseed network browse, or open the live network page to see what's available right now.

Verify

Test it

  • List every model on the network
    curl -s "$ANTHROPIC_BASE_URL/v1/models" -H "Authorization: Bearer $ANTHROPIC_AUTH_TOKEN" | jq '.data[].id'
    Example response
    "deepseek/deepseek-v4.1-flash" "moonshotai/kimi-k3" "z-ai/glm-5.2" "z-ai/glm-5.3-flash"

    Any id here works with --model, and so does the short name without the vendor prefix (deepseek-v4.1-flash). Against the local buyer proxy, drop the header: curl -s http://localhost:8377/v1/models.

  • Start a Claude Code session
    claude --model deepseek-v4.1-flash

    Through the local buyer proxy instead: antseed claude --model deepseek-v4.1-flash. To pin a specific peer: --model <peerId>@deepseek-v4.1-flash.

How Claude Code talks to Antseed

  • Wire format sent by Claude Code: Anthropic Messages (hits /v1/messages on your gateway or buyer proxy)
  • Best-fit services: any service whose protocols array contains anthropic-messages. That's what the peer advertises as natively-supported - zero translation overhead, no transform edge cases.
  • How to check a peer: run antseed network peer <peerId> --json and look at providerServiceApiProtocols[provider].services[service]. The browse command exposes the same field per peer.
  • What happens when protocols don't match: Antseed's @antseed/api-adapter translates between Anthropic Messages and the service's native protocol on the fly, inside the buyer. So a request from Claude Code can still reach a service that only advertises openai-chat-completions - just with a small transform step.
  • One known caveat: services whose only advertised protocol is openai-responses require streaming. If Claude Code sends a non-streaming request and Antseed routes it to one of those services, the call fails with HTTP 400: Stream must be set to true. Pick a service whose protocols includes anthropic-messages (or another non-responses protocol) to avoid this.

If it goes wrong

Troubleshooting

  • 401 from the gateway, or "invalid x-api-key"Send the gateway key as ANTHROPIC_AUTH_TOKEN and unset ANTHROPIC_API_KEY. The gateway only reads Authorization: Bearer. Against the local buyer proxy any non-empty ANTHROPIC_API_KEY works; antseed claude sets one for you.
  • 404 on every requestANTHROPIC_BASE_URL must not end in /v1: Claude Code appends /v1/messages itself.
  • Hangs forever on first messageWith a gateway, check that it answers: curl -s "$ANTHROPIC_BASE_URL/v1/models" -H "Authorization: Bearer $ANTHROPIC_AUTH_TOKEN". With the local buyer proxy, check antseed buyer status and curl -s localhost:8377/_antseed/status; if a stale session pin points at an offline peer, clear it with antseed buyer connection clear.
  • model_not_found for a model name you expected to workNo seller your routing policy allows currently offers that model. Check GET /v1/models, then pick another model or adjust the policy (the key or workspace routing policy on a gateway, buyer preferences locally).
  • 402 insufficient_deposits even though a free seller offers the modelWith automatic routing, Claude Code's requests can still land on a paid seller. Add funds (the workspace wallet in the gateway console, or antseed buyer deposit for a local buyer), or pin the free seller: --model <peerId>@<model>. antseed network browse --service <model> lists sellers and their prices.
  • Claude Code says it doesn't recognize the model and assumes a 200k context windowExpected for open model ids. Set CLAUDE_CODE_MAX_CONTEXT_TOKENS to the model's real context length so Claude Code compacts at the right point.
  • Want to confirm a request actually went through Antseed (not Anthropic direct)On a gateway, the request shows up in the console under Logs, with the seller, tokens and cost. With the local buyer proxy, run antseed buyer metering to see the channel for the peer Claude Code routed to, with token counts and the USDC settled.

Reference

Links

Same category

Related

Run Claude Code on the open market

Run a gateway, point this tool at it, and pay per request.

All integrationsGateway API