# Chat Completions

The OpenAPI 3.1 document is the full description, including schemas:

https://router.inference.ai.exchange/v1/openapi.json

## `POST /v1/chat/completions`

Buy one completion at auction, in the OpenAI Chat Completions format.

Point an OpenAI client at the router. The smallest request is
`{"model": "liquid.auto", "messages": [{"role": "user", "content": "Hello"}]}`.
Put purchasing rules in the `exchange` field of the request. The reply has
an `exchange` field that names the provider, the cap and the charge.

The exchange fixes the price cap before the first token. It sends the cap
in the `x-liquid-cap-usd` header, so a streaming client knows the most it
can pay.

Set `logprobs: true` for the log probabilities in
`choices[0].logprobs.content`. Set `top_logprobs` (0 to 20) for the most
likely tokens at each position. Only offers that declare the feature can
win. The provider reports the values and the exchange cannot verify them.
The response cache never serves a request that asks for them.

Without `max_tokens` and `max_completion_tokens`, the output limit is
32,768 tokens. The exchange lowers a limit that it chose, to what the offers,
the cap and the balance allow, but not below 1,024 tokens. It refuses a limit
that the buyer set and that does not fit. The limit stays above any thinking
budget.
