Claude Max API Proxy: OpenAI-Compatible Access to Claude Subscriptions
Learn about claude-max-api-proxy, a community npm package that converts Claude Max or Pro subscriptions into an OpenAI-compatible endpoint. This guide covers setup, usage, and important billing considerations for developers.
Read this when
- You want to use Claude Max subscription with OpenAI-compatible tools
- You want a local API server that wraps Claude Code CLI
- You want to evaluate subscription-based vs API-key-based Anthropic access
claude-max-api-proxy is a community-maintained npm package, not an official OpenClaw plugin. It turns a Claude Max or Pro subscription into an OpenAI-compatible API endpoint, letting any tool that speaks OpenAI's format talk to your subscription rather than requiring an Anthropic API key.
Warning
This is a technical compatibility layer, not an officially endorsed route. Anthropic has previously restricted some subscription usage outside Claude Code; check Anthropic's current billing terms before depending on it.
Anthropic's Claude Code documentation refers to
claude -pas Agent SDK or programmatic usage. Per Anthropic's June 15, 2026 support update, Claude Agent SDK,claude -p, and third-party app usage all count against the signed-in subscription's usage limits (the earlier announced separate Agent SDK credit plan is on hold). Refer to 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.
Why use this
| 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 |
With this proxy, a Claude Max or Pro subscription becomes usable from OpenAI-compatible tools. It is not a flat-rate unlimited option; it follows Claude Code's usage limits. For production, API keys remain the more straightforward billing choice.
How it works
Your App -> claude-max-api-proxy -> Claude Code CLI / claude -p -> Anthropic
(OpenAI format) (converts format) (uses your login)
Each request causes the proxy to launch the Claude Code CLI as a subprocess, translate OpenAI-format chat messages into CLI prompts, and then stream or return the reply in OpenAI format.
Getting started
Install the proxy
You need Node.js 20 or newer and an authenticated Claude Code CLI.
npm install -g claude-max-api-proxy
# Verify Claude CLI is authenticated
claude --version
claude auth login # if not already authenticated
Start the server
claude-max-api
# Server runs at http://localhost:3456
Test the proxy
curl http://localhost:3456/health
curl http://localhost:3456/v1/models
curl http://localhost:3456/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "claude-opus-4",
"messages": [{"role": "user", "content": "Hello!"}]
}'
Configure OpenClaw
Configure OpenClaw to use the proxy as a custom OpenAI-compatible endpoint:
{
env: {
vars: {
OPENAI_API_KEY: "not-needed",
OPENAI_BASE_URL: "http://localhost:3456/v1",
},
},
agents: {
defaults: {
model: { primary: "openai/claude-opus-4" },
},
},
}
Note
The model ids shown below come from the proxy's own catalog, not from OpenClaw's Anthropic model refs. Each id corresponds to a Claude Code CLI model alias (
opus,sonnet,haiku), so the actual model changes whenever Anthropic updates that alias in the CLI. Always check the proxy's current README before relying on a particular mapping.
| 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 |
Advanced configuration
Proxy-style OpenAI-compatible notes
OpenClaw's generic custom /v1 OpenAI-compatible route handles this, the same path used for any other self-hosted OpenAI-compatible backend:
- OpenAI-only request shaping is not applied.
/fastandservice_tieronly affect directapi.anthropic.comtraffic; proxy routes leaveservice_tieruntouched (see Anthropic provider fast mode).- No Responses
store, prompt-cache hints, or OpenAI reasoning-compat payload shaping. - OpenClaw's OpenAI/Codex attribution headers (
originator,version,User-Agent) go out only on nativeapi.openai.comOAuth traffic, not on customOPENAI_BASE_URLtargets such as this proxy.
Auto-start on macOS with LaunchAgent
cat > ~/Library/LaunchAgents/com.claude-max-api.plist << 'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.claude-max-api</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/node</string>
<string>/usr/local/lib/node_modules/claude-max-api-proxy/dist/server/standalone.js</string>
</array>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/local/bin:/opt/homebrew/bin:~/.local/bin:/usr/bin:/bin</string>
</dict>
</dict>
</plist>
EOF
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.claude-max-api.plist
Notes
- Follows Claude Code's
claude -pbilling, usage-credit, and rate-limit behavior. - Listens on
127.0.0.1only; no data reaches third-party servers beyond the CLI's own call to Anthropic. - Streaming responses work.
- Auth failures aren't detected at startup; they only show up when a chat request actually executes. If the CLI isn't authenticated, expect the first request to error rather than the server refusing to launch.
Note
For native Anthropic integration with Claude CLI or API keys, see Anthropic provider. For OpenAI/Codex subscriptions, see OpenAI provider.
Related
-
Anthropic provider, Native OpenClaw integration with Claude CLI or API keys.
-
OpenAI provider, For OpenAI/Codex subscriptions.
-
Model selection, Overview of all providers, model refs, and failover behavior.
-
Configuration, Full config reference.