Files
public-resources/gaccode.txt
2026-03-19 11:00:14 +08:00

129 lines
3.2 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 价值前沿 — GACCODE Claude API 配置指南
## API Key
当前有效:
sk-ant-oat01-d0e6f8c0cd9d87d4efd0aa164f143571454c678127c7daf8ff5ba3916282b23e
已废弃:
sk-ant-oat01-357ef209755a2161be80cd052ebe3985ce3b8aba15d78d84e9b07910a0966b69
sk-ant-oat01-d255ca887a1d5b8fd4fa7f37d59cc34cf81c017602acaf27321e6f361a7709bc
## 连接方式
IP 直连源站,绕过 Cloudflare。必须满足:
- SSL 验证关闭 (verify=False / -k)
- Host 头设为 gaccode.com
- 禁用本地代理 (清除 HTTP_PROXY / HTTPS_PROXY)
端点: POST https://154.26.181.99/claudecode/v1/messages
## 请求头
{
"anthropic-version": "2023-06-01",
"content-type": "application/json",
"x-api-key": "<你的 API Key>",
"Host": "gaccode.com"
}
## 请求体
{
"model": "claude-sonnet-4-20250514",
"max_tokens": 8192,
"temperature": 0.7,
"messages": [
{"role": "user", "content": "你的提示词内容..."}
],
"stream": false
}
可选字段:
- "system": "系统提示词"
- "stream": true (流式输出,需自行解析 SSE)
可用模型 (按价格从低到高):
- claude-haiku-4-5-20251001
- claude-sonnet-4-20250514
- claude-sonnet-4-6-20250627
- claude-opus-4-5-20250514
- claude-opus-4-6-20250617
## 响应格式
{
"id": "msg_xxx",
"model": "claude-sonnet-4-20250514",
"content": [
{"type": "text", "text": "回答内容..."}
],
"stop_reason": "end_turn",
"usage": {
"input_tokens": 1828,
"output_tokens": 2,
"cache_creation_input_tokens": 228,
"cache_read_input_tokens": 0
}
}
## 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-d0e6f8c0cd9d87d4efd0aa164f143571454c678127c7daf8ff5ba3916282b23e" \
-H "Host: gaccode.com" \
-d '{
"model": "claude-sonnet-4-20250514",
"max_tokens": 8192,
"messages": [{"role": "user", "content": "Hello"}],
"stream": false
}'
## Python 示例 (httpx)
import httpx, os
# 禁用代理
os.environ.pop("HTTP_PROXY", None)
os.environ.pop("HTTPS_PROXY", None)
client = httpx.Client(verify=False, timeout=300.0)
response = client.post(
"https://154.26.181.99/claudecode/v1/messages",
headers={
"anthropic-version": "2023-06-01",
"content-type": "application/json",
"x-api-key": "sk-ant-oat01-d0e6f8c0cd9d87d4efd0aa164f143571454c678127c7daf8ff5ba3916282b23e",
"Host": "gaccode.com",
},
json={
"model": "claude-sonnet-4-20250514",
"max_tokens": 8192,
"messages": [{"role": "user", "content": "Hello"}],
"stream": False,
},
)
print(response.json())
## 关键约束
1. 并发上限: 3
2. 超时建议: 300-600 秒
3. 必须禁用代理 (proxies=None 或清除环境变量)
4. 必须关闭 SSL 验证 (IP 直连无有效证书)
5. 必须设置 Host: gaccode.com (nginx 路由依赖)
## 错误码
- 402 Payment Required: API Key 余额不足或已过期,需更换 Key
- 429 Too Many Requests: 并发超限,降低并发或加延迟
- 529 Overloaded: 上游 Claude 过载,等待重试
## 重试策略 (已验证可靠)
- HTTP 错误 (402/429/5xx): 重试间隔 10s → 30s → 60s
- 连接断开 (RemoteProtocolError): 重建 httpx.Client间隔 5s → 15s → 30s
- 最多重试 3 次