Skip to main content

Claude Code

Anthropic's official CLI agent — launch through AntSeed 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 slots into AntSeed through the `antseed claude` wrapper or by pointing `ANTHROPIC_BASE_URL` at your local proxy.

`antseed claude` resolves the active buyer proxy, sets the placeholder Anthropic API key for the child process, and forwards the rest of your Claude Code flags unchanged. Manual environment variables still work if you want to run `claude` directly.

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

antseed claude --model claude-sonnet-4-6

Recommended: the wrapper reads the active buyer proxy from `buyer.state.json` or config, sets `ANTHROPIC_BASE_URL` and `ANTHROPIC_API_KEY` for Claude Code, and forwards extra Claude args. Add `--antseed-base-url http://host:port` only when your proxy is somewhere else.

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

Manual equivalent if you want to run `claude` directly instead of through `antseed claude`.

Step 3

Pick a model

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

`antseed claude --model <service-id>` passes the value to Claude Code 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 through the wrapper
    antseed claude --model claude-sonnet-4-6

    Manual equivalent after exporting the env vars above: `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 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. 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 SDK`antseed claude` sets `ANTHROPIC_API_KEY=antseed` for you. If you run `claude` directly, set the variable to any non-empty string; 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