适合什么场景
- 你要透传 Claude 的 thinking、tool_choice 或 beta 能力配置
- 统一接口层不想直接暴露 Anthropic 专有字段
最小请求
{
"model": "claude-sonnet-4-20250514",
"messages": [
{ "role": "user", "content": "总结这份报告。" }
],
"model_extra": {
"thinking": { "type": "enabled", "budget_tokens": 1024 },
"tool_choice": { "type": "auto" }
}
}
cURL 示例
curl https://mass.apigo.ai/v1/chat/completions \
-H "Authorization: Bearer $TIDEMIND_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-20250514",
"messages": [
{ "role": "user", "content": "总结这份报告。" }
],
"model_extra": {
"thinking": { "type": "enabled", "budget_tokens": 1024 },
"tool_choice": { "type": "auto" }
}
}'
Python 示例
import requests
response = requests.post(
"https://mass.apigo.ai/v1/chat/completions",
headers={
"Authorization": "Bearer <TIDEMIND_API_KEY>",
"Content-Type": "application/json",
},
json={
"model": "claude-sonnet-4-20250514",
"messages": [
{"role": "user", "content": "总结这份报告。"}
],
"model_extra": {
"thinking": {"type": "enabled", "budget_tokens": 1024},
"tool_choice": {"type": "auto"},
},
},
timeout=60,
)
response.raise_for_status()
print(response.json()["choices"][0]["message"]["content"])
Node.js 示例
const response = await fetch("https://mass.apigo.ai/v1/chat/completions", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.TIDEMIND_API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "claude-sonnet-4-20250514",
messages: [
{ role: "user", content: "总结这份报告。" }
],
model_extra: {
thinking: { type: "enabled", budget_tokens: 1024 },
tool_choice: { type: "auto" }
}
})
});
const data = await response.json();
console.log(data.choices[0].message.content);
最佳实践
- beta 或 thinking 相关字段优先只在服务端开放
- 对不同模型支持差异做静态校验,不要盲透传
