Home / API docs / OpenAI-Compatible Chat API (fast)
Inference

OpenAI-Compatible Chat API (fast)

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

OPENAI-COMPATIBLE chat completions, fast tier — point any OpenAI SDK at base_url https://api.webbersites.com/v1 and pay per call in USDC instead of holding provider API keys. Models: claude-haiku-4-5 (default), gemini-2.5-flash, gemini-2.5-flash-lite, gpt-5-mini, gpt-5-nano. Caps: 16,000 input chars, 1,024 output tokens, text-only, no streaming. One flat price per call; the x402 payment IS the auth.

Parameters

NameInDescription
modelbodyclaude-haiku-4-5 (default), gemini-2.5-flash, gemini-2.5-flash-lite, gpt-5-mini, gpt-5-nano
messagesbodyrequiredOpenAI-style messages: [{role, content}], text content only, 16,000 chars total
max_tokensbodyoutput cap, clamped to 1,024

Example request

curl -X POST "https://api.webbersites.com/v1/chat/completions" \
  -H "Content-Type: application/json" \
  -d '{"model":"claude-haiku-4-5","messages":[{"role":"user","content":"Classify this ticket as billing, bug, or feature: 'I was charged twice.'"}]}'
# first call returns 402 + payment requirements; an x402 client pays and retries automatically

Example response

{
    "id": "chatcmpl-...",
    "object": "chat.completion",
    "model": "claude-haiku-4-5",
    "choices": [
        {
            "message": {
                "role": "assistant",
                "content": "billing"
            },
            "finish_reason": "stop"
        }
    ],
    "usage": {
        "prompt_tokens": 28,
        "completion_tokens": 3
    }
}
MCP tool: post_v1_chat_completions — 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.