[FEATURE] Support third-party inference providers in Claude Code (parity with Cowork 3P)
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
Claude Desktop's Cowork 3P supports a Gateway connection mode for third-party inference:
Developer → Configure third-party inference → Connection: Gateway
This mode accepts a base URL and an API key, and authenticates with Authorization: Bearer <token> — enabling direct connections to any gateway that implements /v1/messages (GitHub Copilot, Azure AI Foundry, corporate API gateways, etc.).
The underlying configuration:
{
"inferenceProvider": "gateway",
"inferenceGatewayBaseUrl": "https://api.githubcopilot.com",
"inferenceGatewayApiKey": "<bearer_token>",
"inferenceModels": "[\"claude-sonnet-4-6\",\"claude-opus-4-6\"]"
}
Claude Code has no equivalent Gateway mode. It only supports:
- Anthropic direct (x-api-key header)
- AWS Bedrock (SigV4)
- Google Vertex AI (Google OAuth)
Because Claude Code hardcodes x-api-key, connecting to any gateway that expects Authorization: Bearer requires running a local reverse proxy solely to rewrite one HTTP header — unnecessary overhead when the upstream already speaks native Anthropic Messages API.
Proposed Solution
Add the same Gateway connection mode to Claude Code, for example via environment variables:
export ANTHROPIC_AUTH_MODE="bearer"
export ANTHROPIC_BASE_URL="https://api.githubcopilot.com"
export ANTHROPIC_API_KEY="gho_xxxxxxxxxxxx"
Or via ~/.claude/settings.json, mirroring the Cowork 3P config:
{
"inferenceProvider": "gateway",
"inferenceGatewayBaseUrl": "https://api.githubcopilot.com",
"inferenceGatewayApiKey": "gho_xxxxxxxxxxxx"
}
The implementation is minimal — the only behavioral difference from the current ANTHROPIC_BASE_URL flow is sending the key as Authorization: Bearer <key> instead of x-api-key: <key>.
Alternative Solutions
_No response_
Priority
Medium - Would be very helpful
Feature Category
Other
Use Case Example
GitHub Copilot includes access to all Claude models via an endpoint that supports /v1/messages natively. Developers with Copilot subscriptions could use Claude Code directly without any middleware. The same applies to any Anthropic-compatible gateway.
Additional Context
_No response_
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗