About muapi-chat-agents
A setup guide for using Muapi with Claude Code and Codex CLI through their native Anthropic Messages and OpenAI Responses protocols. It covers endpoint configuration, model discovery, authentication, and troubleshooting.
Key features
- 01Configure Claude Code and Codex CLI
- 02Use native agent protocols
- 03Discover models through endpoints
- 04Authenticate with Muapi API key
- 05Troubleshoot common setup errors
Use cases
- 01Connect Claude Code to Muapi
- 02Set Muapi as a Codex CLI provider
- 03Verify model IDs and diagnose errors
MCP support
This project does not describe MCP support; it configures Claude Code and Codex CLI to connect to Muapi through Anthropic Messages and OpenAI Responses endpoints.
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ samuraigpt/ muapi-skills --skill muapi-chat-agentsAfter installing, type/muapi-chat-agentsin Claude Code to confirm it loaded.
Details
From the project READMEMuapi chat agents
Muapi serves coding agents natively, so no translation proxy is needed:
| Agent | Protocol | Base URL | Models endpoint |
|---|---|---|---|
| Claude Code | Anthropic Messages | https://api.muapi.ai/anthropic | GET /anthropic/v1/models |
| Codex CLI | OpenAI 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).
Rules
- Do not put the full request URL in the base URL. Agents append
/v1/messagesor/responsesthemselves. - 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'sANTHROPIC_AUTH_TOKENdoes this) orx-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).
Setup
export MUAPI_API_KEY=your_key(PowerShell:$env:MUAPI_API_KEY = "your_key"andsetx MUAPI_API_KEY "your_key").- List models:
(Windows PowerShell: usecurl -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/modelscurl.exe.)
Claude Code
Add to ~/.claude/settings.json (or .claude/settings.local.json, never the committed project file):
{
"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.
Uncensored (abliterated) models in Claude Code
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.
Codex CLI
~/.codex/config.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".
Troubleshooting
| Problem | Fix |
|---|---|
| 401 | Header must be Authorization: Bearer <key> or x-api-key. Check the key at https://muapi.ai/dashboard |
| 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 |
/v1/v1/messages in errors | 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 claude from that shell |
| Codex ignores the provider | Move settings to ~/.codex/config.toml (user level) |
| 5xx / provider error | Retry; the proxy already retries a backup route once |