Skip to content

[Bug] Claude Desktop 使用 AWS Bedrock API Key 时错误转发到 bedrock-runtime /v1/messages,导致 HTTP 200 空响应 #3110

Description

@JulianZJN

Self Checks / 自检

  • I have read the docs and checked the Claude Desktop provider setup.
  • I searched existing issues for UnknownOperationException, Claude Desktop AWS Bedrock, and malformed response HTTP 200.
  • I removed all API keys/tokens from this report.

CC Switch Version / 版本号

v3.15.0

Operating System / 操作系统

macOS, Apple Silicon

Related App / 涉及应用

  • Claude Desktop third-party inference
  • Claude Code in VS Code

Provider / 供应商

AWS Bedrock (API Key), region us-east-1

Summary / 问题概述

After switching the AWS Bedrock (API Key) provider through CC Switch, both Claude Desktop and Claude Code in VS Code became unusable.

Claude Desktop shows:

API Error: API returned an empty or malformed response (HTTP 200) — check for a proxy or gateway intercepting the request

The connection test in Claude Desktop / CC Switch can pass, but real chat requests fail.

VS Code Claude Code also fails when routed through this provider. Earlier it returned an invalid Bedrock model identifier when a CC Switch alias such as claude-sonnet-4-6 was forwarded; after changing models, requests still did not work reliably.

Evidence / 日志证据

With CC Switch debug logging enabled, the Claude Desktop request was forwarded to:

https://bedrock-runtime.us-east-1.amazonaws.com/v1/messages?beta=true

Example CC Switch log:

[Claude] >>> 请求 URL: https://bedrock-runtime.us-east-1.amazonaws.com/v1/messages?beta=true (model=global.anthropic.claude-sonnet-4-6)

The upstream AWS response body was:

{"Output":{"__type":"com.amazon.coral.service#UnknownOperationException"},"Version":"1.0"}

CC Switch then recorded it as:

status=200
input=0
output=0

Claude Desktop then surfaces this as an empty/malformed HTTP 200 response.

Manual verification / 手动验证

Using the same Bedrock API key, direct Bedrock Runtime invocation works when using the Runtime invoke endpoint:

POST https://bedrock-runtime.us-east-1.amazonaws.com/model/{modelId}/invoke
Authorization: Bearer <redacted>

The following model IDs returned valid responses in a direct minimal test:

global.anthropic.claude-opus-4-6-v1
global.anthropic.claude-sonnet-4-6
us.anthropic.claude-sonnet-4-5-20250929-v1:0

But bedrock-runtime.us-east-1.amazonaws.com/v1/messages returns UnknownOperationException, which seems expected because Bedrock Runtime is not the normal Anthropic-compatible /v1/messages base URL.

Expected Behavior / 期望行为

For an AWS Bedrock (API Key) provider:

  1. Claude Desktop proxy mode should use the correct Bedrock Runtime invocation path/adapter, or use the correct Anthropic-compatible Bedrock endpoint if that is the intended mode.
  2. AWS upstream errors like UnknownOperationException should be surfaced as errors instead of being treated/logged as a successful HTTP 200 with 0 tokens.
  3. Claude Desktop and VS Code Claude Code should both be able to chat through the configured AWS Bedrock provider when the same API key works via direct Bedrock Runtime invocation.

Actual Behavior / 实际行为

  1. Claude Desktop local gateway is configured as:
http://127.0.0.1:15721/claude-desktop
  1. CC Switch forwards real chat traffic to:
https://bedrock-runtime.us-east-1.amazonaws.com/v1/messages?beta=true
  1. AWS returns:
{"Output":{"__type":"com.amazon.coral.service#UnknownOperationException"},"Version":"1.0"}
  1. CC Switch records status 200, input/output tokens 0, and Claude Desktop reports malformed response.

Possible Root Cause / 可能原因

It looks like the Claude Desktop proxy path treats the AWS Bedrock Runtime endpoint as if it were a normal Anthropic Messages-compatible endpoint and appends /v1/messages.

For Bedrock Runtime, direct invocation needs the Bedrock-style model invocation path, for example:

/model/{modelId}/invoke

or an equivalent Bedrock-specific adapter.

Additional Notes / 补充信息

I also tried disabling the Bedrock request optimizer, thinking optimization, cache injection, and rectifier settings, then restarting Claude Desktop and testing with short prompts. The same failure still occurred.

No API keys or tokens are included in this report.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions