LLM API Error Troubleshooting: 401, 404, 400, 429 & Timeout Fixes

Fast diagnostic reference for Claude 5.x, GPT-6.2, Gemini 4, GLM-5.3, and media endpoints: exact per-client /v1 suffix rules, 2026 model parameter bans, and production exponential backoff with cross-model fallback.

1. HTTP Status Code Triage Matrix

Status Code Top Root Causes First Verification Step
401 Unauthorized Unexported env var; trailing newline/space; disabled or over-cap sub-key; raw curl to /v1/messages missing x-api-key / anthropic-version Check echo "${#DEEPCLUB_API_KEY}" and confirm sub-key status & balance in DeepClub Console
404 Not Found Double /v1/v1/... path; vendor-prefixed ID like openai/gpt-6.2-sol; retired model ID; calling /v1/responses on a Chat-only model Match your tool against the /v1 table below and copy exact model IDs from Live Pricing
400 Bad Request Hitting a 2026 model parameter ban (Claude sampling, GPT-6.2 effort="none", GLM-5.3 thinking.disabled); invalid image size or video seconds Strip disallowed fields using the 2026 Parameter Bans checklist below
429 Too Many Requests Client burst concurrency without a semaphore, or brief upstream congestion Cap concurrency and retry only 429/5xx with jittered exponential backoff + fallback model
504 / Client Timeout Long reasoning on gpt-6.2-astra or claude-fable-5-2 with non-streaming 30s–60s HTTP timeout Enable stream=True and raise client read timeout to 180–600s

2. Exact /v1 Base URL Rules Across Clients & SDKs (Prevent 404s)

Different SDKs and apps append completely opposite suffixes. Never copy a Base URL blindly across tools:

Client / SDK Base URL / Host to Enter Resulting Request Path Classic 404 Mistake
Claude Code https://deepclub.net (no /v1) /v1/messages Adding /v1 → /v1/v1/messages
Anthropic Python / Node SDK https://deepclub.net (no /v1) /v1/messages Adding /v1 → /v1/v1/messages
Dify Anthropic Plugin https://deepclub.net (no /v1) /v1/messages Adding /v1 → /v1/v1/messages
Continue (provider: anthropic) https://deepclub.net (no /v1) /v1/messages Adding /v1 → /v1/v1/messages
Vercel @ai-sdk/anthropic https://deepclub.net/v1 (with /v1) /v1/messages Omitting /v1 → /messages
Chatbox Claude Mode Host https://deepclub.net/v1 + Path /messages /v1/messages Omitting /v1 or duplicating /v1 in Path
OpenAI SDK / Cursor / Cline / Codex / Open WebUI https://deepclub.net/v1 (with /v1) /v1/responses or /v1/chat/completions Appending /chat/completions into Base URL

3. Verified 2026 Model-Specific 400 Parameter Bans

  1. claude-opus-5-5 / claude-sonnet-5-5 / claude-fable-5-2 (native /v1/messages): Reject custom temperature, top_p, top_k, and legacy thinking: {"type": "enabled", "budget_tokens": ...}. Remove sampling overrides and use thinking: {"type": "adaptive"} with output_config.effort.
  2. gpt-6.2-sol / gpt-6.2-astra: Reject reasoning.effort="none" with HTTP 400. Use low, medium, or high.
  3. glm-5.3: Thinking is always on; passing thinking: {"type": "disabled"} returns 400. Use {"type": "enabled"} with reasoning_effort="low" for faster turns.
  4. Gemini 4 (gemini-4-carbon / neon / argon / hydrogen): DeepClub serves Gemini 4 text over POST /v1/chat/completions. Do not send Google native generateContent URLs, and in Vercel AI SDK 5+ call openai.chat("gemini-4-neon") explicitly (Gemini 4 Migration Guide).

4. Production Retry & Cross-Model Fallback (Python)

Never retry 400, 401, or 404 configuration errors; retry only transient 429 / 5xx responses with jitter:

import os, random, time
from openai import APIStatusError, OpenAI, RateLimitError

client = OpenAI(
    base_url="https://deepclub.net/v1",
    api_key=os.environ["DEEPCLUB_API_KEY"],
    max_retries=0,
)

def resilient_chat(prompt: str, models=("gemini-4-hydrogen", "deepseek-v4.1-flash")):
    last_err = None
    for model_id in models:
        for attempt in range(3):
            try:
                return client.chat.completions.create(
                    model=model_id,
                    messages=[{"role": "user", "content": prompt}],
                    timeout=120.0,
                )
            except (RateLimitError, APIStatusError) as exc:
                if getattr(exc, "status_code", 0) not in (429, 500, 502, 503, 504):
                    raise
                last_err = exc
                time.sleep(min(20.0, (2 ** attempt) + random.uniform(0.2, 0.8)))
    raise RuntimeError(f"All models failed: {last_err}")

Tip: Open DeepClub Usage Logs—if no entry appears at all, the request failed locally (DNS, proxy, or wrong URL suffix) before reaching the gateway.

Deep-Dive Error Fix Articles

Frequently Asked Questions

How do I tell whether a 404 came from a wrong Base URL or a wrong model ID?
Check DeepClub Usage Logs. A wrong path like /v1/v1/messages typically fails before model billing logs appear, whereas an invalid or vendor-prefixed model ID fails after reaching a valid /v1 endpoint.
Should I retry 400 or 401 errors automatically in production?
No. 400, 401, and 404 indicate request parameter, auth, or routing configuration errors that will fail identically on every retry. Retry only 429 and 5xx with exponential backoff and jitter.
Do failed 400, 401, or 429 API calls consume my balance?
No. Failed error responses are not billed as completed generations.

Updated