Claude Max API Proxy: Use Claude Subscription as OpenAI-Compatible Endpoint

Learn how claude-max-api-proxy turns a Claude Max or Pro subscription into an OpenAI-compatible API endpoint. For developers who want to route OpenAI tools through their Claude subscription.

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 npm package (not an OpenClaw plugin) that turns a Claude Max or Pro subscription into an API endpoint compatible with OpenAI's format. This lets you direct any tool that expects OpenAI's API toward your subscription instead of using an Anthropic API key.

Warning

This provides technical compatibility only, not an officially supported path. Anthropic has previously blocked certain subscription usage outside Claude Code; check Anthropic's current billing terms before depending on this.

Anthropic's Claude Code documentation describes claude -p as Agent SDK/programmatic usage. According to Anthropic's June 15, 2026 support update, the Claude Agent SDK, claude -p, and third-party application usage all count against the signed-in subscription's usage limits (the previously 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

ApproachCost routeBest for
Anthropic API keyPay per token through Claude ConsoleProduction apps, shared automation, volume
Claude subscription proxyClaude Code / claude -p plan and credit rulesPersonal experiments with compatible tools

This proxy allows a Claude Max or Pro subscription to function with tools that expect OpenAI compatibility. It does not offer an unlimited flat rate, it follows Claude Code's usage limits. For production use, API keys remain the more straightforward billing approach.

How it works

Your App -> claude-max-api-proxy -> Claude Code CLI / claude -p -> Anthropic
     (OpenAI format)                (converts format)              (uses your login)

For each request, the proxy spawns the Claude Code CLI as a subprocess, converts OpenAI-format chat requests into CLI prompts, and streams or returns the response back in OpenAI format.

Getting started

Install the proxy

Node.js 20 or later and an authenticated Claude Code CLI are required.

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: {
    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 belong to the proxy's own catalog, not to OpenClaw's Anthropic model references. Each ID corresponds to a Claude Code CLI model alias (opus, sonnet, haiku), so the underlying model changes whenever Anthropic updates that alias in the CLI. Check the proxy's current README before depending on a specific mapping.

Model IDCLI aliasCurrent mapping
claude-opus-4opusClaude Opus 4.5
claude-sonnet-4sonnetClaude Sonnet 4
claude-haiku-4haikuClaude Haiku 4

Advanced configuration

Proxy-style OpenAI-compatible notes

This uses OpenClaw's generic custom /v1 OpenAI-compatible route, the same one used for any other self-hosted OpenAI-compatible backend:

  • Native OpenAI-only request shaping does not apply.
  • /fast and service_tier only affect direct api.anthropic.com traffic; proxy routes leave service_tier unchanged (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) are sent only on native api.openai.com OAuth traffic, not on custom OPENAI_BASE_URL targets 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

  • Inherits Claude Code's claude -p billing, usage-credit, and rate-limit behavior.
  • Listens on 127.0.0.1 only; no data is sent to any third-party server beyond the CLI's own calls to Anthropic.
  • Streaming responses are supported.
  • Authentication failures are not detected at startup and only appear when a chat request actually runs; if the CLI is not authenticated, expect the first request to fail rather than the server refusing to start.

Note

For native Anthropic integration with Claude CLI or API keys, see Anthropic provider. For OpenAI/Codex subscriptions, see OpenAI provider.