claudefree: The Ghost API That Lets Claude Code Think It Still Talks to Anthropic
A fast Python gateway that fakes the Anthropic surface, discovers providers dynamically, and reroutes Claude Code to a moving target of alternative models.
- claudefree is less an AI app than a compatibility mask that preserves the Claude Code workflow while swapping the model supplier underneath.
- Its real power comes from translation layers, not model quality, because the gateway, adapters, and stream rewriting keep Anthropic-shaped traffic moving.
- Provider discovery is outsourced to a live registry, which keeps the proxy lightweight and far less brittle than a hardcoded provider list.
- The project matters because it shows how interface compatibility can become a strategy for escaping vendor lock-in in AI tooling.
The trick is not that Claude Code changes. It does not. `claudefree` makes the CLI believe it is still speaking to Anthropic, then intercepts the conversation and points it at a different model supply. That is why the project feels less like a chatbot and more like a stage illusion with good engineering underneath.
That illusion is the whole thesis. The repo preserves the premium feel of Claude Code, but strips away the dependency on a single vendor. For developers who care about the workflow more than the billing model, that is a compelling trade.
Why this matters: a premium CLI becomes a portable shell
Most tools in this space ask you to adopt a new interface. `claudefree` does the opposite. It keeps the interface people already know and shifts the burden onto a compatibility layer that speaks just enough Anthropic to satisfy the client.
Claude Code is just a client that talks to the Anthropic API format. You can redirect it to any LLM that speaks that format.
| Tool path | Interface preserved | Provider flexibility | Setup style | Proxy required |
|---|---|---|---|---|
| claudefree | Yes, Claude Code stays in place | High, through dynamic adapters | Lightweight gateway plus config | Yes |
| Aider or Cline | No, you adopt a different tool | High, but inside that tool | Direct app setup | No |
| Cursor or OpenCode | Partially, but within a new product surface | Medium to high | Opinionated environment | No |
| Direct Claude Code with Anthropic | Yes | Low, tied to Anthropic | Simplest if you already pay | No |
Inside the gateway: four steps from request to streamed reply
The brain of the repo is `GatewayService`. Its job is simple to describe and tricky to execute: catch Claude-shaped requests, decide where they should go, translate them for the chosen provider, then stream the response back in Anthropic format.
The flow is practical rather than elegant. First comes interception, including shortcuts for trivial replies. Then model selection maps the Claude model name to a backend and upstream model. After that, local token estimation gives the gateway enough accounting to keep the stream coherent. Finally, the backend adapter emits SSE chunks that are rewritten into the shape Claude Code expects.
The real scaling trick: provider discovery is outsourced
One reason proxy projects go stale is obvious. Hardcode enough providers and the list becomes a maintenance burden the moment the ecosystem shifts. `claudefree` avoids that trap by pulling from a dynamic registry at `models.dev` and caching the result locally with a TTL.
That design is small but important. The repo does not need to own the universe of providers. It borrows a live catalog, stores a local copy for speed, and stays focused on the translation problem instead of becoming a directory of every model vendor on earth.
Adapters do the translation work
The most interesting part after the gateway is the adapter factory. Instead of hand-curating a giant routing matrix, `claudefree` inspects provider metadata and chooses a speaking style. Anthropic-native providers get one adapter. OpenAI-compatible providers get another. The point is not classification for its own sake. It is choosing the minimum protocol bridge that keeps the stream alive.
That flexibility is the payoff. As new providers appear in the registry, the proxy can often support them with little or no bespoke code. The repo is not trying to outsmart the model ecosystem. It is trying to stay out of its way.
The messy part: streaming, usage, and token accounting
The hard part of a proxy is not returning a response. It is returning the right shape of response while the upstream is still talking. `claudefree` deals with that by translating live SSE chunks and using heuristics when providers expose usage data inconsistently.
That is the kind of compromise that separates a demo from a useful tool. Different vendors report output tokens differently, and some reveal them only after the fact. The repo answers with local estimation, chunk parsing, and enough bookkeeping to keep Claude Code satisfied without pretending the protocol mismatch does not exist.
A lightweight proxy that routes Claude Code's Anthropic API calls to NVIDIA NIM (40 req/min free), OpenRouter (hundreds of models), or LM Studio (fully local).
How it compares to other ways of escaping vendor lock-in
| Project | What it optimizes for | What you give up |
|---|---|---|
| claudefree | Claude Code continuity with backend flexibility | A direct, native Anthropic connection |
| Aider | Terminal-native pair programming across providers | The Claude Code interface itself |
| Cline | Agentic coding inside VS Code | A separate proxy layer and CLI fidelity |
| Cursor | Integrated product polish | Less control over protocol-level swapping |
| OpenCode | Open source coding agent breadth | The drop-in Claude Code illusion |
That comparison is the real story. `claudefree` is not trying to be the best coding agent. It is trying to be the least disruptive way to keep using one.
What this repo is really testing
Small infrastructure projects often reveal bigger shifts before the flagship products do. `claudefree` suggests that in AI tooling, the valuable thing may not be the model endpoint. It may be the interface people have already learned, trusted, and built habits around.
That is a strong idea, even if the implementation is scrappy. Compatibility layers are usually invisible when they work. Here, the entire project is built to make that invisibility feel like a feature.





