Blog

Blog

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

Claude Code with DeepSeek, GLM-5.3 and Kimi K2.6: Setup, a Tested Run, and What It Really Cost

How to run Claude Code on open models (DeepSeek V4.1 Flash, GLM-5.3, Kimi K2.6) with one key. We ran the same bug-fix task on each: all three fixed it without touching the tests, at $0.004–$0.052 per run. Claude Code's own cost summary said up to 22× more, because it prices models it doesn't know as Claude. The exact environment variables, which model to pick, and the gotchas.

Claude Code on Open Models, 30 Real Tasks: Kimi K2.6 Cost 4.8× Sonnet 5.5 per Task and Solved 7 Fewer

We ran Claude Code itself on 30 real repository tasks with Claude Sonnet 5.5, GLM-5.3, DeepSeek V4.1 Flash and Kimi K2.6. Sonnet solved 16, GLM-5.3 14, DeepSeek and Kimi 9 each. DeepSeek was the cheapest per solved task; Kimi K2.6 cost 4.8× Sonnet per task, hit our 60-minute limit on half the tasks, and spent most of its output on reasoning Claude Code never saw. Full per-session data.

Claude Fable 5.2 at Medium Effort: The Same Tasks Solved for 72% Less, Still 2× Opus

We reran Claude Fable 5.2 on the same 30 coding-agent tasks at Medium effort, Claude Code's default, instead of the API default (high). It solved the same 15 of the 24 tasks both runs finished, at 0.28× the cost, and was cheaper on every one of them. Across all 30 tasks it solved 17, against Opus 5.5's 18 and Sonnet 5.5's 17, at 2.2× Opus's cost and 5.7× Sonnet's.

Claude Fable 5.2 on Coding-Agent Tasks: The Same 15 Solved as Sonnet 5.5, at 20× the Cost

We ran Claude Fable 5.2 at its API defaults on 30 randomly chosen tasks from our 99-task coding-agent benchmark and compared it with Opus 5.5, Sonnet 5.5, Haiku 5.5, OpenRouter Auto Code and CodeRouter on the same tasks. On the 24 tasks that finished within budget, Fable solved 15 (Opus 16, Sonnet the same 15) at $1.57 per task: 8× Opus and 20× Sonnet. Results, where the cost comes from, method and data.

OpenRouter Auto Code 对比 CodeRouter:99 道编程 Agent 任务实测,完成率相近,每个完成任务的花费约一半

我们把 OpenRouter Auto Code、CodeRouter 默认路由,以及全程 Claude Opus 5.5、Sonnet 5.5、Haiku 5.5 放在同样的 99 道真实仓库任务上,每题跑 2 次,容器全程断网。Auto Code 比 CodeRouter 多完成 4 个百分点,差别在误差范围内;CodeRouter 每个完成任务的花费约为 Auto Code 的一半,而 Auto Code 的花费和全程 Opus 一样。完成率最高的是全程 Opus;全程 Sonnet 和 CodeRouter 完成率相同、花费更低。五组结果、方法和原始数据都在文中。

OpenRouter Auto Code vs CodeRouter on 99 Coding-Agent Tasks: Similar Completion, Half the Cost per Solved Task

We ran OpenRouter Auto Code, CodeRouter's default routing, and Claude Opus 5.5, Sonnet 5.5 and Haiku 5.5 on their own on the same 99 real repository tasks, twice each, offline. Auto Code completed 4 points more than CodeRouter, a gap within noise; CodeRouter cost half as much per solved task, and Auto Code cost the same as Opus. Opus completed the most, and all-Sonnet matched CodeRouter for less. All five results, the method and the raw data.

Coding-Agent Routers Compared (2026): OpenRouter Auto Code, CodeRouter, and When to Use Neither

A decision guide for routing Claude Code, Codex and Cursor traffic: OpenRouter's Auto Router and Auto Code, CodeRouter, calling a provider directly, or a self-hosted LiteLLM gateway. How each picks the model, what it charges, how it treats the prompt cache, what it stores, and when you don't need a router at all.

OpenRouter Auto Code 是什么?编程 Agent 路由怎么选(2026)

OpenRouter 11 月 6 日推出面向编程 agent 的路由 Auto Code(openrouter/auto-code)。它怎么为每一轮选模型和推理强度、怎么对待提示缓存、收不收费、怎么在 Claude Code 里用;以及 Auto Code、CodeRouter、直连模型、自建 LiteLLM 四种做法各适合什么情况。OpenRouter 的信息均引自其官方文档,2026 年 11 月核对。

OpenRouter Auto Code Explained: How It Picks a Model for Coding Agents, and What It Costs

OpenRouter's Auto Code (openrouter/auto-code) is a router for coding agents. How it narrows the model pool, rates each turn, protects the prompt cache, what it costs, how to call and restrict it, and how it differs from CodeRouter. All OpenRouter facts quoted from its docs, checked November 2026.

OpenRouter Pricing in 2026: Credit Fees, BYOK, Free Models and Minimum Top-Up

How OpenRouter charges in 2026: provider list prices with no markup, a 5.5% (Standard) or 8% (Business) fee on credit purchases, the $25,000 monthly BYOK allowance, free-model limits, credit expiry and refunds, plus a worked team example with the formula. Quoted from OpenRouter's pricing page and FAQ, checked November 2026.

How to Use a Model Router with Claude Code: OpenRouter (Including Auto Code) and CodeRouter, Step by Step

Step-by-step setup for running Claude Code through OpenRouter, including the openrouter/auto-code router, and through CodeRouter. The environment variables, the ANTHROPIC_API_KEY trap, how to check it worked, fixes for model-not-found errors, and how to keep the prompt cache warm. OpenRouter steps quoted from its docs, checked November 2026.

Our Router Said Opus Would Cost $3.36. It Cost $2.56. What to Measure Before You Pick a Coding Router

OpenRouter launched Auto Code, a router for coding agents, on November 6. Coding routers are going mainstream. Six things to measure before you trust any of them, with the numbers from our own router and our own team's traffic.

LiteRouter Review: Plans, Limits, Claude Code Setup and Alternatives (2026)

What LiteRouter is, what its $3–$17 plans include, how requests are counted, how Claude Code and Cursor work with it, and when a different router fits coding agents better.

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.

AgentRouter Alternatives: Complete Guide to AI Coding Model Routers in 2026

What AgentRouter (agentrouter.org) is, and how OpenRouter, LiteLLM, RouteLLM, Portkey and CodeRouter compare for coding agents: features, pricing, and when each one fits.

We Just Cut Our Own AI Coding Bill 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 from May 2026: per-request cost down 36%, Opus share of spend from 80% to 45%, and spend 91% below an all-Opus estimate (up from 60%). Here's the story.

12 小时砍下自家 AI 编码账单 —— 复盘(2026 真实数据)

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

中转站 vs 任务路由:为什么大部分 AI 编码账单花在了不需要 Opus 的地方(2026)

中文圈 LLM 中转站的本质是 OpenAI / Anthropic API 转售,大多数把所有请求都发给 Opus 或 GPT-5。我们用 5000 次真实路由的生产数据(2026-05-07)告诉你:为什么大部分编码请求不该发给 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 without losing productivity.

Best OpenRouter Alternatives for AI Coding Agents (2026)

OpenRouter is great for model access; picking the same model through 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 (April 2026): spend 78% below an all-Opus estimate and 7 different models touched per Claude Code session. 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 by routing every call through a coding-aware router. 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 automatic per-request routing to cut that bill 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 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 the April 2026 design worked, and what replaced it.

Get weekly AI cost optimization tips

Join developers cutting their agent bills