GPT in Claude Code via Proxy: Where It Breaks
claude-codegpt-modelsllm-proxy
How It's Actually Connected
Claude Code can be directed to external GPT-class models via an Anthropic-compatible proxy: to the tool itself, it looks like a regular Anthropic endpoint, while the proxy translates requests to OpenAI or another provider. In Anthropic's official Claude Code documentation, this fits into two mechanisms: network proxy variables HTTP_PROXY and HTTPS_PROXY, and the LLM gateway pattern.
The typical setup is simple: you spin up a local or gateway proxy, then Claude Code receives ANTHROPIC_BASE_URL and a token like ANTHROPIC_AUTH_TOKEN or ANTHROPIC_API_KEY. The LiteLLM tutorial describes exactly this flow: launch a proxy via litellm --config, verify Anthropic format compatibility, and then run claude.
On paper, it doesn't look like a hack. Claude Code doesn't need to know if GPT, Gemini, an OpenRouter-style backend, or another router sits behind the proxy. All the magic and all the pain lie in the translation layer: messages, tool calls, streaming, response structure, model routing.
Community scenarios with subagents are particularly interesting. In Reddit discussions, people try to map individual agents to different models—for example, a code-reviewer to gpt-4o and a data-analyst to o3. This is no longer just a model swap but an attempt to rebuild an agentic tool's behavior with external components.
Where Things Start Going Sideways
The main risk isn't that the proxy fails to respond but that it responds almost correctly. That's enough for a regular chat, but Claude Code heavily relies on tool-calling, streaming output, and correct understanding of intermediate results.
If Anthropic-style tools are translated into another provider's format with losses, the agent may start looping. Hence the complaints about subagent spam: the model or proxy repeatedly triggers delegation instead of closing the task. In the supplied Reddit context, this is community-reported behavior, not an officially documented Claude Code bug.
I would first look not at final answer quality but at the trace: which tool calls actually go out, how results come back, whether context gets truncated, whether streaming breaks. Agentic coding usually dies not gracefully but through small desynchronizations.
Practical Takeaway Without Romance
A proxy for GPT in Claude Code makes sense as an engineering experiment or as a way to plug in gateway routing, but its stability is determined by the weakest format translator. LiteLLM, Bifrost, Kong AI Proxy, and GitHub-proxy projects solve a similar problem, but their edge cases will differ.
What wins isn't the backend whose model is smarter in a vacuum, but the one that better mimics Anthropic behavior for Claude Code. If subagents start spamming, it's almost always a signal not of a single bad prompt but of friction between Claude Code's agentic logic and alien model semantics. That spot remains the most nerve‑wracking part of the whole setup.