muapi-chat-agents

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Muapi chat agents

Muapi 聊天 Agent

Muapi serves coding agents natively, so no translation proxy is needed:
AgentProtocolBase URLModels endpoint
Claude CodeAnthropic Messages
https://api.muapi.ai/anthropic
GET /anthropic/v1/models
Codex CLIOpenAI Responses
https://api.muapi.ai/openai/v1
GET /openai/v1/models
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
MUAPI_API_KEY
(never paste or commit it).
Muapi 原生支持编程 Agent,因此无需协议转换代理:
Agent协议Base URL模型端点
Claude CodeAnthropic Messages
https://api.muapi.ai/anthropic
GET /anthropic/v1/models
Codex CLIOpenAI Responses
https://api.muapi.ai/openai/v1
GET /openai/v1/models
使用量将按与 Muapi API 中各模型相同的价格,计入用户的 Muapi 额度。认证始终使用用户的 Muapi API key,该密钥从
MUAPI_API_KEY
读取(切勿粘贴或提交它)。

Rules

规则

  • Do not put the full request URL in the base URL. Agents append
    /v1/messages
    or
    /responses
    themselves.
  • 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
    Authorization: Bearer <key>
    (Claude Code's
    ANTHROPIC_AUTH_TOKEN
    does this) or
    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 设置放在用户级配置中,绝不要放在项目文件中。
  • 使用
    Authorization: Bearer <key>
    (Claude Code 的
    ANTHROPIC_AUTH_TOKEN
    采用此方式)或
    x-api-key
    进行认证。
  • 请求在执行前会检查钱包余额,因此余额必须足以覆盖最坏情况的请求成本(大型 prompt 加上大型模型的完整输出上限,可能占用 1 美元或更多;未使用的部分会退还)。

Setup

设置

  1. export MUAPI_API_KEY=your_key
    (PowerShell:
    $env:MUAPI_API_KEY = "your_key"
    and
    setx MUAPI_API_KEY "your_key"
    ).
  2. List models:
    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
    (Windows PowerShell: use
    curl.exe
    .)
  1. export MUAPI_API_KEY=your_key
    (PowerShell:
    $env:MUAPI_API_KEY = "your_key"
    和
    setx MUAPI_API_KEY "your_key"
    )。
  2. 列出模型:
    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
    (Windows PowerShell:使用
    curl.exe
    。)

Claude Code

Claude Code

Add to
~/.claude/settings.json
(or
.claude/settings.local.json
, never the committed project file):
json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.muapi.ai/anthropic",
    "ANTHROPIC_AUTH_TOKEN": "<your Muapi API key>",
    "ANTHROPIC_MODEL": "claude-sonnet-5-5"
  }
}
Or export
ANTHROPIC_BASE_URL
and
ANTHROPIC_AUTH_TOKEN="$MUAPI_API_KEY"
in the shell before starting
claude
.
settings.json
env values are literal, so prefer the shell exports to keep the key out of files. Run
/status
inside Claude Code to confirm the base URL, and
claude --debug
to see requests.
将以下内容添加到
~/.claude/settings.json
(或
.claude/settings.local.json
,切勿放入已提交的项目文件):
json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.muapi.ai/anthropic",
    "ANTHROPIC_AUTH_TOKEN": "<your Muapi API key>",
    "ANTHROPIC_MODEL": "claude-sonnet-5-5"
  }
}
或者在启动
claude
前,在 shell 中导出
ANTHROPIC_BASE_URL
和
ANTHROPIC_AUTH_TOKEN="$MUAPI_API_KEY"
。
settings.json
中的 env 值为字面值,因此优先使用 shell 导出变量,以免将密钥保存在文件中。 在 Claude Code 中运行
/status
以确认 Base URL,运行
claude --debug
以查看请求。

Uncensored (abliterated) models in Claude Code

Claude Code 中的无审查(abliterated)模型

GET /anthropic/v1/models
also lists the tool-capable abliterated models. Use the same base URL and key, pick one with
claude --model <id>
, and set
ANTHROPIC_DEFAULT_HAIKU_MODEL
and
ANTHROPIC_SMALL_FAST_MODEL
to that same id (otherwise Claude Code's background requests 404). Warn the user: quality varies by model (smaller models can skip steps on multi-file tasks), there is no prompt caching so every turn re-bills the whole conversation, and output is capped at 16,384 tokens per response. Codex CLI can use them too through
/openai/v1
(set
model
to the id); this path is tested with real Codex CLI sessions (file write, shell and
apply_patch
tool calls on qwen, mimo and glm), but quality varies by model.
GET /anthropic/v1/models
也会列出支持工具调用的无审查(abliterated)模型。使用相同的 Base URL 和密钥,通过
claude --model <id>
选择一个模型,并将
ANTHROPIC_DEFAULT_HAIKU_MODEL
和
ANTHROPIC_SMALL_FAST_MODEL
设置为同一个 ID(否则 Claude Code 的后台请求会返回 404)。提醒用户:模型质量存在差异(较小的模型在多文件任务中可能会跳过步骤),不支持 prompt 缓存,因此每轮都会重新计费整段对话,并且每次响应的输出上限为 16,384 tokens。Codex CLI 也可以通过
/openai/v1
使用这些模型(将
model
设置为对应 ID);此路径已使用真实的 Codex CLI 会话进行测试(qwen、mimo 和 glm 上的文件写入、shell 与
apply_patch
工具调用),但质量因模型而异。

Codex CLI

Codex CLI

~/.codex/config.toml
:
toml
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_key
names the variable that holds the key; it is not the key. Set
model
explicitly to an id from the models endpoint. Provider ids
openai
,
ollama
and
lmstudio
are reserved, so use
muapi
. Run
codex doctor
to verify. Optional:
model_reasoning_effort = "high"
.
~/.codex/config.toml
:
toml
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_key
指定存放密钥的环境变量名称,而不是密钥本身。请将
model
明确设置为模型端点返回的 ID。Provider ID
openai
、
ollama
和
lmstudio
已被保留,因此请使用
muapi
。 运行
codex doctor
进行验证。可选设置:
model_reasoning_effort = "high"
。

Troubleshooting

故障排查

ProblemFix
401Header must be
Authorization: Bearer <key>
or
x-api-key
. Check the key at https://muapi.ai/dashboard
402 / insufficient creditBalance cannot cover the worst case for that request; top up, or lower the output limit
404 model not foundUse an id from the models endpoint
/v1/v1/messages
in errors
Remove the path suffix from the base URL
Claude Code asks to log in to AnthropicQuit the terminal, export the variables, reopen it, start
claude
from that shell
Codex ignores the providerMove settings to
~/.codex/config.toml
(user level)
5xx / provider errorRetry; the proxy already retries a backup route once
问题解决方法
401请求头必须是
Authorization: Bearer <key>
或
x-api-key
。请在 https://muapi.ai/dashboard 检查密钥
402 / 额度不足余额无法覆盖该请求的最坏情况;请充值或降低输出上限
404,未找到模型使用模型端点返回的 ID
错误中显示
/v1/v1/messages
从 Base URL 中移除路径后缀
Claude Code 要求登录 Anthropic退出终端,导出环境变量,重新打开终端,并从该 shell 启动
claude
Codex 忽略 provider将设置移至用户级的
~/.codex/config.toml
5xx / provider 错误重试;代理已自动重试一次备用路由