400 Unexpected value(s) `advisor-tool-2026-03-01` for the `anthropic-beta` heade...
错误信息
API Error: 400 Unexpected value(s) `advisor-tool-2026-03-01` for the `anthropic-beta` header. Please consult our documentation at ***.***.com/docs or try
again without the header. (request id: 20260808145041405803529SGr0K3F5) (request id: 202608080650412408446618268d9d64WRRcBA0)
AI 解决方案
1. 🌐 错误翻译
原文:API Error: 400 Unexpected value(s) `advisor-tool-2026-03-01` for the `anthropic-beta` header. Please consult our documentation at ***.***.com/docs or try again without the header. (request id: 20260808145041405803529SGr0K3F5) (request id: 202608080650412408446618268d9d64WRRcBA0)
译文:API 错误:400 `anthropic-beta` 请求头中出现了意外的值 `advisor-tool-2026-03-01`。请查阅我们的文档 ***.***.com/docs,或尝试去掉该请求头后重试。
2. 🎯 原因分析
anthropic-beta请求头的值advisor-tool-2026-03-01不在接口允许的合法取值范围内,不符合服务端对该请求头的校验规则。3. 💡 解决方案
#### 方案一:去掉无效的
anthropic-beta请求头如果该请求头非必需,直接移除即可,代码示例(以Python的requests库为例):
import requests
url = "https://api.example.com/your-endpoint"
headers = {
# 移除"anthropic-beta"请求头,仅保留其他必要的请求头
"Authorization": "Bearer your-token",
"Content-Type": "application/json"
}
payload = {"your": "data"}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
#### 方案二:将请求头值改为服务端允许的合法值
先查阅文档确认anthropic-beta请求头的合法取值(如特定版本标识),再修改为合法值,示例如下:
import requests
url = "https://api.example.com/your-endpoint"
# 将值替换为文档中允许的合法取值,例如"2023-10-31-beta"
headers = {
"anthropic-beta": "2023-10-31-beta",
"Authorization": "Bearer your-token",
"Content-Type": "application/json"
}
payload = {"your": "data"}
response = requests.post(url, headers=headers, json=payload)
print(response.json())