[BUG] [Claude Desktop] Cowork VM agent sessions don't receive credentials (gateway mode or Bedrock direct mode)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When configuring Cowork with either a third-party LLM gateway (inferenceGateway) or Bedrock direct credentials, the host process successfully authenticates (e.g., title generation via Haiku works), but the VM-based agent sessions fail with 403 errors because credentials are not passed to the Claude Code SDK running inside the VM.
What Should Happen?
When Cowork is configured with third-party gateway credentials (via claude_desktop_config.json inferenceGateway) or Bedrock direct credentials (via UI settings), both the host process and the VM-based agent sessions should authenticate successfully. Specifically, the Claude Code SDK running inside the VM should receive the same credentials/configuration as the host process and include a valid Authorization header in API requests.
Error Messages/Logs
Gateway mode - VM SDK sends Bedrock invoke format with no auth:
[API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
[API REQUEST] /model/claude-sonnet-4-6/invoke-with-response-stream source=sdk
API error: 403 The security token included in the request is invalid.
Bedrock direct mode - VM SDK sends request with no auth, key format rejected:
[API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
[API REQUEST] /model/us.anthropic.claude-sonnet-4-5-20250929-v1:0/invoke-with-response-stream source=sdk
API error (attempt 1/11): 403 {"Message":"Invalid API Key format: Base64 decoding failed"}
Note: Host process works fine - title generation via Haiku succeeds in both modes.
The key indicator is "has Authorization header: false" on every VM request.
Steps to Reproduce
Gateway mode:
- Configure claude_desktop_config.json with:
{
"inferenceGateway": {
"baseUrl": "https://my-litellm-gateway.example.com",
"inferenceGatewayAuthScheme": "bearer"
}
}
- Set ANTHROPIC_AUTH_TOKEN with a valid gateway API key
- Open Cowork and start a conversation
Bedrock direct mode:
- Remove claude_desktop_config.json
- Configure Bedrock settings in UI:
- AWS region: us-east-1
- AWS bearer token: <ABSK Bedrock API key>
- Start a conversation
Expected Behavior
Both the host process (title generation) and the VM agent session (main conversation) should authenticate successfully using the configured credentials.
Actual Behavior
- Host process: Works. Title generation (Haiku) completes successfully.
- VM agent session: Fails with 403. The SDK inside the VM makes requests with no Authorization header.
Debug Evidence
Gateway mode — VM-side SDK uses Bedrock invoke format instead of Anthropic Messages format, with no auth header:
[API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
[API REQUEST] /model/claude-sonnet-4-6/invoke-with-response-stream source=sdk
Bedrock direct mode — Same missing auth, different error:
[API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: false, has Authorization header: false
[API REQUEST] /model/us.anthropic.claude-sonnet-4-5-20250929-v1:0/invoke-with-response-stream source=sdk
API error: 403 {"Message":"Invalid API Key format: Base64 decoding failed"}
In both modes, has Authorization header: false confirms credentials from the host are not reaching the VM session.
Root Cause Analysis
Cowork's architecture runs agent sessions in an isolated VM. The host process has access to the configured credentials and uses them successfully for lightweight calls (title
generation). However, the VM-side Claude Code SDK instance does not receive these credentials — neither as environment variables nor as configuration. The SDK defaults to Bedrock
invoke format (/model/.../invoke-with-response-stream) with no auth, which fails.
Environment
- Windows corporate environment
- Backend: Amazon Bedrock (us-east-1) via LiteLLM proxy gateway
- Gateway: LiteLLM v1.x with Anthropic Messages API → Bedrock translation
- Bedrock API keys (ABSK format) available
- IAM credentials with bedrock:InvokeModel and bedrock:InvokeModelWithResponseStream permissions confirmed working via Claude Code VS Code extension
Claude Model
Not sure / Multiple models
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
NA
Platform
Other
Operating System
Windows
Terminal/Shell
Other
Additional Information
_No response_
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗