OpenAI-compatible API bridge using Claude Code OAuth for Claude Max
This opens Claude's authorization page. Click "Authorize" there.
After authorizing, you'll be redirected to a page showing a code. Copy that code and paste it here:
Authenticated successfully!
Use this bridge as an OpenAI-compatible API endpoint:
from openai import OpenAI
client = OpenAI(
base_url="/v1",
api_key="not-needed" # Auth handled by bridge
)
response = client.chat.completions.create(
model="claude-sonnet-4-20250514",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
curl /v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-20250514",
"messages": [{"role": "user", "content": "Hello!"}]
}'
GET /health - Health check
GET /auth/status - Check authentication status
POST /auth/start - Start OAuth flow
POST /auth/callback - Submit auth code manually
POST /auth/refresh - Refresh access token
POST /auth/logout - Clear authentication
GET /v1/models - List available models
GET /v1/models/:id - Get model details
POST /v1/chat/completions - Chat completion (OpenAI-compatible)
POST /v1/completions - Text completion (legacy)