Every open-weight coding model that matters now ships the same escape hatch. GLM-5.2 answers at https://api.z.ai/api/anthropic. Moonshot's Kimi answers at https://api.moonshot.ai/anthropic. MiniMax answers at https://api.minimax.io/anthropic. Each of those is an Anthropic-compatible endpoint — it speaks the /v1/messages protocol Claude Code was built to talk to. So the pitch writes itself: point Claude Code at one of them and run a near-frontier coder for a sixth of the price.

The pitch is true, and the setup really is trivial. You set three environment variables — ANTHROPIC_BASE_URL to the vendor's endpoint, ANTHROPIC_AUTH_TOKEN to that vendor's key (not ANTHROPIC_API_KEY, which would fall back to Anthropic), and ANTHROPIC_MODEL to the model name — and Claude Code starts editing files with GLM-5.2 behind it. Nothing about the app changes. That is the whole point of a compatible endpoint, and it works.

Here is the part nobody puts in the setup guide: "Anthropic-compatible" is a promise about the shape of the request, not about the behavior Claude Code is tuned to exploit. Claude Code is not a neutral client. It was co-designed with Anthropic's server, and a surprising amount of what makes it feel good is server-side convenience that a compatible endpoint is free to implement differently — or not at all. Swap the base URL and you don't get "Claude Code with a cheaper model." You get Claude Code with several of its load-bearing features quietly switched off.

Tier one: the economics stop working#

Start with the money, because the money is the reason you're here. Claude Code is affordable on long sessions almost entirely because of prompt caching — and how each provider prices that cache is not uniform. A cache read bills at roughly 10% of base input, so a 130k-token context that's 99% cached bills like ~14k tokens. Kill the cache and your bill isn't 10% higher — it can be several times higher.

Caching survives a base-URL swap on paper: cache_control is part of the wire format. Whether it survives in practice is the vendor's call — their TTL, their pricing, their eligibility rules. And even when the endpoint honors it perfectly, the client's breakpoint placement decides your hit rate. A documented qwen-code issue is the cleanest proof: on the same Anthropic-compatible GLM endpoint, qwen-code landed 80–84% cache hits where Claude Code held ~100%, purely because its cache_control breakpoint rode the moving last message instead of a rolling window. Same protocol, same model, a bill that's structurally different.

A compatible endpoint guarantees your request is understood. It guarantees nothing about whether it's cheap.

Tier two: the harness features turn themselves off#

This one is in Claude Code's own environment-variable docs, and it's easy to miss. When ANTHROPIC_BASE_URL points at a non-first-party host:

None of these are the model's fault. They're the harness noticing it's no longer talking to Anthropic and retreating to a conservative mode.

Tier three: the model reads a prompt written for a different model#

Claude Code ships an enormous system prompt and a set of tool schemas authored, tuned, and regression-tested against Claude. Extended and interleaved thinking, strict tool-call formatting, the exact phrasing that keeps Claude from over-editing — another model reads all of that as generic instructions. Sometimes it complies beautifully. Sometimes it double-applies an edit or narrates a tool call it should have just made.

The actual trap is attribution#

Put the three tiers together and the failure mode is not "it breaks." It's subtler and worse: it works, slightly less well. GLM-5.2 — which matched the closed models on agentic coding for a fraction of the cost — posts a Terminal-Bench 2.1 around 81 against Claude Opus 4.8's ~85 — close enough that a degraded harness can easily swamp the real model gap. So you run it, it feels a notch off, your bill is higher than you expected, and you file the conclusion "open models aren't there yet."

You didn't measure the model. You measured the model minus its caching, minus tool search, minus the beta streaming path, running a prompt tuned for someone else. That might still be the right trade — a sixth of the price buys a lot of forgiveness. But make it the trade you actually chose. Before you blame the weights, check whether you ever gave them the harness.