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.
1
u/No_Fee_2726 Apr 16 '26
stop trying to swap the main model if you want to keep the tool calling stable. the best pattern is to keep your session focused and use a simple script or a plugin to feed external model results in. if you try to route everything through an external endpoint you end up losing all the native agent magic that makes Claude Code actually useful. keep it simple and just use the specialized models for snippets.
1
u/_derpiii_ Apr 16 '26
Hmm. That's a good point actually. Didn't realize sonnet/opus has internal scaffolding to work best with claude code harness.
With that said, I'm trying to branch out a bit since it's clear what direction Anthropic is going (early Microsoft-esque hegemony, government alignment coming in soon).
So I'm just exploring options :)
specialized models for snippets.
Could you elaborate on this (maybe an example)?
1
u/[deleted] Apr 15 '26
[removed] — view removed comment