muapi-chat-agents
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMuapi chat agents
Muapi 聊天 Agent
Muapi serves coding agents natively, so no translation proxy is needed:
| Agent | Protocol | Base URL | Models endpoint |
|---|---|---|---|
| Claude Code | Anthropic Messages | | |
| Codex CLI | OpenAI Responses | | |
Usage bills against the user's Muapi credits at the same per-model prices as the Muapi API. Auth is
always the user's Muapi API key, read from (never paste or commit it).
MUAPI_API_KEYMuapi 原生支持编程 Agent,因此无需协议转换代理:
| Agent | 协议 | Base URL | 模型端点 |
|---|---|---|---|
| Claude Code | Anthropic Messages | | |
| Codex CLI | OpenAI Responses | | |
使用量将按与 Muapi API 中各模型相同的价格,计入用户的 Muapi 额度。认证始终使用用户的 Muapi API key,该密钥从 读取(切勿粘贴或提交它)。
MUAPI_API_KEYRules
规则
- Do not put the full request URL in the base URL. Agents append or
/v1/messagesthemselves./responses - Always read model ids from the models endpoint. Never rely on a remembered list.
- Put provider settings in user-level config, never in project files.
- Authenticate with (Claude Code's
Authorization: Bearer <key>does this) orANTHROPIC_AUTH_TOKEN.x-api-key - A request is checked against the wallet before it runs, so the balance must cover a worst-case request (a large prompt plus the full output limit on a big model can hold a dollar or more; the unused part is returned).
- 不要在 Base URL 中放入完整的请求 URL。Agent 会自行追加 或
/v1/messages。/responses - 始终从模型端点读取模型 ID,绝不要依赖记忆中的列表。
- 将 provider 设置放在用户级配置中,绝不要放在项目文件中。
- 使用 (Claude Code 的
Authorization: Bearer <key>采用此方式)或ANTHROPIC_AUTH_TOKEN进行认证。x-api-key - 请求在执行前会检查钱包余额,因此余额必须足以覆盖最坏情况的请求成本(大型 prompt 加上大型模型的完整输出上限,可能占用 1 美元或更多;未使用的部分会退还)。
Setup
设置
- (PowerShell:
export MUAPI_API_KEY=your_keyand$env:MUAPI_API_KEY = "your_key").setx MUAPI_API_KEY "your_key" - List models:
(Windows PowerShell: usebash
curl -s -H "Authorization: Bearer $MUAPI_API_KEY" https://api.muapi.ai/anthropic/v1/models curl -s -H "Authorization: Bearer $MUAPI_API_KEY" https://api.muapi.ai/openai/v1/models.)curl.exe
- (PowerShell:
export MUAPI_API_KEY=your_key和$env:MUAPI_API_KEY = "your_key")。setx MUAPI_API_KEY "your_key" - 列出模型:
(Windows PowerShell:使用bash
curl -s -H "Authorization: Bearer $MUAPI_API_KEY" https://api.muapi.ai/anthropic/v1/models curl -s -H "Authorization: Bearer $MUAPI_API_KEY" https://api.muapi.ai/openai/v1/models。)curl.exe
Claude Code
Claude Code
Add to (or , never the committed project file):
~/.claude/settings.json.claude/settings.local.jsonjson
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.muapi.ai/anthropic",
"ANTHROPIC_AUTH_TOKEN": "<your Muapi API key>",
"ANTHROPIC_MODEL": "claude-sonnet-5-5"
}
}Or export and in the shell before starting .
env values are literal, so prefer the shell exports to keep the key out of files.
Run inside Claude Code to confirm the base URL, and to see requests.
ANTHROPIC_BASE_URLANTHROPIC_AUTH_TOKEN="$MUAPI_API_KEY"claudesettings.json/statusclaude --debug将以下内容添加到 (或 ,切勿放入已提交的项目文件):
~/.claude/settings.json.claude/settings.local.jsonjson
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.muapi.ai/anthropic",
"ANTHROPIC_AUTH_TOKEN": "<your Muapi API key>",
"ANTHROPIC_MODEL": "claude-sonnet-5-5"
}
}或者在启动 前,在 shell 中导出 和 。
中的 env 值为字面值,因此优先使用 shell 导出变量,以免将密钥保存在文件中。
在 Claude Code 中运行 以确认 Base URL,运行 以查看请求。
claudeANTHROPIC_BASE_URLANTHROPIC_AUTH_TOKEN="$MUAPI_API_KEY"settings.json/statusclaude --debugUncensored (abliterated) models in Claude Code
Claude Code 中的无审查(abliterated)模型
GET /anthropic/v1/modelsclaude --model <id>ANTHROPIC_DEFAULT_HAIKU_MODELANTHROPIC_SMALL_FAST_MODEL/openai/v1modelapply_patchGET /anthropic/v1/modelsclaude --model <id>ANTHROPIC_DEFAULT_HAIKU_MODELANTHROPIC_SMALL_FAST_MODEL/openai/v1modelapply_patchCodex CLI
Codex CLI
~/.codex/config.tomltoml
model = "gpt-5-6-sol"
model_provider = "muapi"
[model_providers.muapi]
name = "Muapi"
base_url = "https://api.muapi.ai/openai/v1"
env_key = "MUAPI_API_KEY"
wire_api = "responses"env_keymodelopenaiollamalmstudiomuapicodex doctormodel_reasoning_effort = "high"~/.codex/config.tomltoml
model = "gpt-5-6-sol"
model_provider = "muapi"
[model_providers.muapi]
name = "Muapi"
base_url = "https://api.muapi.ai/openai/v1"
env_key = "MUAPI_API_KEY"
wire_api = "responses"env_keymodelopenaiollamalmstudiomuapicodex doctormodel_reasoning_effort = "high"Troubleshooting
故障排查
| Problem | Fix |
|---|---|
| 401 | Header must be |
| 402 / insufficient credit | Balance cannot cover the worst case for that request; top up, or lower the output limit |
| 404 model not found | Use an id from the models endpoint |
| Remove the path suffix from the base URL |
| Claude Code asks to log in to Anthropic | Quit the terminal, export the variables, reopen it, start |
| Codex ignores the provider | Move settings to |
| 5xx / provider error | Retry; the proxy already retries a backup route once |
| 问题 | 解决方法 |
|---|---|
| 401 | 请求头必须是 |
| 402 / 额度不足 | 余额无法覆盖该请求的最坏情况;请充值或降低输出上限 |
| 404,未找到模型 | 使用模型端点返回的 ID |
错误中显示 | 从 Base URL 中移除路径后缀 |
| Claude Code 要求登录 Anthropic | 退出终端,导出环境变量,重新打开终端,并从该 shell 启动 |
| Codex 忽略 provider | 将设置移至用户级的 |
| 5xx / provider 错误 | 重试;代理已自动重试一次备用路由 |