Blog

Guides, comparisons, and insights on LLM routing and AI API cost optimization.

Fix: anthropic-beta header rejected — Claude Code 400s on Bedrock, Vertex and proxies

Claude Code attaches experimental anthropic-beta headers that third-party endpoints do not implement, so requests are rejected before the model sees them — and the 400 usually blames a parameter instead of the header. How to confirm it and where to strip them.

Fix: tool_result / tool_use mismatch — Claude Code 400 errors through a proxy

A 400 on the step after a tool call: duplicate tool_result blocks for one tool_use id, an orphaned result, or 'value did not match any expected variant'. Why translation layers break the tool-call contract, and how to find the offending turn.

Fix: "Unknown parameter: output_config" — Claude Code through a proxy or non-Anthropic model

Claude Code fails with a 400 unknown-parameter error the moment you point it at LiteLLM, Bedrock, Vertex or any OpenAI-compatible proxy. Why the client sends fields the upstream has never heard of, and the three places the fix can live.

Fix: "prompt is too long: N tokens > M maximum" — Anthropic 400

Claude returns a 400 when your prompt plus max_tokens exceeds the model's context window. Why long agent sessions hit it suddenly, how the budget actually adds up, and five fixes ranked by how much conversation you keep.

Fix: "connection refused" on localhost:11434 — Local LLMs in Cursor & Claude Code

Pointing Cursor or Claude Code at a local Ollama or LM Studio endpoint and getting connection refused, ECONNREFUSED, or a silent hang? The five real causes — wrong port, missing /v1 suffix, loopback binding, the app not running, and cloud-side IDE features that can never reach localhost.

Fix: "Incorrect API key provided" — OpenAI 401 invalid_api_key

OpenAI's 401 invalid_api_key is rarely a wrong key — it is usually a stale environment variable, a trailing newline, a revoked key, or the wrong provider's key reaching an OpenAI-compatible endpoint. How to find which one in under a minute.

Fix: "The model `X` does not exist or you do not have access to it" — OpenAI model_not_found

The OpenAI model_not_found 404 usually is not a typo — it is access, org, or endpoint mismatch. Why a model works for someone else but not your key, the four real causes, and how to list the models your key can actually see.

Fix: Anthropic 529 "Overloaded" — What overloaded_error Means and How to Handle It

Anthropic's HTTP 529 overloaded_error means the API is under load — not that you did anything wrong. How it differs from 429 rate limits, why it comes in bursts, correct retry strategy, and how to keep coding agents productive through it.

Fix: "Your credit balance is too low to access the Anthropic API" — Claude 400 Error

Why the Anthropic credit balance error appears even for Claude Pro/Max subscribers, how prepaid API credits work, the Claude Code case where a login/API-key mixup triggers it, and how to fix and prevent it.

Fix: Gemini 429 "Resource has been exhausted (e.g. check quota)" — RESOURCE_EXHAUSTED Explained

Gemini's RESOURCE_EXHAUSTED 429 covers several different limits: free-tier per-minute and per-day caps, paid-tier rate limits, and project quota. How to tell which one you hit, fixes for each, and the free-tier math that surprises people.

Fix: "You exceeded your current quota, please check your plan and billing details" — OpenAI 429 insufficient_quota

The OpenAI 429 insufficient_quota error is a billing problem, not a rate limit. What the error actually means, why it hits accounts with a paid subscription, and how to fix it in the API dashboard, in code, and in coding agents.

Fix: "This model's maximum context length is ... tokens" — OpenAI context_length_exceeded

The context_length_exceeded 400 error means your messages plus max_tokens overflowed the model's context window. Why coding agents hit it mid-session, how the math actually works, and five fixes ranked by how much history you keep.

Claude Code Router (CCR) Explained: What It Is, How It Works, and When a Hosted Router Fits Better (2026)

A factual guide to Claude Code Router — the open-source local gateway that routes Claude Code, Codex and other coding agents across OpenAI, Anthropic, Gemini, OpenRouter, DeepSeek, Kimi and more — with install commands, the feature list from its README, and an honest comparison against a hosted router like CodeRouter.

The LLM API Error Reference — Exact Error Strings, Causes, and Fixes (2026)

A maintained reference of real LLM API errors, organized by exact error message: DeepSeek reasoning_content 400s, Claude Code 401s, Cursor base-URL failures, Gemini endpoint 404s and more — each with cause and working fixes.

Fix: cc-switch Local Proxy Failed on Codex Endpoint — DeepSeek HTTP 400 reasoning_content

Seeing 'cc switch local proxy failed while handling codex endpoint /responses ... upstream_status: http 400; cause: the reasoning_content in the thinking mode must be passed back to the api'? What the error chain means, why proxies trigger it with DeepSeek thinking models, and three working fixes.

"DeepSeek returned tool calls without replayable thinking content" — What This Warning Means and How to Fix It

Your agent logs show 'deepseek returned tool calls without replayable thinking content; continuing with degraded reasoning'. What the warning actually tells you, whether degraded reasoning matters, and how to restore full thinking round-trips.

LangChain + DeepSeek Reasoner: Fixing the reasoning_content 400 in Tool-Calling Chains (2026)

Using langchain-deepseek with deepseek-reasoner and tool calling? The 'reasoning_content in the thinking mode must be passed back' 400 appears when chain state drops the thinking block. Version guidance, message-history handling, and a router-side fix.

Agent Router Models: Which Models Belong in a Coding Router's Pool (2026)

Which models should an agent router actually route between? The 2026 lineup by tier — frontier reasoning, workhorse implementation, and cheap bulk models — with real per-token pricing, what each tier should handle, and how to audit which model served your request.

Agent Router API: How It Works, How to Call It, and What to Look For (2026)

What an agent router API actually is — an OpenAI-compatible endpoint that sits between your coding agent and model providers. Setup examples for Cursor, Claude Code, and raw HTTP, plus the API features that separate good routers from thin proxies.

Google AI Studio Base URL Override: Use Gemini with Any OpenAI-Compatible Tool (2026)

How to override the base URL to use a Google AI Studio (Gemini) API key with OpenAI-compatible tools — the official compatibility endpoint, correct model names, common 404/401 errors, and when a router is the cleaner fix.

Is an Agent Router (AgentRouter) Safe? How to Tell a Legit LLM Router From a Risky One (2026)

Agent routers sit between your coding agent and your LLM provider — which means they see your prompts, your code, and sometimes your API keys. Here's what a router can actually access, the six real risks, and a legitimacy checklist for evaluating any routing service.

Kimi K3 for AI Coding Agents: Pricing, Benchmarks, and Where It Actually Fits in Your Routing Stack

Moonshot's Kimi K3 (2.8T params, 1M context, native vision) just beat Claude Opus 4.8 and GPT-5.5 on coding and agentic benchmarks — at $3/$15 per million tokens. Here's a router operator's honest read: real pricing math with cache economics, phase-by-phase fit for Cursor / Claude Code / Aider workloads, and what changes for your API bill.

Override OpenAI Base URL in Cursor: The Complete Configuration Guide (2026)

Step-by-step guide to configuring Cursor's Override OpenAI Base URL for custom models — covers OpenAI-compatible providers, Anthropic via router, DeepSeek, model settings, and troubleshooting. Everything you need to route Cursor through your own endpoint.

Claude Code 401 With a Custom Base URL: ANTHROPIC_API_KEY vs ANTHROPIC_AUTH_TOKEN

Pointing Claude Code at a proxy or router via ANTHROPIC_BASE_URL and getting 401 authentication_error / invalid x-api-key? The cause is almost always which env var you used. Here's the header-level difference and the exact working setup.

Cursor "Override OpenAI Base URL" Breaks Claude Models — What Works and What Doesn't

Setting a custom OpenAI base URL in Cursor can break Anthropic/Claude models with 422 errors, and several Cursor features ignore the override entirely. The exact failure modes, working configurations, and a router setup that avoids the trap.

Fix: "The `reasoning_content` in the thinking mode must be passed back to the API" — DeepSeek 400 Error

DeepSeek V4 returns HTTP 400 when tool calls meet thinking mode and your client strips reasoning_content. Why it happens, three working fixes (client patch, router-side fix, disable thinking), and how to verify.

Agent Router Alternative: Complete Guide to AI Coding Model Routers in 2026

Looking for an agent router alternative? Compare OpenRouter, LiteLLM, RouteLLM, Portkey, and CodeRouter — features, pricing, best practices, and how phase-aware routing cuts coding costs 70-90%.

We Just Cut Our Own AI Coding Bill 83% in 12 Hours — Here's the Data

Our smart-routing product had a blind spot: 80%+ of traffic was bypassing the router because client defaults hardcoded Opus. After 12 hours of fixes, real data: per-request cost down 36%, Opus share of spend from 80% to 45%, honest savings from 60% to 91%, ~$90K/month saved. Here's the story.

我们把自家 AI 编码账单砍掉 83% —— 12 小时复盘(2026 真实数据)

我们的智能路由产品发现了一个尴尬的盲区:大部分流量根本没在路由。修完之后 12 小时真实数据:每请求成本降 36%,Opus 花费占比从 80% 降到 45%,真实 savings 从 60% 升到 91%。这是过程和数据。

中转站 vs 任务路由:为什么 80% 的 AI 编码账单是浪费(2026)

中文圈 LLM 中转站的本质是 OpenAI / Anthropic API 转售,大多数把所有请求都发给 Opus 或 GPT-5。我们用 5000 次真实路由的生产数据告诉你:为什么 80% 的编码 token 应该用 V4-Flash / Sonnet 而不是 Opus,以及任务感知路由和中转站的本质区别在哪里。

AI Coding Agent Bills Out of Control? A Developer's Survival Guide (2026)

GitHub Copilot just raised prices 6x. Claude Code heavy users burn $50-200/day. Here's why AI coding bills spiral — and the 5 concrete steps to cut them by 60-90% without losing productivity.

Best OpenRouter Alternatives for AI Coding Agents (2026)

OpenRouter is great for model access, but it won't cut your coding bill. Here are 7 alternatives that actually reduce what you spend on Claude Code, Cursor, Aider, and Copilot — with real pricing and tradeoffs.

The reasoning_content Trap: Why DeepSeek, Kimi, and GLM Break Your Multi-Turn Agent (and How to Fix It)

Chinese LLMs ship with a 'thinking mode' that breaks the OpenAI/Anthropic API contract on turn 2. Real production errors from Claude Code, Cursor, and Aider — plus the one-line fix per provider, a cross-provider audit checklist, and why this trap will keep biting API gateways through 2026.

We Run Coding Agents on 7 Different LLMs Per Session — Here's the 30-Day Production Data

Most LLM routers pick by cost or capability. Phase-aware routing detects which phase of coding you're in (plan / implement / debug / test / refactor / docs / small-edit) and routes each call independently. After 30 days in production: 78% cost savings, 7 different models touched per Claude Code session, no measurable quality regression. The detection algorithm, the model assignments, the pitfalls, and the data.

April 2026 Frontier Model Cheat Sheet — GPT-5.5, DeepSeek V4, Kimi K2.6 at a Glance

Four major coding models dropped in one week (April 20–23, 2026): GPT-5.5, GPT-5.4, DeepSeek V4 Pro/Flash, and Kimi K2.6. One table, one decision tree, one verdict per task. Skip the marketing — here's what actually changed for coding agents and which model to pick for which job.

DeepSeek V4 Pro vs V4 Flash: Which to Use for Coding Agents (2026)

DeepSeek V4 ships in two tiers. V4 Pro at $1.74/$3.48 scores 81% on SWE-bench Verified — near-Opus territory. V4 Flash at $0.14/$0.28 is 12× cheaper, still 1M context, still strong on implementation. Here's the decision matrix for coding agents, plus why pinning just one wastes money.

GPT-5.5 vs Claude Opus 4.7 for Coding (Benchmarks + When to Use Which)

OpenAI's GPT-5.5 tops the Artificial Analysis Intelligence Index at 60, beating Opus 4.7 on Terminal-Bench 2.0 (82.7% vs 75.1%) — but Opus still wins real-world SWE-Bench Pro (64.3% vs 58.6%). Here's how to pick per-task, and why paying for both via phase-aware routing is cheaper than committing to one.

Kimi K2.6 Review: The $0.60 Model That Matches GPT-5.5 on SWE-Bench Pro

Moonshot's Kimi K2.6 (April 2026) scores 58.6% on SWE-Bench Pro — tied with GPT-5.5 — at $0.60/$4.00 per 1M. It's open-weight, 256K context, purpose-built for long-horizon agentic coding (300 sub-agents, 4000 steps). Full review, benchmarks, and when it's the right pick over Claude Opus, GPT-5.5, and DeepSeek V4.

Claude Code Cheap API Router Setup (2026 Guide)

Cut Claude Code's bill 50–80% by routing every call through a phase-aware proxy. Includes the AUTH_TOKEN-not-API_KEY trap, the experimental-betas fix for v2.1.x, and a complete settings.json template that just works.

Aider Cost Optimization 2026: Architect/Editor + Phase-Aware Routing

Aider's architect + editor split is brilliant — but both modes default to Opus. Here's how to combine Aider's --architect flag with phase-aware routing for 80%+ cost reduction without touching your workflow.

CodeRouter vs OpenRouter for Coding (2026): Which One Actually Saves You Money?

OpenRouter and CodeRouter sound similar — both are 'routers'. But they solve different problems. OpenRouter gives you multi-model access; CodeRouter reduces your coding agent bill by picking the cheapest capable model per request automatically.

How to Cut Your Cursor Bill by 70–90% in 2026 (Complete Guide)

Cursor Pro burns tokens fast when you hit fast-request limits. Here's how phase-aware API routing cuts your real monthly coding spend without switching away from the Cursor IDE.

DeepSeek V3 vs Claude Sonnet 4.6 for Coding (2026 Benchmarks + When to Use Which)

Head-to-head: DeepSeek V3 at $0.28/$0.42 vs. Claude Sonnet 4.6 at $3/$15 per 1M. On coding tasks, when does the 15× cost difference show up in output quality — and when doesn't it?

GitHub Copilot Alternative 2026: Why Power Users Are Moving to Phase-Aware Routing

GitHub Copilot's $10/month is cheap but locks you into their model choices. For power users who hit Copilot's rate limits, phase-aware routing via a Custom Model endpoint delivers more context + cheaper per-token + model diversity.

Phase-Aware LLM Routing Explained (2026): Plan → Opus, Test → DeepSeek

Most LLM routers pick one model and stick with it. Phase-aware routing detects which *phase* of coding you're in — planning, implementing, debugging, testing — and picks the cheapest capable model per phase. Here's how it works in <10ms.

Get weekly AI cost optimization tips

Join 2,000+ developers saving on LLM costs