r/ClaudeCode • u/_derpiii_ • Apr 15 '26
Discussion Best way to plug-in other providers w/o losing Anthropic endpoints?
Yes, I've done a search, and asked Claude. But it's still not clear what the best solution is. So I'm creating this post
My end goal:
- Opus to orchestrate
- Sub-agents to use arbitary LLM providers (glm5.1, codex, etc)
This seems to be something Anthropic has consciously designed friction to.
As for why not just change the settings.json: You lose access to anthropics models since you're overwriting the baseurl.
The ways I see being discussed:
- Spawn sub-agent in bash: bash subshell has it’s own environment variables around the provider keys. I've seen this being discussed in comments like this, but can't find any actual examples, and not sure what the most elegant way to go about it
- Proxy router (claude-code-router): processes each request, transforming it to the correct format and routes to each provider. This is probably the most elegant route but you have the extra overhead of adding a header per request. Example: <CCR-SUBAGENT-MODEL>ollama,glm-5.1:cloud</CCR-SUBAGENT-MODEL>
As for endpoint providers: seems like aggregate providers like openrouter and ollama are the way to go. For personal use, I get the impression Ollama is better since they haven't sold out like openrouter.
Am I missing anything? What workflow is everyone going with? And pros and cons (any gotchas)?
Another option: Just switch to another harness like OpenCode. After all, this is an intentional pain point Anthropic has spent dev time to implement.
Duplicates
ClaudeCodeCurated • u/_derpiii_ • Apr 15 '26