API Reference

Everything you need to integrate. Base URL: api.clawzempic.ai

Authentication

Base URL: https://api.clawzempic.ai

All API requests require three headers for authentication and routing:

Header Value Required
x-api-key Your Clawzempic key (sk-clwz-...) Yes
x-upstream-key Your OpenRouter (sk-or-...) or Anthropic (sk-ant-...) key Yes
x-upstream-provider anthropic (default) or openrouter Only when using OpenRouter

Note: You can store your upstream key server-side using PATCH /v1/settings to avoid sending it with every request. Once stored, you only need the x-api-key header.

POST
/v1/chat/completions

Chat Completions

OpenAI-compatible chat completions endpoint. Requires authentication headers.

Request Body

JSON
{
  "model": "claude-sonnet-4-5-20250929",
  "messages": [
    {"role": "user", "content": "Hello"}
  ],
  "max_tokens": 256,
  "stream": true
}

Response Headers

Clawzempic adds custom headers to help you understand routing decisions:

Header Description
X-Router-Model Actual model used (may differ from requested)
X-Router-Reason Why that model was chosen
X-Router-Provider anthropic or openrouter
X-Clawzempic optimized or passthrough
X-Clawzempic-Alert Spend alerts: threshold-80, threshold-95, passthrough-entered, burst-detected

Bypass Routing: Add x-model-pinned: true header to disable intelligent routing and use the exact model you requested. Supports streaming with "stream": true.

POST
/v1/messages

Messages API

Anthropic-native Messages API format. Use this if your SDK expects the Anthropic Messages API format instead of OpenAI chat completions. Requires the same authentication headers as chat completions.

Request Body

JSON
{
  "model": "claude-sonnet-4-5-20250929",
  "max_tokens": 256,
  "messages": [
    {"role": "user", "content": "Hello"}
  ]
}

Returns the same response headers as chat completions.

POST
/v1/signup

Signup

Create a new Clawzempic account and receive your API key. No authentication required.

Request Body

JSON
{
  "email": "[email protected]",
  "agent_name": "my-bot",
  "framework": "openclaw",
  "promo_code": "LAUNCH100",
  "referral_code": "friend123"
}

Fields

Field Type Required Description
email string Yes Valid email for billing and alerts
agent_name string No Alphanumeric + spaces/hyphens, max 100 characters
framework string No openclaw, nanobot, langchain, autogpt, custom
promo_code string No Raises free tier savings cap
referral_code string No Attribution tracking

Response

JSON
{
  "client_id": "clwz_a1b2c3d4e5f6",
  "api_key": "sk-clwz-...",
  "proxy_url": "https://api.clawzempic.ai/v1/chat/completions",
  "plan": "free"
}

Rate Limit: 2 signups per IP address per 24 hours.

GET
/v1/insights?period=7d

Insights

Get detailed usage analytics and savings metrics. Requires x-api-key header.

Query Parameters

Parameter Values Description
period 24h, 7d, 30d Time period for analytics (default: 7d)

Response

JSON
{
  "summary": {
    "totalRequests": 1234,
    "totalCost": 12.50,
    "totalTokens": 5000000
  },
  "savings": {
    "baselineCost": 24.00,
    "actualCost": 12.50,
    "saved": 11.50,
    "percentage": 47.9
  },
  "modelMix": [
    {"model": "claude-haiku-4-20250514", "count": 800},
    {"model": "claude-sonnet-4-5-20250929", "count": 434}
  ],
  "caching": {
    "hitRate": 0.85
  },
  "dailyTrend": [...],
  "recommendations": [...]
}

Caching: Results are cached for 5 minutes to improve performance.

GET / PATCH
/v1/settings

Settings

View and update your routing configuration. Requires x-api-key header.

View Settings

BASH
curl https://api.clawzempic.ai/v1/settings \
  -H 'x-api-key: sk-clwz-YOUR_KEY'

Update Settings

Disable routing:

BASH
curl -X PATCH https://api.clawzempic.ai/v1/settings \
  -H 'x-api-key: sk-clwz-YOUR_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"routing": {"enabled": false}}'

Set custom model for simple tier:

BASH
curl -X PATCH https://api.clawzempic.ai/v1/settings \
  -H 'x-api-key: sk-clwz-YOUR_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"routing": {"models": {"simple": "meta-llama/llama-4-maverick"}}}'

Store your upstream key server-side:

BASH
curl -X PATCH https://api.clawzempic.ai/v1/settings \
  -H 'x-api-key: sk-clwz-YOUR_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"upstream_key": "sk-ant-YOUR_KEY"}'

Billing

Manage your subscription and API keys. All endpoints require x-api-key header.

Endpoint Method Description
/v1/billing/status GET Plan, spend, subscription status
/v1/billing/checkout POST Create Stripe checkout session (upgrade to Core)
/v1/billing/portal POST Stripe billing portal (manage subscription)
/v1/billing/key/rotate POST Rotate your Clawzempic API key

Example: Check Billing Status

BASH
curl https://api.clawzempic.ai/v1/billing/status \
  -H 'x-api-key: sk-clwz-YOUR_KEY'

Error Codes

Standard HTTP status codes with Clawzempic-specific error codes in the response body.

Status Code Meaning Fix
400 MISSING_UPSTREAM_KEY No upstream key provided Add x-upstream-key header
400 INVALID_UPSTREAM_PROVIDER Bad provider value Use anthropic or openrouter
401 Invalid or missing API key Check your x-api-key header
429 Rate limit exceeded Wait and retry with exponential backoff
502 UPSTREAM_ERROR Provider returned an error Check your upstream key and quota
502 UPSTREAM_REDIRECT Blocked redirect from provider Contact support

Framework Examples

Integration examples for popular frameworks and tools.

BASH
npx clawzempic

Auto-configures everything. Interactive setup wizard for Claude Code and OpenClaw.

In Cursor settings, configure the following:

SETTINGS
API Base URL: https://api.clawzempic.ai/v1

Headers:
  x-api-key: sk-clwz-YOUR_CLAWZEMPIC_KEY
  x-upstream-key: sk-ant-YOUR_ANTHROPIC_KEY
PYTHON
import anthropic

client = anthropic.Anthropic(
    api_key="sk-ant-YOUR_KEY",
    base_url="https://api.clawzempic.ai",
    default_headers={
        "x-api-key": "sk-clwz-YOUR_CLAWZEMPIC_KEY",
        "x-upstream-key": "sk-ant-YOUR_ANTHROPIC_KEY",
    },
)

message = client.messages.create(
    model="claude-sonnet-4-5-20250929",
    max_tokens=256,
    messages=[{"role": "user", "content": "Hello"}]
)
PYTHON
from openai import OpenAI

client = OpenAI(
    api_key="sk-or-YOUR_KEY",
    base_url="https://api.clawzempic.ai/v1",
    default_headers={
        "x-api-key": "sk-clwz-YOUR_CLAWZEMPIC_KEY",
        "x-upstream-key": "sk-or-YOUR_OPENROUTER_KEY",
        "x-upstream-provider": "openrouter",
    },
)

completion = client.chat.completions.create(
    model="claude-sonnet-4-5-20250929",
    messages=[{"role": "user", "content": "Hello"}]
)
PYTHON
from langchain_anthropic import ChatAnthropic

llm = ChatAnthropic(
    model="claude-sonnet-4-5-20250929",
    anthropic_api_url="https://api.clawzempic.ai",
    default_headers={
        "x-api-key": "sk-clwz-YOUR_KEY",
        "x-upstream-key": "sk-ant-YOUR_KEY",
    },
)

response = llm.invoke("Hello")
BASH
curl -s -X POST https://api.clawzempic.ai/v1/chat/completions \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: sk-clwz-YOUR_KEY' \
  -H 'x-upstream-key: sk-ant-YOUR_KEY' \
  -d '{
    "model": "claude-sonnet-4-5-20250929",
    "messages": [{"role": "user", "content": "Hello"}],
    "max_tokens": 256
  }'

Rate Limits

Clawzempic enforces the following rate limits to ensure fair usage:

Endpoint Limit
/v1/signup Duplicate emails rejected (409). Email verification required.
/v1/chat/completions Per-client configurable (default: 30 RPM managed, unlimited BYOK)
/v1/billing/checkout 30 per hour
Deduplication window 5 seconds (rejects identical requests)

BYOK (Bring Your Own Key): When using your own upstream key, rate limits are determined by your provider, not Clawzempic. Managed plans have configurable RPM limits.