Problem
Currently, ANTHROPIC_BASE_URL and model provider configuration is session-wide. There's no way to route individual subagents to different providers within the same session.
The model parameter in agent definitions only accepts sonnet, opus, haiku — all pointing to the same provider endpoint.
Use case
As a power user running Claude Code with Opus as orchestrator, I'd like to delegate mechanical/repetitive subagent tasks (bulk edits, i18n key extraction, file moves, simple searches) to a local model via Ollama while keeping the orchestrator and complex reasoning agents on Anthropic's API.
This would:
- Reduce API costs for high-volume agent workflows (GSD, parallel agents, etc.)
- Reduce latency for simple tasks (local inference is instant for small models)
- Enable offline capability for a subset of agent work
- Give users control over the cost/quality tradeoff per agent
Proposed solution
Allow a provider or base_url field in agent definitions (both .md frontmatter and --agents JSON), plus a corresponding entry in modelOverrides or a new providerOverrides setting:
# ~/.claude/agents/my-bulk-editor.md
---
name: bulk-editor
model: llama3.3:70b
provider: ollama
base_url: http://localhost:11434/v1
---
Or in settings:
{
"providerOverrides": {
"ollama": {
"baseUrl": "http://localhost:11434/v1",
"format": "openai"
}
}
}
Then in agent definitions: provider: ollama routes to that endpoint.
Current workaround
Run separate terminal sessions with different ANTHROPIC_BASE_URL values. This loses the orchestrator→subagent delegation model entirely.
Environment
- Claude Code v2.1.83
- macOS Apple Silicon
- Heavy user of parallel subagents (GSD, team agents, custom agents)
Problem
Currently,
ANTHROPIC_BASE_URLand model provider configuration is session-wide. There's no way to route individual subagents to different providers within the same session.The
modelparameter in agent definitions only acceptssonnet,opus,haiku— all pointing to the same provider endpoint.Use case
As a power user running Claude Code with Opus as orchestrator, I'd like to delegate mechanical/repetitive subagent tasks (bulk edits, i18n key extraction, file moves, simple searches) to a local model via Ollama while keeping the orchestrator and complex reasoning agents on Anthropic's API.
This would:
Proposed solution
Allow a
providerorbase_urlfield in agent definitions (both.mdfrontmatter and--agentsJSON), plus a corresponding entry inmodelOverridesor a newproviderOverridessetting:Or in settings:
{ "providerOverrides": { "ollama": { "baseUrl": "http://localhost:11434/v1", "format": "openai" } } }Then in agent definitions:
provider: ollamaroutes to that endpoint.Current workaround
Run separate terminal sessions with different
ANTHROPIC_BASE_URLvalues. This loses the orchestrator→subagent delegation model entirely.Environment