mcpField
M
muapi-chat-agents

muapi-chat-agents

github.com/samuraigptAgent workflows865 installsUpdated 4w ago
Repository

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

  1. 01Configure Claude Code and Codex CLI
  2. 02Use native agent protocols
  3. 03Discover models through endpoints
  4. 04Authenticate with Muapi API key
  5. 05Troubleshoot common setup errors

Use cases

  1. 01Connect Claude Code to Muapi
  2. 02Set Muapi as a Codex CLI provider
  3. 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-agents

After installing, type/muapi-chat-agentsin Claude Code to confirm it loaded.

Details

From the project README

Muapi chat agents

Muapi serves coding agents natively, so no translation proxy is needed:

AgentProtocolBase URLModels endpoint
Claude CodeAnthropic Messageshttps://api.muapi.ai/anthropicGET /anthropic/v1/models
Codex CLIOpenAI Responseshttps://api.muapi.ai/openai/v1GET /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/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).

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:
    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.)
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

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 errorsRemove 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

Comments

Markdown supported