This commit is contained in:
dsa343
2026-03-18 17:02:42 +08:00
parent 38643bc35a
commit f11dc58530

View File

@@ -0,0 +1,146 @@
#价值前沿
【公司提供的Claude Code API】
Claude Code API:
sk-ant-oat01-357ef209755a2161be80cd052ebe3985ce3b8aba15d78d84e9b07910a0966b69已废弃
sk-ant-oat01-d255ca887a1d5b8fd4fa7f37d59cc34cf81c017602acaf27321e6f361a7709bc
GACCODE 完整请求体 1. HTTP请求格式
POST https://154.26.181.99/claudecode/v1/messages
2. 请求头Headers
{
"anthropic-version": "2023-06-01",
"content-type": "application/json",
"x-api-key": "sk-ant-oat01-xxxxxxxx...",
"Host": "gaccode.com"
}
说明因为是IP直连源站绕过Cloudflare需要手动设置 Host: gaccode.com
让后端nginx/openresty正确路由。SSL验证需要关闭verify_ssl: False
3. 请求体Payload
{
"model": "claude-opus-4-5-20250514",
"max_tokens": 32000,
"temperature": 0.7,
"messages": [
{
"role": "user",
"content": "你的提示词内容..."
}
],
"stream": true
}
可选字段:
{
"system": "系统提示词(可选)",
"thinking": {
"type": "enabled",
"budget_tokens": 10000
}
}
注意thinking 参数是否被gaccode代理支持尚未验证。根据之前的测试gaccode代理以文本方式返回thinking内容包裹在<thinking>标签
说明代理可能不完整支持thinking协议。
4. curl 完整示例
curl -k -X POST "https://154.26.181.99/claudecode/v1/messages" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-H "x-api-key: sk-ant-oat01-8625cbcbf200d225488cbfcf952f44bf66fac7089f01dd6c336e1b6699939306" \
-H "Host: gaccode.com" \
-d '{
"model": "claude-opus-4-5-20250514",
"max_tokens": 32000,
"temperature": 0.7,
"messages": [{"role": "user", "content": "Hello"}],
"stream": true
}'
响应格式
{
"id": "msg_xxx",
"model": "claude-opus-4-6",
"content": [
{"type": "thinking", "thinking": "内部推理过程..."},
{"type": "text", "text": "最终回答..."}
],
"stop_reason": "end_turn",
"usage": {"input_tokens": 139, "output_tokens": 2269}
}
关键约束
1. 必须绕过代理: proxies={"http": None, "https": None} 或 --proxy ""
2. 并发上限: 3
3. 超时建议: 300-600秒
4. thinking.budget_tokens 不能超过 max_tokens