mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-16 13:03:31 +08:00
- Slim down README from ~400 lines to ~140 lines, keeping only essential content - Reorganize docs/ into guide/, features/, reference/, images/ subdirectories - Add GitHub badges (stars, forks, issues, PRs, license, language switch) - Extract env vars, FAQ, fixes, project structure, global usage into separate docs - Add LICENSE file (educational and research use only) - Update all cross-references and issue template links
36 lines
1.6 KiB
Markdown
36 lines
1.6 KiB
Markdown
# 常见问题
|
||
|
||
<p align="right"><a href="./faq.en.md">English</a> | <a href="../../README.md">返回 README</a></p>
|
||
|
||
## Q: `undefined is not an object (evaluating 'usage.input_tokens')`
|
||
|
||
**原因**:`ANTHROPIC_BASE_URL` 配置不正确,API 端点返回的不是 Anthropic 协议格式的 JSON,而是 HTML 页面或其他格式。
|
||
|
||
本项目使用 **Anthropic Messages API 协议**,`ANTHROPIC_BASE_URL` 必须指向一个兼容 Anthropic `/v1/messages` 接口的端点。Anthropic SDK 会自动在 base URL 后面拼接 `/v1/messages`,所以:
|
||
|
||
- MiniMax:`ANTHROPIC_BASE_URL=https://api.minimaxi.com/anthropic` ✅
|
||
- OpenRouter:`ANTHROPIC_BASE_URL=https://openrouter.ai/api` ✅
|
||
- OpenRouter 错误写法:`ANTHROPIC_BASE_URL=https://openrouter.ai/anthropic` ❌(返回 HTML)
|
||
|
||
如果你的模型供应商只支持 OpenAI 协议,需要通过 LiteLLM 等代理做协议转换,详见 [第三方模型使用指南](./third-party-models.md)。
|
||
|
||
## Q: `Cannot find package 'bundle'`
|
||
|
||
```
|
||
error: Cannot find package 'bundle' from '.../claude-code-haha/src/entrypoints/cli.tsx'
|
||
```
|
||
|
||
**原因**:Bun 版本过低,不支持项目所需的 `bun:bundle` 等内置模块。
|
||
|
||
**解决**:升级 Bun 到最新版本:
|
||
|
||
```bash
|
||
bun upgrade
|
||
```
|
||
|
||
## Q: 怎么接入 OpenAI / DeepSeek / Ollama 等非 Anthropic 模型?
|
||
|
||
本项目只支持 Anthropic 协议。如果模型供应商不直接支持 Anthropic 协议,需要用 [LiteLLM](https://github.com/BerriAI/litellm) 等代理做协议转换(OpenAI → Anthropic)。
|
||
|
||
详细配置步骤请参考:[第三方模型使用指南](./third-party-models.md)
|