Skip to main content
POST
Chat completion
This endpoint is paid. Read Paying for a request for the 402 handshake, or let BuyerAgent.infer() handle it.

Headers

PAYMENT-SIGNATURE
string

x402 payment payload (base64 JSON) built from the PAYMENT-REQUIRED challenge of the 402 answer. Omit on the first call to receive the price. BuyerAgent and @x402/fetch set this for you. The legacy name X-PAYMENT is also accepted.

Body

application/json
messages
object[]
required
Minimum array length: 1
max_tokens
integer
default:256

Output budget. Priced up front per 1k, so lower is cheaper.

temperature
number

Passed to the model when present

quoteId
string

Quote to pin the price to. Consumed by settlement.

Response

Completion. Settlement succeeded; PAYMENT-RESPONSE carries the transaction.

OpenAI-compatible chat.completion with an agora block

id
string
required
object
enum<string>
required
Available options:
chat.completion
model
string
required

Model id reported by the upstream provider

choices
object[]
required
usage
object
required
agora
object
required