Claude Code
Anthropic's official CLI, pointed at clawfeeder.ai
Claude Code is Anthropic's terminal-native coding agent. Out of the box it talks to api.anthropic.com; with two environment variables you can route every call through clawfeeder.ai instead and pay in credits.
Node.js 18+ for the `claude-code` install, and a clawfeeder API key (cf-sk-***) generated under /dashboard.
Steps
1Install Claude Code
If you haven't already, install the CLI globally with npm.
npm install -g @anthropic-ai/claude-code2Point Claude Code at clawfeeder
Set ANTHROPIC_BASE_URL to clawfeeder's bare host (no /v1 suffix — Claude Code's underlying Anthropic SDK appends /v1/messages itself) and ANTHROPIC_API_KEY to your cf-sk-*** key. Persist these in your shell rc file.
export ANTHROPIC_BASE_URL="https://clawfeeder.ai"
export ANTHROPIC_API_KEY="cf-sk-***your_key***"3Pick a model
Claude Code defaults to claude-opus-4-7. Any model in clawfeeder's catalog (see /docs#models) is usable; use --model to switch per session.
claude-code --model claude-sonnet-4-6 # 更便宜的日常模型
claude-code --model claude-opus-4-7 # 旗舰模型,默认4Start coding
Run `claude-code` in any project directory. Credits debit on each completed response — check /dashboard to watch your balance.
cd ~/my-project
claude-codeVerify
Quick sanity check — send a single message via curl directly to confirm the gateway and key work, before invoking the full CLI.
curl -X POST "https://clawfeeder.ai/v1/messages" \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{"model":"claude-haiku-4-5-20251001","max_tokens":50,"messages":[{"role":"user","content":"reply with the word READY"}]}'Expected response includes: "text":"READY"
FAQ
Does Claude Code work with cf-sk-*** keys exactly like Anthropic keys?
Yes. clawfeeder accepts cf-sk-*** in either the x-api-key header (Anthropic SDK default) or Authorization: Bearer. Claude Code uses x-api-key, so no change needed.
Why am I seeing 401 unauthorized?
Most often the env vars weren't exported in the shell that launched claude-code. Run `echo $ANTHROPIC_BASE_URL $ANTHROPIC_API_KEY` to confirm. The key must start with cf-sk-; sk-ant-* keys belong to Anthropic direct and won't validate here.
Can I use Claude Code's prompt caching?
Claude Code's cache_control flag passes through, but cache hit-rate depends on the upstream behavior. As of v1.11, prompt cache pass-through is not reliably guaranteed end-to-end — treat any savings as best-effort.
How do I switch back to Anthropic direct?
Unset both env vars (or set ANTHROPIC_BASE_URL=https://api.anthropic.com and ANTHROPIC_API_KEY=sk-ant-***). Note: Anthropic direct uses the same bare-host convention. Claude Code reads these env vars on every launch.
Don't have an API key yet?
Sign up for 300 free credits, 7-day trial, all models