Fix 401, 403, 429 and 5xx Errors
Fix OneProvider API problems fast: symptom, cause and solution for 400, 401, 403, 404, 429, 503 and 504, Claude Code login, VPN and when to call support.
Twelve concrete failure modes we see week-in, week-out. Symptom → cause → one-line fix.
All models, capabilities, and prices Documentation index for AI agents:https://oneprovider.dev/docs/llms.txt Before you start Run curl -s https://api.oneprovider.dev/v1/models -H "x-api-key: $ANTHROPIC_API_KEY". If it returns a non-empty JSON model list, your network reach and auth are fine — whatever you’re hitting is request-specific, not infrastructure. Top questions
Do I need to log into Claude Code? What about 401 and “Auth conflict”
No. The OneProvider key works without a Claude account. For Claude Code set ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN (the key is sent as Authorization: Bearer). This variable takes precedence over a saved login and over the other variables, and needs no approval prompt. Our gateway also accepts ANTHROPIC_API_KEY (x-api-key header), but in interactive mode Claude Code asks you once to approve such a key and silently ignores a declined one (re-enable it under /config → Use custom API key).
If you see the login screen, 401 Invalid API key or Auth conflict, go step by step:
- Run
/status: it should show the OneProviderAnthropic base URLand anAuth tokenorAPI keyline naming your variable. ALogin methodline with a claude.ai account means the variable did not reach the session. Auth conflict(both a claude.ai login and a key): run/logout; your variables stay.401 Invalid API key: a foreignANTHROPIC_AUTH_TOKEN(a token from another service) overrides your key, or the value has a stray quote or space. Set it to the full OneProvider key, without quotes.- The login screen stays although the variables are in a project’s
.claude/settings.json: that block is read after first-run setup, so put the variables in your shell or in~/.claude/settings.json.
# macOS / Linux: what is actually set
env | grep -E 'ANTHROPIC_(BASE_URL|AUTH_TOKEN|API_KEY)' | sed -E 's/(sk-.{4}).*/\1.../'
grep -nE 'ANTHROPIC_(AUTH_TOKEN|API_KEY)' ~/.zshrc ~/.bashrc 2>/dev/null Do I need to log into ChatGPT for Codex CLI?
No. Codex CLI reads OPENAI_BASE_URL and OPENAI_API_KEYfrom the environment. When both point to OneProvider, Codex bypasses the ChatGPT sign-in entirely and talks to our endpoint. So you can skip the auth screen.
If a stale token or shell-rc export gets in the way:
bashunset OPENAI_API_KEY
rm -f ~/.codex/auth.lock
# then re-export the values from your redeem page and restart codex
export OPENAI_BASE_URL="https://api.oneprovider.dev/v1"
export OPENAI_API_KEY="sk-..."
codex Full walkthrough on the Codex (OpenAI) page.
Do I need a VPN? Any regional restrictions?
No VPN is needed — OneProvider has no regional restrictions. The endpoint api.oneprovider.dev is reachable worldwide and does not geoblock traffic.
Worse, VPN / VLESS proxies often break the API connection in two ways:
- SSE streaming is buffered inside the proxy — the stream gets cut off mid-token.
- HTTP/2 + ALPN negotiation breaks at relay hops — the client sees
connection reset.
If you’re seeing cut-off streams, connection reset, or random timeouts, disable the VPN / VLESS proxy and retry. We do not buffer streams on our side.
JSON parse error in config (or a 429)
The most common cause is “smart” quotes (“ ”) in your JSON config. They appear when you copy from a messenger, Notion, Google Docs, or a browser that auto-replaces ASCII quotes with typographic ones. JSON parsers only accept plain ASCII ".
Sometimes a broken config doesn’t surface as “JSON parse error” but as a 429: the client treats the missing answer as a rate limit. Same fix:
- Replace every
“”with"by hand. - Copy configs directly from this documentation — the quotes are already correct here.
- Validate with
cat -v config.jsonorjq . config.json— both flag the bad byte.
# Quick check: jq fails on the first smart quote
jq . ~/.claude/settings.json
# Auto-replace smart quotes with straight quotes
sed -i.bak $'s/[\u201c\u201d]/"/g' ~/.claude/settings.json Symptom matrix
| Symptom | Likely cause | Fix |
|---|---|---|
| 401 authentication_error on every request | Key is unset, malformed, or has a stray newline / quote from a copy-paste. | echo "${ANTHROPIC_API_KEY:?missing}" | wc -c # expect 68 (sk- + 64 hex + newline) |
| 429 'Insufficient balance on this API key' | The key has no balance left. Retries will not help: the response has x-should-retry: false. | curl -sH "Authorization: Bearer $ANTHROPIC_API_KEY" https://api.oneprovider.dev/v1/dashboard/balance # then top up your cabinet (bot or app.oneprovider.dev) |
| 403 permission_error 'API key expired' | The key is past its expiry date. | Renew the key or issue a new one in your cabinet (Keys page). |
| 404 'The requested API endpoint does not exist' | Wrong base URL: /v1 is missing or doubled (/v1/v1). | OpenAI clients: https://api.oneprovider.dev/v1. Claude Code and Anthropic SDKs: https://api.oneprovider.dev (no /v1). |
| 429 rate_limit_error in spikes | Too many requests in a short time. | Respect Retry-After and retry with a growing pause. Lower parallel requests. |
| 400 'Model X is not available on this API key' | Your key's plan does not include this model, or the model name is outdated. | Pick a model from GET /v1/models or the table on /docs/api/models. |
| 503 'Temporary provider issue on our side, retry in a minute' | A temporary failure on our side. Your key and request are fine. | Retry with a growing pause: 1 s, 2 s, 4 s, up to a minute. |
| 504 'Service timed out; retry later' on a non-streaming call | A long generation (big context + tools) did not start answering within 6 minutes, or ran past 10 minutes. | Pass stream:true: a stream starts answering right away. If one answer needs more than 10 minutes, split the task. |
| Tool call replaced with prose ('I would have called X...') | Client sent tool_choice:{any|tool} → the API rewrote it to auto + hint; model didn't take the hint. | Tighten the user prompt ("Use the X tool to do Y"), or switch to a stronger model. |
| OPENAI_API_KEY is overriding my OneProvider key | An old export in your shell rc (~/.zshrc, ~/.bashrc) shadows the new value. | unset OPENAI_API_KEY in this shell, then grep -nE 'OPENAI_API_KEY' ~/.zshrc and clean it up. |
| Codex says 'Invalid API key' even though auth.json is set | Codex prefers shell-exported OPENAI_API_KEY over ~/.codex/auth.json. | unset OPENAI_API_KEY; rm -f ~/.codex/auth.lock; restart codex. See /docs/clients/codex. |
| Cursor / Claude Code: streaming response gets cut off mid-token | Almost always a client-side network proxy or VPN buffering SSE chunks. | Disable the proxy/VPN and retry. We send chunks as soon as they are ready, with no buffering. |
Diagnostic one-liners
If the symptom matrix didn’t hit your case, capture these three pieces of evidence:
bash# 1. Confirm reach + auth
curl -sS -o /dev/null -w "HTTP %{http_code} total %{time_total}s\n" \
https://api.oneprovider.dev/v1/models -H "x-api-key: $ANTHROPIC_API_KEY"
# 2. Reproduce the failing call with -v (verbose headers)
curl -sv https://api.oneprovider.dev/v1/messages \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{"model":"claude-sonnet-5-5","max_tokens":32,"messages":[{"role":"user","content":"hi"}]}'
# 3. Check your current balance (also shown in the cabinet: the @oneprovider_robot bot or app.oneprovider.dev)
curl -s https://api.oneprovider.dev/v1/dashboard/balance \
-H "Authorization: Bearer $ANTHROPIC_API_KEY" When to escalate
Send the three outputs above + the first 8 characters of your key + a UTC timestamp to @Oneproviderhelpbot . That’s enough for us to find your request in our logs within minutes. See Get support for what we don’t need (and never ask for).
Last updated: 2026-10-05 Found a bug? @Oneproviderhelpbot