x402

Texto

Chat no formato da OpenAI, sem stream, cobrado pelo pior caso do corpo enviado.

1 rota. Sem pagamento, cada uma responde 402 com o preço do corpo enviado; como pagar e buscar o resultado está em x402.

completions

POST /api/x402/v1/chat/completions · dinâmico, exato no 402

OpenAI-compatible chat completion, one answer per call (no stream). Pick any of the house text models in model (Claude Fable, Opus, Sonnet and Haiku, GPT 6, Gemini 4, Grok 4.7, DeepSeek V4, Kimi K3, Qwen 3.8 and more); the price is the worst case of this body, quoted in the 402.

CampoTipoObrigatórioDescrição
modelstringA house text model id (default deepseek-v4-flash). GET /api/v1/models/pricing?type=text lists them.
messagesarraysim[{ role: system | user | assistant, content: string }], up to 32000 characters in total.
max_tokensintegerOutput cap, 1 to 4096 (default 1024). The price grows with it.
temperaturenumber0 to 2.
top_pnumber0 to 1.
json
{
  "model": "deepseek-v4-flash",
  "messages": [
    {
      "role": "user",
      "content": "Explain the x402 payment protocol in two sentences."
    }
  ],
  "max_tokens": 300
}
  • 200: OpenAI-compatible chat completion, one answer per call (no stream). Pick any of the house text models in model (Claude Fable, Opus, Sonnet and Haiku, GPT 6, Gemini 4, Grok 4.7, DeepSeek V4, Kimi K3, Qwen 3.8 and more); the price is the worst case of this body, quoted in the 402.
  • 402: Payment Required