Claude Max API Proxy: OpenAI-Compatible Subscription Endpoint
The community claude-max-api-proxy npm package exposes Claude Max or Pro subscription credentials as an OpenAI-compatible endpoint. It suits users who want OpenAI-compatible tools to reach a Claude subscription instead of an Anthropic API key.
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 an npm package maintained by the community (it is not an OpenClaw plugin). It presents a Claude Max/Pro subscription as an endpoint that speaks the OpenAI API, letting you aim any OpenAI-compatible tool at your subscription rather than at an Anthropic API key.
Warning
This is a technical compatibility shim, not a path Anthropic officially endorses. Anthropic has previously blocked certain subscription usage outside of Claude Code, so check Anthropic's present billing rules before you depend on this.
Anthropic's Claude Code documentation treats
claude -pas Agent SDK/programmatic usage. Per Anthropic's June 15, 2026 support update, the Claude Agent SDK,claude -p, and third-party app usage all consume the signed-in subscription's usage limits (the separate Agent SDK credit plan announced earlier is paused). Consult Anthropic's Agent SDK plan article, the Pro/Max and Team/Enterprise plan articles, plus Anthropic provider for OpenClaw's own notes on Claude CLI billing.
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 can serve OpenAI-compatible tools. It is not an unlimited flat-rate arrangement: Claude Code's usage limits carry over to it. For production work, API keys stay the more predictable billing option.
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. It translates OpenAI-format chat requests into CLI prompts, then streams back (or returns) the reply in OpenAI format.
Getting started
Install the proxy
Node.js 20+ is needed, along with a Claude Code CLI that has been authenticated.
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 treat 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 listed below come from the proxy's own catalog and are not OpenClaw's Anthropic model refs. Every id corresponds to a Claude Code CLI model alias (
opus,sonnet,haiku), which means the model behind it changes any time Anthropic updates that alias in the CLI. Look at the proxy's current README before depending on any particular mapping.
| Model ID | CLI alias |
|---|---|
claude-opus-4 | opus |
claude-sonnet-4 | sonnet |
claude-haiku-4 | haiku |
Advanced configuration
Proxy-style OpenAI-compatible notes
This relies on OpenClaw's generic custom /v1 OpenAI-compatible route, which is identical to the path used by any other self-hosted OpenAI-compatible backend:
- Request shaping that is native to OpenAI only does not apply.
/fastandservice_tierapply solely to directapi.anthropic.comtraffic; proxy routes leaveservice_tieralone (refer to Anthropic provider fast mode).- There is no Responses
store, no prompt-cache hints, and no OpenAI reasoning-compat payload shaping. - OpenClaw's OpenAI/Codex attribution headers (
originator,version,User-Agent) go out only on nativeapi.openai.comOAuth traffic. They are never sent to 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
- Claude Code's
claude -pbilling, usage-credit, and rate-limit behavior carries over. - The listener binds to
127.0.0.1only, and nothing is sent to a third-party server apart from the CLI's own call to Anthropic. - Streaming responses are supported.
- Auth failures are not verified at startup. They appear only when a chat request actually runs, so an unauthenticated CLI means the first request fails instead of the server declining to start.
Note
If you want native Anthropic integration through Claude CLI or API keys, look at Anthropic provider. For OpenAI/Codex subscriptions, look at 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.