Skip to main content

Claude Code

Anthropic's official CLI agent — drop-in via ANTHROPIC_BASE_URL.

Coding agentsAnthropic Messages~2 min

Claude Code is the official CLI coding agent from Anthropic. It speaks the Anthropic Messages API natively, so it slots into AntSeed by simply pointing `ANTHROPIC_BASE_URL` at your local proxy.

No real Anthropic API key is needed — the AntSeed proxy authenticates each request with your local identity (`ANTSEED_IDENTITY_HEX`) and settles payments on-chain. The `ANTHROPIC_API_KEY` value is required by the Anthropic SDK only as a non-empty placeholder.

When Claude Code calls the Messages API, the proxy forwards the request to the peer you pinned in step 3 of the setup above. Whichever service ids that peer advertises (visible in antseed network peer <peerId>) become the valid --model values.

Run AntSeed first

Every integration assumes a buyer proxy at http://localhost:8377. One-time setup, ~2 minutes.

Step 1

Install Claude Code

  • Install Claude Code globally
    npm install -g @anthropic-ai/claude-code
  • Verify it runs
    claude --version
    Example output
    1.4.2 (Claude Code)

Step 2

Point Claude Code at AntSeed

ANTHROPIC_BASE_URLhttp://localhost:8377
ANTHROPIC_API_KEYantseed
Show as shell exports
export ANTHROPIC_BASE_URL="http://localhost:8377" export ANTHROPIC_API_KEY="antseed"

Step 3

Pick a model

claude-sonnet-4-6claude-opus-4-7deepseek-v4-flash

Claude Code's `--model` flag passes the value to the Messages API unchanged. The valid set is whatever your pinned peer advertises — see the discovery commands below.

The exact list of models depends on which peer you pin. Run antseed network browse or open the live network page to see what's available right now.

Verify

Test it

  • See which models your pinned peer offers
    curl -s http://localhost:8377/v1/models | jq '.data[].id'
    Example response
    "claude-opus-4-7" "claude-sonnet-4-6" "deepseek-v4-flash" "gpt-oss-120b"

    These are the only ids that work with `--model`. To switch peers, run `antseed network browse`, then `antseed buyer connection set --peer <peerId>` and re-check this list.

  • Start a Claude Code session against AntSeed
    claude --model claude-sonnet-4-6

How Claude Code talks to AntSeed

  • Wire format sent by Claude Code: Anthropic Messages (hits /v1/messages on the 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 matchingServices[].protocols for each model. The browse command shows the same data per peer in providerServiceApiProtocols.
  • 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. 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 the proxy 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

  • "invalid x-api-key" or 401 from Anthropic SDKThe SDK requires *some* value for `ANTHROPIC_API_KEY`. Set it to any non-empty string (e.g. `antseed`). The proxy ignores the value.
  • Hangs forever on first messageNo peer is pinned. Run `antseed network browse` to see peers, then `antseed buyer connection set --peer <peerId>`.
  • `model_not_found` for a model name you expected to workThe pinned peer doesn't advertise that service id. Check what it does offer with `antseed network peer <peerId>` (or `curl http://localhost:8377/v1/models`). Pin a different peer if needed.
  • Want to confirm a request actually went through AntSeed (not Anthropic direct)After the request completes, run `antseed buyer metering` — you'll see the channel for the peer Claude Code routed to, with token counts and the USDC settled. `antseed buyer status` shows the snapshot (pinned peer, active-channel count, deposits).

Reference

Links

Same category

Related