docs/providers/claude-max-api-proxy.md
claude-max-api-proxy is a community npm package (not an OpenClaw plugin) that exposes a Claude Max/Pro subscription as an OpenAI-compatible API endpoint, so you can point any OpenAI-compatible tool at your subscription instead of an Anthropic API key.
<Warning> Technical compatibility only, not an officially sanctioned path. Anthropic has blocked some subscription usage outside Claude Code in the past; verify Anthropic's current billing rules before relying on this.Anthropic's Claude Code docs describe claude -p as Agent SDK/programmatic
usage. As of Anthropic's June 15, 2026 support update, Claude Agent SDK,
claude -p, and third-party app usage draw from the signed-in subscription's
usage limits (the previously announced separate Agent SDK credit plan is
paused). See Anthropic's Agent SDK plan
article,
the Pro/Max
and Team/Enterprise
plan articles, and Anthropic provider for OpenClaw's
own Claude CLI billing notes.
</Warning>
| Approach | Cost route | Best for |
|---|---|---|
| Anthropic API key | Pay per token through Claude Console | Production apps, shared automation, volume |
| Claude subscription proxy | Claude Code / claude -p plan and credit rules | Personal experiments with compatible tools |
This proxy lets a Claude Max or Pro subscription work with OpenAI-compatible tools. It is not an unlimited flat-rate path — it inherits Claude Code's usage limits. API keys remain the clearer billing path for production use.
Your App -> claude-max-api-proxy -> Claude Code CLI / claude -p -> Anthropic
(OpenAI format) (converts format) (uses your login)
The proxy spawns the Claude Code CLI as a subprocess per request, converts OpenAI-format chat requests to CLI prompts, and streams (or returns) the response back in OpenAI format.
```bash
npm install -g claude-max-api-proxy
# Verify Claude CLI is authenticated
claude --version
claude auth login # if not already authenticated
```
curl http://localhost:3456/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "claude-opus-4",
"messages": [{"role": "user", "content": "Hello!"}]
}'
```
```json5
{
env: {
OPENAI_API_KEY: "not-needed",
OPENAI_BASE_URL: "http://localhost:3456/v1",
},
agents: {
defaults: {
model: { primary: "openai/claude-opus-4" },
},
},
}
```
| Model ID | CLI alias | Current mapping |
|---|---|---|
claude-opus-4 | opus | Claude Opus 4.5 |
claude-sonnet-4 | sonnet | Claude Sonnet 4 |
claude-haiku-4 | haiku | Claude Haiku 4 |
- Native OpenAI-only request shaping does not apply.
- `/fast` and `service_tier` only apply to direct `api.anthropic.com`
traffic; proxy routes leave `service_tier` untouched (see
[Anthropic provider fast mode](/providers/anthropic#advanced-configuration)).
- No Responses `store`, prompt-cache hints, or OpenAI reasoning-compat
payload shaping.
- OpenClaw's OpenAI/Codex attribution headers (`originator`, `version`,
`User-Agent`) are only sent on native `api.openai.com` OAuth traffic, not
on custom `OPENAI_BASE_URL` targets like this proxy.
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.claude-max-api.plist
```
claude -p billing, usage-credit, and rate-limit behavior.127.0.0.1 only; does not send data to any third-party server beyond the CLI's own call to Anthropic.