Use NeverMetered with Claude Code
Anthropic's terminal coding agent, pointed at your own base URL and model.
qwen3.8-27bYOUR_API_KEY with your key.- 1
Create an API key
Create a key in API keys and name it after the tool, for example “Claude Code”. A dedicated key per tool lets you see its usage separately and give it its own parallel-stream cap. The key is shown once; the snippets below use
YOUR_API_KEYwhere it goes. - 2
Point Claude Code at the gateway
Set these before starting
claude. Every model variable points at the same model: Claude Code asks for its ownclaude-*model names for the main loop, subagents and background tasks, and those names don't exist here.ANTHROPIC_AUTH_TOKENsends your key as a bearer token without the interactive API-key prompt thatANTHROPIC_API_KEYtriggers.export ANTHROPIC_BASE_URL="https://api.nevermetered.com" export ANTHROPIC_AUTH_TOKEN="YOUR_API_KEY" export ANTHROPIC_MODEL="qwen3.8-27b" export ANTHROPIC_DEFAULT_OPUS_MODEL="qwen3.8-27b" export ANTHROPIC_DEFAULT_SONNET_MODEL="qwen3.8-27b" export ANTHROPIC_DEFAULT_HAIKU_MODEL="qwen3.8-27b" export CLAUDE_CODE_SUBAGENT_MODEL="qwen3.8-27b" export API_TIMEOUT_MS="600000" export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC="1" export CLAUDE_CODE_MAX_OUTPUT_TOKENS="8192" claude - 3
Or make it permanent
Put the same variables in the
envblock of your user settings so every session uses them. Merge them into the file if it already exists.~/.claude/settings.json{ "env": { "ANTHROPIC_BASE_URL": "https://api.nevermetered.com", "ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY", "ANTHROPIC_MODEL": "qwen3.8-27b", "ANTHROPIC_DEFAULT_OPUS_MODEL": "qwen3.8-27b", "ANTHROPIC_DEFAULT_SONNET_MODEL": "qwen3.8-27b", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "qwen3.8-27b", "CLAUDE_CODE_SUBAGENT_MODEL": "qwen3.8-27b", "API_TIMEOUT_MS": "600000", "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1", "CLAUDE_CODE_MAX_OUTPUT_TOKENS": "8192" } } - 4
Verify it works
Run a one-off prompt. Inside an interactive session,
/statusshows the base URL and model in use. The request shows up in Requests within a few seconds, with its input, cached and output tokens.claude -p "Reply with the word ready"
- Each subagent Claude Code starts runs as its own stream, so parallel subagents count against your parallel-stream limit. Extra requests wait in your queue allowance.
- Claude Code makes small background requests (for example session titles). On the free tier those count toward your daily requests;
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1cuts the optional ones. - Requests can wait in the fair queue when the service is busy, so keep
API_TIMEOUT_MSgenerous. Your plan allows up to 8,192 output tokens per request. - Unset
ANTHROPIC_API_KEYin the same shell so Claude Code doesn't warn about two competing credentials.
Troubleshooting
model_not_foundnaming aclaude-…model- One of the model variables above is missing, so Claude Code fell back to its own model name. Set all of them, then restart
claude. - Claude Code still talks to Anthropic
- The variables weren't visible to the
claudeprocess. Export them in the same shell (or usesettings.json) and check/status. 404 model_not_found- Use a model id exactly as
GET /v1/modelslists it, for exampleqwen3.8-27b. Plans can restrict which models a key may call. 429 concurrency_limit_exceeded- All your parallel streams are busy and your queue allowance is full. Lower the tool's parallelism (subagents, batch size), or get more streams on your plan.
- Answers stop mid-sentence
- The response hit your plan's output cap of 8,192 tokens (finish reason
lengthormax_tokens). Ask for shorter steps, or upgrade for a higher cap. 403 email_verification_required- Free requests need a verified email. Click the link in your verification email (you can resend it from the dashboard), or upgrade.
429 daily_quota_exceeded- You've used today's free requests; agents send one request per step, so they go quickly. The allowance resets at 00:00 UTC, and paid plans have no daily limit.
503/504 request_queue_timeout- The service stayed busy longer than the queue timeout and nothing was generated. Retry with backoff, and give the tool a generous request timeout.