[FEATURE] route specific sub-agents to a different API endpoint/key
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
Problem: Claude Code sub-agents (spawned via the Agent tool) always inherit the parent session's
API credentials and base URL. There is no way to specify a different API key, ANTHROPIC_BASE_URL, or custom headers on a per-agent basis.
Use case: In enterprise/corporate environments, users may have multiple LLM gateway accounts with different model access (e.g., one gateway ID with Sonnet access, another with Opus access). The current design makes it impossible to run a Sonnet parent session while delegating specific sub-tasks to an Opus agent on a different gateway — even though the user has legitimate access to both.
Proposed Solution
Requested behavior: Allow the Agent tool invocation (or a session/profile configuration) to optionally override ANTHROPIC_API_KEY, ANTHROPIC_BASE_URL, and/or ANTHROPIC_CUSTOM_HEADERS for a specific spawned sub-agent.
Alternative Solutions
_No response_
Priority
Medium - Would be very helpful
Feature Category
API and model interactions
Use Case Example
_No response_
Additional Context
_No response_