Troubleshooting

Fixing Claude Code & Codex CLI Errors: 401, 404, 429 & Socket Closed Cheat Sheet

Language English / 中文

Fixing Claude Code & Codex CLI Errors: 401, 404, 429 & Socket Closed Cheat Sheet

When an API call fails in Claude Code, Codex CLI, or Cursor, the HTTP status code tells you which layer broke—so you can fix it in under a minute instead of guessing.

Quick Diagnostic Matrix

Error / Symptom Most Likely Cause Immediate Fix
401 Unauthorized Wrong header, revoked key, or wrong billing-mode key Verify key in Console; check subscription key vs metered key
404 Not Found Double /v1 in Base URL or wrong protocol Anthropic: https://llmapi.pro · OpenAI: https://llmapi.pro/v1
403 Forbidden Plan/model mismatch or inactive subscription Check active plan & GET /v1/models
429 concurrency_limit Too many simultaneous requests across all account keys Wait for Retry-After, lower client parallelism, or upgrade (Pro 2 / Max 4 / Ultra 10)
429 window / quota 5-hour rolling or weekly request window reached Wait for window reset, use quota reset if available, or upgrade tier
Socket closed / ECONNRESET Oversized request payload or transient upstream stream drop Run /compact to shrink huge context, then retry once

1. Fixing 404 in 10 Seconds

Run our zero-key checker at /tools/api-setup or check your env vars:

# Claude Code (Anthropic protocol — NO /v1)
echo "$ANTHROPIC_BASE_URL"   # should be https://llmapi.pro

# Codex CLI / OpenAI SDK (OpenAI protocol — WITH /v1)
echo "$OPENAI_BASE_URL"      # should be https://llmapi.pro/v1

2. Telling the Two 429s Apart

Read the JSON error body before retrying:

  • concurrency_limit: Your account currently has the maximum in-flight requests open across all keys (Pro 2 / Max 4 / Ultra 10). This does not consume plan quota. Wait 1–3 seconds (the Retry-After header) and retry.
  • Window / quota limit: Your 5-hour or weekly allowance is full. Check remaining recovery time on /subscription.

3. Handling Socket Closed / ECONNRESET

If a streaming reply disconnects mid-turn:

  1. Check /status to see if there is an active upstream incident.
  2. If your session context has grown past 150K+ tokens, run /compact—oversized payloads are far more likely to time out.
  3. Avoid aggressive retry scripts that fire 5+ parallel retries at once (which immediately trigger concurrency_limit).

Full error reference: /docs/errors

Share this article

Start using LLM API

Free tier available. One-line configuration for Claude Code.

Get Started Free