/// claude code
Claude Code on your own GPU
Wide Area Intelligence exposes an Anthropic Messages-compatible gateway at https://wideareaai.com/anthropic. Claude Code can use it directly with your wai_sk_... key, while WAI still routes the request through your local nodes first and falls back to cloud when your policy and credits allow it.
What you need
- A WAI gateway key from
Dashboard -> Settings -> API Keys. - A node online if you want local serving. For coding, deploy a coder model such as Qwen Coder from the Models page.
- A context window large enough for agent work. Start at 32k when your hardware can fit it.
- A Claude-shaped model alias, usually
claude-local-code, created inDashboard -> Models -> Model Mapping tab.
Quickstart
Claude Code uses Anthropic environment variables, not OpenAI ones. Set the base URL to WAI's /anthropic surface and use your WAI gateway key as the Anthropic auth token.
# 1. Use your WideAreaAI gateway key from Dashboard -> Settings -> API Keys. export ANTHROPIC_BASE_URL="https://wideareaai.com/anthropic" export ANTHROPIC_AUTH_TOKEN="wai_sk_..." # 2. Let Claude Code list Claude-shaped models from the gateway. export CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1 # 3. Use a Claude-shaped alias that you create in Dashboard -> Models -> Model Mapping tab. claude --model claude-local-code
$env:ANTHROPIC_BASE_URL = "https://wideareaai.com/anthropic" $env:ANTHROPIC_AUTH_TOKEN = "wai_sk_..." $env:CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY = "1" claude --model claude-local-code
Create the model alias
Claude Code expects Claude-style model names. In WAI, create an alias so Claude Code asks for a Claude-shaped id while the gateway can serve a local model first.
Requested model: claude-local-code
Backend 1: local, your deployed coder model, for example Qwen2.5-Coder-7B-Instruct-Q4_K_M.
Backend 2: cloud, for example anthropic/claude-sonnet-4.5 or your preferred fallback.
Model field: leave honest model reporting enabled if you want Claude Code to keep seeing the alias it requested.
With this setup, Claude Code can keep using claude-local-codewhile WAI decides whether the actual request lands on your node, a cloud Anthropic model, or another configured fallback.
Verify the gateway
Before opening a real repository in Claude Code, verify the Anthropic endpoint with a tiny request.
curl https://wideareaai.com/anthropic/v1/messages \
-H "Authorization: Bearer wai_sk_..." \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "claude-local-code",
"max_tokens": 128,
"messages": [
{"role": "user", "content": "Reply with one sentence from the WAI Anthropic gateway."}
]
}'curl -N https://wideareaai.com/anthropic/v1/messages \
-H "Authorization: Bearer wai_sk_..." \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "claude-local-code",
"max_tokens": 128,
"stream": true,
"messages": [{"role": "user", "content": "Stream three short bullets."}]
}'curl https://wideareaai.com/anthropic/v1/models \ -H "Authorization: Bearer wai_sk_..."
Supported Anthropic endpoints
| Endpoint | Status | Notes |
|---|---|---|
/anthropic/v1/messages | Supported | Streaming and non-streaming chat. Converts to WAI's existing OpenAI-compatible gateway internally. |
/anthropic/v1/models | Supported | Returns active Anthropic cloud models plus enabled Claude-shaped aliases. |
/anthropic/v1/messages/count_tokens | Approximate | Returns a rough local estimate for compatibility. It is not provider-exact billing data. |
Tools and routing behavior
Claude Code sends tool definitions and tool results through the Anthropic Messages API. WAI translates those into OpenAI-compatible tool calls before routing to your node or cloud fallback. Local model quality depends heavily on whether the model supports function/tool calling and whether the node was started with a large enough context window.
You can still use WAI routing controls. Add X-WAI-Node to target a specific node when testing, or let the gateway rank ready nodes and fail over according to your account settings. Response headers such as X-WAI-Served-By, X-WAI-Served-Model, andX-WAI-Alias-Id show where a request actually ran.
Token counting
Claude Code may call /v1/messages/count_tokens. WAI answers that endpoint so the client does not fail, but the count is an estimate. Actual request logging and credit billing still come from the model response usage when the upstream reports it.
curl https://wideareaai.com/anthropic/v1/messages/count_tokens \
-H "Authorization: Bearer wai_sk_..." \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "claude-local-code",
"messages": [{"role": "user", "content": "Count this."}]
}'Troubleshooting
401 authentication error: use a WAI gateway key, not a node key. Set it as ANTHROPIC_AUTH_TOKEN or send Authorization: Bearer wai_sk_....
Claude Code cannot see your local alias: the model id must start with claude or anthropic for Claude Code gateway discovery. Use claude-local-code or another Claude-shaped alias.
No upstream available: bring a node online, deploy the model named in the alias, or add credits for cloud failover.
The local model ignores tools: use a tool-capable coder model and raise the node context window. Agent workloads often fail on 4k context even when simple chat works.
Want pure cloud Claude: skip the local backend in your alias and point it directly at anthropic/claude-sonnet-4.5, or run claude --model anthropic/claude-sonnet-4.5 if that model appears in discovery.
related