Skip to content

Feature: Per-agent model provider routing (e.g. local Ollama for subagents, Anthropic for orchestrator) #38698

@berthelius

Description

@berthelius

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions