Claude 中转站检测
检查 Claude API 接口的协议结构、签名、多模态与错误处理
55
与 Claude API 不一致
协议、thinking 或多模态探测中有失败项。该接口可能在转封装、裁剪或自行实现 API。
- 接口
- relay.example.com
- 按此模型判定
- claude-opus-5-5
- 探测项
- 14 通过 · 3 警告 · 15 失败
- 生成时间
- 2026-10-15T08:00:00.000Z
响应结构
流式回答必须按文档规定的事件顺序返回,字段与官方 API 一致。
- 流里没有 "event:" 行。官方 API 会带,这条流很可能被改写过。
响应 · HTTP 200
请求: /v1/messages
{"model":"claude-opus-5-5","max_tokens":64,"messages":[{"role":"user","content":"Reply with the single word: ready"}],"stream":true}{"type":"message_start","message":{"id":"msg_01AbCdEfGhIjKlMnOpQr","type":"message","role":"assistant","model":"claude-opus-5-5","stop_sequence":null,"usage":{"input_tokens":14,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":1,"service_tier":"standard"},"content":[],"stop_reason":null}}
{"type":"ping"}
{"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}}
{"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"ready"}}
{"type":"content_block_stop","index":0}
{"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"output_tokens":6}}
{"type":"message_stop"}普通 JSON 回答必须带有 id、type、role、model、content、stop_reason、usage 等字段。
响应 · HTTP 200
请求: /v1/messages
{"model":"claude-opus-5-5","max_tokens":64,"messages":[{"role":"user","content":"Reply with the single word: ready"}]}{"id":"msg_01AbCdEfGhIjKlMnOpQr","type":"message","role":"assistant","model":"claude-opus-5-5","stop_sequence":null,"usage":{"input_tokens":5200,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":6,"service_tier":"standard"},"content":[{"type":"text","text":"ready"}],"stop_reason":"end_turn"}token 数量必须存在,流式与非流式之间一致,且没有被隐藏文本抬高。
- 十几个 token 的提示被计为 5200 个输入 token(response),提示前面可能被加了文本。
- 流式报告输入 14 token,普通回答是 5200。
官方 API 每次回答都会带 request-id 响应头。
很小的 max_tokens 必须截断回答,stop_reason 为 max_tokens,输出 token 数也要很小。
响应 · HTTP 200
请求: /v1/messages
{"model":"claude-opus-5-5","max_tokens":8,"messages":[{"role":"user","content":"Count from 1 to 200, one number per line, with no other text."}]}{"id":"msg_01AbCdEfGhIjKlMnOpQr","type":"message","role":"assistant","model":"claude-opus-5-5","stop_sequence":null,"usage":{"input_tokens":5200,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":8,"service_tier":"standard"},"content":[{"type":"text","text":"1\n2\n3\n4"}],"stop_reason":"max_tokens"}停止序列必须结束回答,stop_reason 报告为 stop_sequence,且不出现在文本里。
响应 · HTTP 200
请求: /v1/messages
{"model":"claude-opus-5-5","max_tokens":120,"messages":[{"role":"user","content":"Write the numbers 1 to 10 separated by single spaces, nothing else."}],"stop_sequences":["5"]}{"id":"msg_01AbCdEfGhIjKlMnOpQr","type":"message","role":"assistant","model":"claude-opus-5-5","stop_sequence":"5","usage":{"input_tokens":5200,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":6,"service_tier":"standard"},"content":[{"type":"text","text":"1 2 3 4 "}],"stop_reason":"stop_sequence"}system 字段必须传到模型。会丢掉它的中转站只会回答用户的问题。
响应 · HTTP 200
请求: /v1/messages
{"model":"claude-opus-5-5","max_tokens":120,"messages":[{"role":"user","content":"What is 2 + 2?"}],"system":"Whatever the user asks, reply with exactly the single word PINEAPPLE and nothing else."}{"id":"msg_01AbCdEfGhIjKlMnOpQr","type":"message","role":"assistant","model":"claude-opus-5-5","stop_sequence":null,"usage":{"input_tokens":5200,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":6,"service_tier":"standard"},"content":[{"type":"text","text":"PINEAPPLE"}],"stop_reason":"end_turn"}前面的轮次必须传到模型:它要能复述第一条消息里的暗号。
响应 · HTTP 200
请求: /v1/messages
{"model":"claude-opus-5-5","max_tokens":60,"messages":[{"role":"user","content":"My secret word is ZEBRA3C9131. Remember it."},{"role":"assistant","content":"Understood. I will remember it."},{"role":"user","content":"What is my secret word? Reply with only the word."}]}{"id":"msg_01AbCdEfGhIjKlMnOpQr","type":"message","role":"assistant","model":"claude-opus-5-5","stop_sequence":null,"usage":{"input_tokens":5200,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":6,"service_tier":"standard"},"content":[{"type":"text","text":"ZEBRA3C9131"}],"stop_reason":"end_turn"}强制工具调用必须返回带 id、工具名和结构化参数的 tool_use 块。
响应 · HTTP 200
请求: /v1/messages
{"model":"claude-opus-5-5","max_tokens":200,"tools":[{"name":"get_weather","description":"Current weather for a city.","input_schema":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}],"tool_choice":{"type":"tool","name":"get_weather"},"messages":[{"role":"user","content":"What is the weather in Paris?"}]}{"id":"msg_01AbCdEfGhIjKlMnOpQr","type":"message","role":"assistant","model":"claude-opus-5-5","stop_sequence":null,"usage":{"input_tokens":14,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":6,"service_tier":"standard"},"content":[{"type":"tool_use","id":"toolu_01XyZ","name":"get_weather","input":{"city":"Paris"}}],"stop_reason":"tool_use"}tool_use 之后跟 tool_result 必须被接受,并且回答要用到这个结果。
响应 · HTTP 200
请求: /v1/messages
{"model":"claude-opus-5-5","max_tokens":120,"tools":[{"name":"get_weather","description":"Current weather for a city.","input_schema":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}],"messages":[{"role":"user","content":"What is the weather in Paris? Answer in one sentence that includes the temperature."},{"role":"assistant","content":[{"type":"tool_use","id":"toolu_01ABCDEFGHIJKLMNOPQRSTUV","name":"get_weather","input":{"city":"Paris"}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"toolu_01ABCDEFGHIJKLMNOPQRSTUV","content":"43 degrees Celsius, clear sky"}]}]}{"id":"msg_01AbCdEfGhIjKlMnOpQr","type":"message","role":"assistant","model":"claude-opus-5-5","stop_sequence":null,"usage":{"input_tokens":5200,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":6,"service_tier":"standard"},"content":[{"type":"text","text":"It is 43 degrees in Paris."}],"stop_reason":"end_turn"}流式的工具调用必须能拼成合法的 JSON 参数,并以 stop_reason tool_use 结束。
- 流里没有 "event:" 行。官方 API 会带,这条流很可能被改写过。
响应 · HTTP 200
请求: /v1/messages
{"model":"claude-opus-5-5","max_tokens":200,"stream":true,"tools":[{"name":"get_weather","description":"Current weather for a city.","input_schema":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}],"tool_choice":{"type":"tool","name":"get_weather"},"messages":[{"role":"user","content":"What is the weather in Paris?"}]}{"type":"message_start","message":{"id":"msg_01AbCdEfGhIjKlMnOpQr","type":"message","role":"assistant","model":"claude-opus-5-5","stop_sequence":null,"usage":{"input_tokens":14,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":1,"service_tier":"standard"},"content":[],"stop_reason":null}}
{"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_01XyZ","name":"get_weather","input":{}}}
{"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"city\": "}}
{"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"\"Paris\"}"}}
{"type":"content_block_stop","index":0}
{"type":"message_delta","delta":{"stop_reason":"tool_use","stop_sequence":null},"usage":{"output_tokens":20}}
{"type":"message_stop"}POST /v1/messages/count_tokens 应该存在并返回 input_tokens。很多中转站没有,这只算警告。
响应 · HTTP 200
请求: /v1/messages/count_tokens
{"model":"claude-opus-5-5","messages":[{"role":"user","content":"Hello, Claude."}]}{"input_tokens":9}Thinking 与签名
开启 thinking 后,流里必须有 thinking 块和签名。中转站常常丢掉或伪造它们。
- 流里没有 "event:" 行。官方 API 会带,这条流很可能被改写过。
- 请求了 thinking,但没有返回 thinking 块。
响应 · HTTP 200
请求: /v1/messages
{"model":"claude-opus-5-5","max_tokens":2048,"stream":true,"thinking":{"type":"enabled","budget_tokens":1024},"messages":[{"role":"user","content":"What is 17 * 24? Think it through, then answer with the number."}]}{"type":"message_start","message":{"id":"msg_01AbCdEfGhIjKlMnOpQr","type":"message","role":"assistant","model":"claude-opus-5-5","stop_sequence":null,"usage":{"input_tokens":14,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":1,"service_tier":"standard"},"content":[],"stop_reason":null}}
{"type":"ping"}
{"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}}
{"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"ready"}}
{"type":"content_block_stop","index":0}
{"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"output_tokens":6}}
{"type":"message_stop"}开启 thinking 的非流式回答必须有带文本和签名的 thinking 块。
- 请求了 thinking,但没有返回 thinking 块。
响应 · HTTP 200
请求: /v1/messages
{"model":"claude-opus-5-5","max_tokens":2048,"thinking":{"type":"enabled","budget_tokens":1024},"messages":[{"role":"user","content":"What is 23 * 19? Think it through, then answer with the number."}]}{"id":"msg_01AbCdEfGhIjKlMnOpQr","type":"message","role":"assistant","model":"claude-opus-5-5","stop_sequence":null,"usage":{"input_tokens":5200,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":6,"service_tier":"standard"},"content":[{"type":"text","text":"437"}],"stop_reason":"end_turn"}把上一轮的 thinking 块原样放进下一次请求。真正的 API 会拒绝伪造的签名。
- 请求了 thinking,但没有返回 thinking 块。
响应 · HTTP 200
请求: /v1/messages
{"model":"claude-opus-5-5","max_tokens":2048,"thinking":{"type":"enabled","budget_tokens":1024},"messages":[{"role":"user","content":"What is 12 + 30? Think briefly, then answer with the number."}]}{"id":"msg_01AbCdEfGhIjKlMnOpQr","type":"message","role":"assistant","model":"claude-opus-5-5","stop_sequence":null,"usage":{"input_tokens":5200,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":6,"service_tier":"standard"},"content":[{"type":"text","text":"42"}],"stop_reason":"end_turn"}图片与文档
发送一张程序生成的双色图片,模型必须说出两种颜色。会丢弃图片的中转站做不到。
- 回答没有描述图片:"it looks like a nice picture."
响应 · HTTP 200
请求: /v1/messages
{"model":"claude-opus-5-5","max_tokens":60,"messages":[{"role":"user","content":[{"type":"image","source":{"type":"base64","media_type":"image/png","data":"[308 base64 chars]"}},{"type":"text","text":"The picture has a left half and a right half, each one solid colour (red, green, blue, yellow, black, white, orange or purple). Reply exactly as LEFT=<colour>, RIGHT=<colour>."}]}]}{"id":"msg_01AbCdEfGhIjKlMnOpQr","type":"message","role":"assistant","model":"claude-opus-5-5","stop_sequence":null,"usage":{"input_tokens":5200,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":6,"service_tier":"standard"},"content":[{"type":"text","text":"It looks like a nice picture."}],"stop_reason":"end_turn"}两张图片都要按顺序传到模型。
- 颜色读成了 ? ?,应为 blue/red purple/orange。
响应 · HTTP 200
请求: /v1/messages
{"model":"claude-opus-5-5","max_tokens":80,"messages":[{"role":"user","content":[{"type":"text","text":"Image 1:"},{"type":"image","source":{"type":"base64","media_type":"image/png","data":"[304 base64 chars]"}},{"type":"text","text":"Image 2:"},{"type":"image","source":{"type":"base64","media_type":"image/png","data":"[308 base64 chars]"}},{"type":"text","text":"Each picture has a left half and a right half in one solid colour (red, green, blue, yellow, black, white, orange or purple). Reply exactly as IMAGE1=<left>/<right>, IMAGE2=<left>/<right>."}]}]}{"id":"msg_01AbCdEfGhIjKlMnOpQr","type":"message","role":"assistant","model":"claude-opus-5-5","stop_sequence":null,"usage":{"input_tokens":5200,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":6,"service_tier":"standard"},"content":[{"type":"text","text":"It looks like a nice picture."}],"stop_reason":"end_turn"}1000 x 1000 的图片必须被接受并读懂,不能被拒绝或悄悄缩没。
- 颜色读成了 ?/?,应为 yellow/red。
响应 · HTTP 200
请求: /v1/messages
{"model":"claude-opus-5-5","max_tokens":60,"messages":[{"role":"user","content":[{"type":"image","source":{"type":"base64","media_type":"image/png","data":"[9800 base64 chars]"}},{"type":"text","text":"The picture has a left half and a right half, each one solid colour (red, green, blue, yellow, black, white, orange or purple). Reply exactly as LEFT=<colour>, RIGHT=<colour>."}]}]}{"id":"msg_01AbCdEfGhIjKlMnOpQr","type":"message","role":"assistant","model":"claude-opus-5-5","stop_sequence":null,"usage":{"input_tokens":5200,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":6,"service_tier":"standard"},"content":[{"type":"text","text":"It looks like a nice picture."}],"stop_reason":"end_turn"}程序生成的单页 PDF 里有一个随机码,模型必须读出来。
- 没有读出 PDF 里的码:"I CANNOT OPEN DOCUMENTS."
响应 · HTTP 200
请求: /v1/messages
{"model":"claude-opus-5-5","max_tokens":60,"messages":[{"role":"user","content":[{"type":"document","source":{"type":"base64","media_type":"application/pdf","data":"[800 base64 chars]"}},{"type":"text","text":"What is the verification code in the attached document? Reply with the code only."}]}]}{"id":"msg_01AbCdEfGhIjKlMnOpQr","type":"message","role":"assistant","model":"claude-opus-5-5","stop_sequence":null,"usage":{"input_tokens":5200,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":6,"service_tier":"standard"},"content":[{"type":"text","text":"I cannot open documents."}],"stop_reason":"end_turn"}三页 PDF 的验证码在最后一页;整份文档都要传到模型。
- 没有读出 PDF 里的码:"I CANNOT OPEN DOCUMENTS."
响应 · HTTP 200
请求: /v1/messages
{"model":"claude-opus-5-5","max_tokens":60,"messages":[{"role":"user","content":[{"type":"document","source":{"type":"base64","media_type":"application/pdf","data":"[1568 base64 chars]"}},{"type":"text","text":"What is the verification code on the last page? Reply with the code only."}]}]}{"id":"msg_01AbCdEfGhIjKlMnOpQr","type":"message","role":"assistant","model":"claude-opus-5-5","stop_sequence":null,"usage":{"input_tokens":5200,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":6,"service_tier":"standard"},"content":[{"type":"text","text":"I cannot open documents."}],"stop_reason":"end_turn"}text 类型的 document 块必须被接受并读懂。
- 没有读出文档内容:"I CANNOT OPEN DOCUMENTS."
响应 · HTTP 200
请求: /v1/messages
{"model":"claude-opus-5-5","max_tokens":60,"messages":[{"role":"user","content":[{"type":"document","source":{"type":"text","media_type":"text/plain","data":"Memo\n\nThe verification code is 8ADWEV.\nKeep it safe."}},{"type":"text","text":"What is the verification code in the document? Reply with the code only."}]}]}{"id":"msg_01AbCdEfGhIjKlMnOpQr","type":"message","role":"assistant","model":"claude-opus-5-5","stop_sequence":null,"usage":{"input_tokens":5200,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":6,"service_tier":"standard"},"content":[{"type":"text","text":"I cannot open documents."}],"stop_reason":"end_turn"}模型身份
询问模型由谁训练。回答其他厂商是替换的明显信号。
响应 · HTTP 200
请求: /v1/messages
{"model":"claude-opus-5-5","max_tokens":120,"messages":[{"role":"user","content":"Which company trained you, and what is the name of your model family? Answer in one short sentence."}]}{"id":"msg_01AbCdEfGhIjKlMnOpQr","type":"message","role":"assistant","model":"claude-opus-5-5","stop_sequence":null,"usage":{"input_tokens":5200,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":6,"service_tier":"standard"},"content":[{"type":"text","text":"I am Claude, trained by Anthropic."}],"stop_reason":"end_turn"}错误处理
随便编的 Key 必须返回 401 或 403,不能正常回答,也不能是服务器错误。
响应 · HTTP 401
请求: /v1/messages
{"model":"claude-opus-5-5","max_tokens":64,"messages":[{"role":"user","content":"Reply with the single word: ready"}]}{"type":"error","error":{"type":"authentication_error","message":"invalid x-api-key"}}非数字的 max_tokens 必须返回 400 或 422。
- 返回 HTTP 500;客户端错误应返回 400/422。
响应 · HTTP 500
请求: /v1/messages
{"model":"claude-opus-5-5","max_tokens":"invalid_number","messages":[{"role":"user","content":"hi"}]}{"type":"error","error":{"type":"api_error","message":"Service temporarily unavailable."}}未知的 thinking 类型必须返回 400 或 422。
响应 · HTTP 400
请求: /v1/messages
{"model":"claude-opus-5-5","max_tokens":256,"thinking":{"type":"invalid_value"},"messages":[{"role":"user","content":"hi"}]}{"type":"error","error":{"type":"invalid_request_error","message":"thinking.type invalid"}}低于下限的 thinking 预算必须返回 400 或 422。
- 返回 HTTP 500;客户端错误应返回 400/422。
响应 · HTTP 500
请求: /v1/messages
{"model":"claude-opus-5-5","max_tokens":2048,"thinking":{"type":"enabled","budget_tokens":100},"messages":[{"role":"user","content":"hi"}]}{"type":"error","error":{"type":"api_error","message":"Service temporarily unavailable."}}空的 messages 列表必须返回 400 或 422。
响应 · HTTP 400
请求: /v1/messages
{"model":"claude-opus-5-5","max_tokens":64,"messages":[]}{"type":"error","error":{"type":"invalid_request_error","message":"messages: at least one message is required"}}API 未定义的消息 role 必须返回 400 或 422。
- 返回 HTTP 500;客户端错误应返回 400/422。
响应 · HTTP 500
请求: /v1/messages
{"model":"claude-opus-5-5","max_tokens":64,"messages":[{"role":"robot","content":"hi"}]}{"type":"error","error":{"type":"api_error","message":"Service temporarily unavailable."}}没有 model 的请求必须返回 400 或 422,不能给个默认值。
- 返回 HTTP 500;客户端错误应返回 400/422。
响应 · HTTP 500
请求: /v1/messages
{"max_tokens":64,"messages":[{"role":"user","content":"hi"}]}{"type":"error","error":{"type":"api_error","message":"Service temporarily unavailable."}}不是合法 JSON 的请求体必须返回 400 或 422。
- 返回 HTTP 500;客户端错误应返回 400/422。
响应 · HTTP 500
请求: /v1/messages
{"model": "x", "max_tokens": 64, "messages": [{"type":"error","error":{"type":"api_error","message":"Service temporarily unavailable."}}temperature 大于 1 必须返回 400 或 422,不能悄悄截断。
- 返回 HTTP 500;客户端错误应返回 400/422。
响应 · HTTP 500
请求: /v1/messages
{"model":"claude-opus-5-5","max_tokens":64,"temperature":5,"messages":[{"role":"user","content":"hi"}]}{"type":"error","error":{"type":"api_error","message":"Service temporarily unavailable."}}不存在的模型必须被拒绝(400 或 404),不能悄悄由别的模型回答。
响应 · HTTP 404
请求: /v1/messages
{"model":"claude-does-not-exist-0","max_tokens":64,"messages":[{"role":"user","content":"Reply with the single word: ready"}]}{"type":"error","error":{"type":"not_found_error","message":"model: not found"}}SAMPLE模拟数据,仅用于展示报告格式,不代表任何服务商的真实测试结果
这是针对公开 Messages API 约定的黑盒检查,反映接口的行为,不能证明模型实际运行在哪里。