Claude Code Setup (Anthropic Skin)
Point Claude Code (or the Anthropic Agent SDK) at Surplus and route every request through the marketplace — cheapest healthy seller, on-chain settlement — with no local proxy. Surplus implements Anthropic's Messages API surface (the "Anthropic skin"), so Claude Code talks to it the same way it talks to Anthropic.
It's also model-agnostic: you can run Claude Code on Claude or on GPT, GLM, Llama, Gemini, DeepSeek — any catalog model — through the same Anthropic wire.
For the full endpoint reference, see Anthropic Messages API.
1. Get a buyer key
Sign in on the Buy page with your wallet and create a buyer API key (inf_…). Fund it with credits, or set up a USDC allowance on the settlement contract. (Per-request x402/MPP payment is not used by the skin — Claude Code authenticates with the buyer key.)
2. Configure Claude Code
That's the whole required setup — three variables:
Then run claude as usual. With no model variables set, Claude Code uses its built-in default models and the marketplace routes each request to the cheapest healthy seller for them.
Why ANTHROPIC_API_KEY=""? Claude Code prefers a cached ANTHROPIC_API_KEY (or a claude.ai login) over ANTHROPIC_AUTH_TOKEN. Blanking it forces your Surplus key to be used.
3. Choosing models (optional)
Setting models is optional. By default Claude Code uses its built-in models; the marketplace serves them like any other request. Set the variables below only when you want to pin a specific model, control cost, or run on a non-Claude model.
Claude Code has two model slots:
If you pin one slot, it's best to pin both (the small/fast slot is high-volume). Whatever model is used — a default or one you pin — must have a live offer in the marketplace; if it doesn't, those calls return a 503 / overloaded_error. Check the Market Prices page or GET /v1/models for what's live.
Newer Claude Code versions also read role-specific overrides (for the /model switcher and subagents), all optional:
You can also use floating tags — ~anthropic/claude-opus-latest, ~anthropic/claude-sonnet-latest, ~anthropic/claude-haiku-latest — which resolve to the current flagship.
Run Claude Code on non-Claude models
Because the skin routes by model name, just point the slots at any catalog model:
A common cost-saver is a strong main model with a cheap small/fast model, e.g. ANTHROPIC_MODEL="claude-opus-4.8" + ANTHROPIC_SMALL_FAST_MODEL="gpt-4o-mini". Friendly -latest aliases work across families too (glm-latest, gpt-latest, deepseek-latest, …).
Text and tool use work on every model. Extended thinking is Claude-specific — non-Claude models won't return thinking blocks (the request still works). Smaller models follow the agent's tool protocol less reliably on complex multi-step tasks.
4. Verify
In Claude Code, run:
/statusIt should show:
Auth token: ANTHROPIC_AUTH_TOKEN
Anthropic base URL: https://api.surplusintelligence.ai/anthropicAsk it something simple ("reply with one word — pong"), then try a tool task ("read package.json and tell me the name field") to confirm the agent loop. You can watch usage on the Buy page as your credits settle.
5. Optional: routing controls
The skin honors the same marketplace controls as the OpenAI surface — set them in the request body (the Anthropic SDK passes through unknown fields), or use the minimum-discount mirror:
- Provider pin / allow-list:
"provider": "venice"or"provider": ["venice","openrouter"](the OpenRouter{order|only}object form is accepted too). - Host pin:
"provider_base_url": "https://api.openai.com/v1". - Price cap:
"max_price_per_1m": 5.0(USD per 1M input tokens). - Minimum discount: set
ANTHROPIC_BASE_URL="https://api.surplusintelligence.ai/anthropic/min50"to only route to sellers ≥50% cheaper than reference.
Troubleshooting
Anthropic Agent SDK
The same env vars work for the Anthropic Agent SDK / @anthropic-ai/sdk — set baseURL to https://api.surplusintelligence.ai/anthropic and the API key to your inf_… key. The SDK's x-api-key header is accepted.