{
  "what": "An OpenAI-compatible chat-completions endpoint, paid per request in USDC on Base through x402, served by Cloudflare Workers AI. No key, no account: send the request, get a 402 naming the price, sign it, send it again.",
  "endpoint": "https://badhttp.dev/v1/chat/completions",
  "method": "POST",
  "price": {
    "usd_per_request": 0.002,
    "atomic_usdc": "2000",
    "basis": "flat per request, whatever the token count up to the caps",
    "network": "eip155:8453",
    "network_name": "base",
    "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "real_money": true
  },
  "sandbox": {
    "how": "?network=base-sepolia",
    "network": "eip155:84532",
    "real_money": false,
    "model": "llama-3.1-8b-instruct-fp8-fast",
    "max_tokens": 64,
    "max_content_bytes": 2000,
    "order": "on the sandbox the test payment settles BEFORE the model runs (test USDC costs its holder nothing, and settling first is what stops free test money from buying unpaid compute); on mainnet the model runs first",
    "worst_case_cost_usd_per_request": 0.0000921,
    "note": "Test USDC buys the capped shape only, for client developers; mainnet USDC buys the real one."
  },
  "models": [
    {
      "id": "gpt-oss-20b",
      "cloudflare_id": "@cf/openai/gpt-oss-20b",
      "default": true,
      "sandbox_only_when_testnet": false,
      "cost_basis_usd_per_million_tokens": {
        "input": 0.2,
        "output": 0.3
      },
      "worst_case_cost_usd_per_request_at_caps": 0.0015072,
      "typical_cost_usd_per_request_at_caps_english_text": 0.0007072
    },
    {
      "id": "llama-3.1-8b-instruct-fp8-fast",
      "cloudflare_id": "@cf/meta/llama-3.1-8b-instruct-fp8-fast",
      "default": false,
      "sandbox_only_when_testnet": true,
      "cost_basis_usd_per_million_tokens": {
        "input": 0.045,
        "output": 0.384
      },
      "worst_case_cost_usd_per_request_at_caps": 0.0006632,
      "typical_cost_usd_per_request_at_caps_english_text": 0.0004832
    }
  ],
  "cost_assumptions": {
    "tokens_per_byte_worst_case": 0.75,
    "tokens_per_byte_english_text": 0.25,
    "note": "content is capped in UTF-8 bytes because a character can be one token or three"
  },
  "brakes": {
    "one_request_in_flight_per_payer_seconds": 30,
    "isolate_model_spend_ceiling_usd_per_hour": 0.25,
    "past_the_ceiling": "503 with Retry-After, before any request for a signature"
  },
  "default_model": "gpt-oss-20b",
  "reasoning": {
    "models": [
      "gpt-oss-20b"
    ],
    "reasoning_effort": "low unless the request says medium or high; a reasoning model spends output tokens thinking before any text appears, and a run that ends with no text is refused unsettled (502, charged: false), so give it max_tokens to finish"
  },
  "caps": {
    "maxMessages": 64,
    "maxContentBytes": 8000,
    "sandboxMaxContentBytes": 2000,
    "maxTokensDefault": 512,
    "maxTokensMax": 1024,
    "sandboxMaxTokens": 64,
    "maxBodyBytes": 65536,
    "worstTokensPerByte": 0.75,
    "typicalTokensPerByte": 0.25,
    "roles": [
      "system",
      "user",
      "assistant"
    ],
    "content": "strings only, capped in UTF-8 bytes",
    "stream": "must be absent or false: a streamed body cannot be settled after delivery",
    "unsupported": [
      "tools",
      "functions",
      "response_format",
      "n > 1",
      "images"
    ]
  },
  "order_of_operations": [
    "validate the body (a 400 is free and never asks for a signature)",
    "no payment: 402 with PAYMENT-REQUIRED (x402 v2) and accepts in the body (x402 v1)",
    "payment: facilitator /verify",
    "run the model",
    "facilitator /settle",
    "200 with the completion, an x402 object and the receipt header"
  ],
  "charged_when": "only after the model answered and the facilitator settled; a model failure after verify is 502 with charged:false and nothing is broadcast",
  "free": [
    "GET /v1",
    "GET /v1/models",
    "every 400"
  ],
  "cost_basis": {
    "source": "https://developers.cloudflare.com/workers-ai/platform/pricing/",
    "read_on": "2026-10-29",
    "included_free_neurons_per_day": 10000
  },
  "logging": "This Worker keeps no log of prompts or completions (Workers invocation logs are off). The prompt is processed by Cloudflare Workers AI under Cloudflare's terms; the x402 payload goes to the facilitator exactly as on /402/pay; Cloudflare's edge keeps sampled request metadata as for every route.",
  "why": "The one resource here whose paid content has value to anyone but a measurer; the books at /books say what it earns and what it costs.",
  "books": "https://badhttp.dev/books",
  "spec": "docs/spec-v1-chat.md in the source repository",
  "openapi": "https://badhttp.dev/openapi.json"
}
