Home / API docs / Anthropic-Compatible Messages API
Inference

Anthropic-Compatible Messages API

POST /v1/messages $0.01 per call USDC on Base · x402

ANTHROPIC-COMPATIBLE /v1/messages — Claude Haiku 4.5 through the exact Anthropic API dialect: same request/response shape, no Anthropic account, the x402 payment IS the auth. Point an Anthropic SDK's base_url at https://api.webbersites.com and pay per call. Caps: 16,000 input chars, 1,024 output tokens (max_tokens clamped), text-only, no streaming.

Parameters

NameInDescription
modelbodyclaude-haiku-4-5 (the only model on this route)
max_tokensbodyoutput cap, clamped to 1,024
messagesbodyrequiredAnthropic-style messages: [{role, content}], text content only, 16,000 chars total
systembodyoptional system prompt (counts toward the input cap)

Example request

curl -X POST "https://api.webbersites.com/v1/messages" \
  -H "Content-Type: application/json" \
  -d '{"model":"claude-haiku-4-5","max_tokens":256,"messages":[{"role":"user","content":"Summarize x402 in one sentence."}]}'
# first call returns 402 + payment requirements; an x402 client pays and retries automatically

Example response

{
    "id": "msg_...",
    "type": "message",
    "role": "assistant",
    "model": "claude-haiku-4-5",
    "content": [
        {
            "type": "text",
            "text": "x402 is an open protocol..."
        }
    ],
    "stop_reason": "end_turn",
    "usage": {
        "input_tokens": 18,
        "output_tokens": 24
    }
}
MCP tool: post_v1_messages — via npx -y webbersites-x402-mcp (local, key stays on your machine) or the remote endpoint https://api.webbersites.com/mcp.

How payment works

There is no signup and no API key. Call the endpoint; it replies 402 Payment Required with machine-readable payment requirements. Your client signs a USDC transfer authorization (EIP-3009, gasless) and retries with the X-PAYMENT header — @x402/fetch does this automatically. See the overview for a working snippet.