How do I use NanoGPT with Claude Code?
Set ANTHROPIC_BASE_URL to https://nano-gpt.com/api/v1 and ANTHROPIC_AUTH_TOKEN to your NanoGPT key; NanoGPT serves the Anthropic Messages API there. Claude bills pay-as-you-go at list price, and included open-weight models can use the $12 PRO allowance.
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "YOUR_NANOGPT_API_KEY",
"ANTHROPIC_BASE_URL": "https://nano-gpt.com/api/v1",
"API_TIMEOUT_MS": "600000",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "anthropic/claude-opus-5.5",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "anthropic/claude-sonnet-5.5",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "anthropic/claude-haiku-latest"
}
}
NanoGPT recommends the api.nano-gpt.com host for larger requests or longer runtimes. To use the PRO allowance, set the model variables to an included open-weight model instead of Claude. Run /status in Claude Code to check the base URL.
Which models cost what
Included models cost nothing extra until the weekly allowance runs out, which is why NanoGPT suits Claude Code on open-weight models. Claude through NanoGPT costs the same as Anthropic's list price.
Gotchas
| Issue | What happens | What to do |
|---|---|---|
| Long sessions | Large requests can time out on the default host | NanoGPT suggests https://api.nano-gpt.com/api/v1 and API_TIMEOUT_MS=600000 |
| Cached requests | On chat completions, cache markers move a request to pay-as-you-go; NanoGPT says not to assume the same for /v1/messages | Watch whether Claude Code requests show as subscription or paid usage in your account |
| 2x models | GLM 5.2, DeepSeek V4 Pro and Kimi K2.7 Code count input twice against PRO | Prefer a 1x model such as GLM 5.3 for long sessions |
| Spend | Paid models draw on your balance with no cap by default | Set a daily, weekly or monthly USD cap on the key |
| Tool use | Open-weight models handle Claude Code's tools less reliably than Claude | Test a real task before switching a team |
From docs.nano-gpt.com (Claude Code, prompt caching, rate limits) and NanoGPT's updates feed, October 13, 2026.
The catch
The cheap path here is an open-weight model inside Claude Code. That works for many tasks, but Claude Code's prompts and tools are written for Claude, so expect more retries on hard steps.
Where Standard Compute fits
Standard Compute takes the same two variables and does the mixing per request: routine steps go to efficient models and hard ones to Claude, with no weekly allowance, in a plan from $19 that stops at its budget. If GLM or DeepSeek handle all your sessions well, NanoGPT PRO at $12 is cheaper.
FAQ
Does NanoGPT support the Anthropic Messages API?
Yes. NanoGPT documents POST /v1/messages with "full Anthropic API compatibility", authenticated with a Bearer token or x-api-key, at https://nano-gpt.com/api/v1/messages.
Can I use my NanoGPT subscription in Claude Code?
For included open-weight models, yes: set ANTHROPIC_MODEL or the default model variables to one of them. Claude models are never included and bill pay-as-you-go.
Does NanoGPT work with Codex CLI?
Yes. NanoGPT documents base_url https://nano-gpt.com/api/v1 with env_key NANOGPT_API_KEY and wire_api = "responses".
Which NanoGPT model should I use in Claude Code?
NanoGPT's docs show Claude Opus 5.5, Sonnet 5.5 and Haiku in the default model variables. For the subscription, pick an included 1x model; test it on your own repository first.