# Messages

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

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

## `POST /v1/messages`

Buy one message at auction, in the Anthropic Messages format.

Point an Anthropic client at the router. The smallest request is
`{"model": "liquid.auto", "max_tokens": 256, "messages": [{"role": "user", "content": "Hello"}]}`.
Send the key as `x-api-key` or as a bearer token. Put purchasing rules in
the `exchange` field, as on `POST /v1/chat/completions`.

The router translates the request to the Chat Completions shape and runs
the same auction. `system` becomes the first message. `stop_sequences`
becomes `stop`. `thinking` stays a token budget.

The `exchange` block is on the message, or on the last event of a stream.
The headers `x-liquid-job-id` and `x-liquid-cap-usd` arrive before the first
token.

## `POST /v1/messages/count_tokens`

Estimate the input tokens of a Messages request.

The count is the estimate that the exchange prices with. It is not the
count of a provider tokenizer.
