> ## Documentation Index
> Fetch the complete documentation index at: https://docs.morphllm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Claude Code & Codex

> Run Morph's open models inside Claude Code and Codex

Morph serves its [open models](/sdk/components/fast-models) on both the OpenAI and Anthropic wire formats (see [Endpoints](/endpoints)). You need a [Morph API key](https://morphllm.com/dashboard/api-keys).

## Claude Code

Claude Code speaks the Anthropic Messages API, which Morph serves natively at `/v1/messages`. It's the same two-env-var setup as any Anthropic-compatible provider. `ANTHROPIC_MODEL` remaps sonnet/opus, `ANTHROPIC_SMALL_FAST_MODEL` remaps haiku (background tasks like titles and summaries).

```bash theme={null}
export ANTHROPIC_BASE_URL="https://api.morphllm.com"
export ANTHROPIC_AUTH_TOKEN="YOUR_MORPH_API_KEY"
export ANTHROPIC_MODEL="morph-glm52-744b"
export ANTHROPIC_SMALL_FAST_MODEL="morph-qwen36-27b"
claude
```

Or persist it in `~/.claude/settings.json`:

```json theme={null}
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.morphllm.com",
    "ANTHROPIC_AUTH_TOKEN": "YOUR_MORPH_API_KEY",
    "ANTHROPIC_MODEL": "morph-glm52-744b",
    "ANTHROPIC_SMALL_FAST_MODEL": "morph-qwen36-27b"
  }
}
```

For per-task routing across several models in one session (a cheap model for background work, a bigger one for edits), use [Claude Code Router](https://github.com/musistudio/claude-code-router) (`ccr code`) with a `morph` provider pointed at `https://api.morphllm.com/v1/chat/completions`.

## Codex

Codex speaks only the OpenAI Responses API; the `wire_api = "chat"` path was removed in February 2026, and Morph's chat models serve Chat Completions and Messages, not Responses. Two ways to run Morph:

**Front Morph with a Responses gateway.** Put [LiteLLM](https://docs.litellm.ai/docs/simple_proxy) (or any Responses-compatible router) in front of `api.morphllm.com` and point Codex's `base_url` at the gateway:

```toml theme={null}
# ~/.codex/config.toml
model = "morph-glm52-744b"
model_provider = "morph"

[model_providers.morph]
name = "Morph via LiteLLM"
base_url = "http://localhost:4000/v1"   # your LiteLLM proxy
env_key = "MORPH_API_KEY"
wire_api = "responses"
```

**Or add Morph's fast edits as a tool.** Keep your current Codex model and give it `edit_file` backed by `morph-v3-fast` at 10,500+ tok/s (no gateway):

```toml theme={null}
# ~/.codex/config.toml
[mcp_servers.morph]
command = "npx"
args = ["-y", "@morphllm/morphmcp"]
env = { MORPH_API_KEY = "YOUR_MORPH_API_KEY", ALL_TOOLS = "false" }
```

Model IDs and context windows are on the [Open Source Models](/sdk/components/fast-models) page; per-token rates are on the [pricing page](https://www.morphllm.com/pricing).
