Appearance
常见问题
Claude Code 连接问题
如何配置 Claude Code 使用 Huifa?
在 Claude Code 中设置以下环境变量:
bash
export ANTHROPIC_BASE_URL="https://huifa.one-connect.cn/v1"
export ANTHROPIC_API_KEY="sk-your-huifa-key"Claude Code 提示不支持长上下文(1M context)
Claude Code 使用超长上下文时需要 anthropic-beta 请求头包含对应的 beta flag。如果你发现 1M 上下文不可用,请联系管理员确认渠道已配置 context-1m-2025-08-07 beta 支持。
请求大文件或长对话时报 413 错误
413 Request Entity Too Large 表示请求体超过了服务端限制。长上下文请求(200K+ tokens)的请求体可能达到数 MB。如遇到此问题请联系我们调整限制。
Thinking(思考模式)
如何使用 Claude 的 thinking 模式?
根据你使用的 API 格式,有不同的方式:
Claude 原生格式(/v1/messages):
直接在请求中传入 thinking 参数:
bash
curl https://huifa.one-connect.cn/v1/messages \
-H "x-api-key: sk-your-huifa-key" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-opus-4-6",
"max_tokens": 16000,
"thinking": {"type": "enabled", "budget_tokens": 10000},
"temperature": 1.0,
"messages": [{"role": "user", "content": "你的问题"}]
}'OpenAI 兼容格式(/v1/chat/completions):
方式一:使用 -thinking 模型后缀
bash
curl https://huifa.one-connect.cn/v1/chat/completions \
-H "Authorization: Bearer sk-your-huifa-key" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-opus-4-6-thinking",
"max_tokens": 8192,
"messages": [{"role": "user", "content": "你的问题"}]
}'方式二:使用 reasoning_effort 参数
bash
curl https://huifa.one-connect.cn/v1/chat/completions \
-H "Authorization: Bearer sk-your-huifa-key" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-opus-4-6",
"max_tokens": 8192,
"reasoning_effort": "high",
"messages": [{"role": "user", "content": "你的问题"}]
}'thinking 模式的响应格式是什么?
Claude 原生格式返回 thinking 类型的 content block:
json
{
"content": [
{"type": "thinking", "thinking": "思考过程..."},
{"type": "text", "text": "最终回答"}
]
}OpenAI 兼容格式返回 reasoning_content 字段:
json
{
"choices": [{
"message": {
"content": "最终回答",
"reasoning_content": "思考过程..."
}
}]
}流式响应中,thinking 内容通过 delta.reasoning_content 逐块返回。
模型相关
模型名称带日期和不带日期有什么区别?
claude-opus-4-6— 始终指向该系列最新版本,会随 Anthropic 更新自动升级claude-opus-4-6-20250514— 锁定到特定发布日期的版本,行为永远不变
一般使用不带日期的版本即可。如果你的应用需要结果可复现(如评测、合规场景),可以使用带日期的版本。
支持哪些 Claude 模型?
| 模型 | 说明 |
|---|---|
| claude-opus-4-6 | 最强能力,适合复杂推理和编程 |
| claude-sonnet-4-6 | 平衡性能和速度 |
工具调用(Tool Use)
工具调用支持流式输出吗?
支持。流式模式下工具调用会通过 content_block_start 事件逐个返回,每个工具的输入参数通过 content_block_delta 增量传输。
thinking + 工具调用可以同时使用吗?
可以。启用 thinking 后,响应会先返回 thinking block,然后返回 text 和 tool_use block。
