Skip to main content
POST
cURL

Authorizations

Authorization
string
header
required

A Liquid API key from the API keys page of Liquid Console, sent as Authorization: Bearer $LIQUID_API_KEY.

Body

application/json
model
string
required

The model id to use.

Example:

"$MODEL_ID"

messages
any[]
required

The conversation so far. Messages follow OpenAI role-specific content requirements. User messages may include image_url parts for models that take images, each a base64 data: URL or an http(s) URL, and input_audio parts (base64 WAV, format: "wav") for models that take audio; other models return 400. Liquid downloads linked images itself before the request reaches the model, from public addresses only, and returns 400 when one cannot be downloaded or is not a PNG, JPEG, WebP, or GIF image; a request may link up to 8 images, of at most 10 MB each and 20 MB together.

stream
boolean

When true, tokens stream back as server-sent events.

modalities
any[]

Output types. ["text", "audio"] asks a model with speech output for a spoken reply, returned in message.audio (or streamed in delta.audio) beside the text. Defaults to ["text"]; models without speech output return 400.

audio
object

Spoken reply options when modalities includes "audio", as in OpenAI: { "voice", "format" }. format is pcm16 (headerless 16-bit PCM, 24 kHz mono), or wav (each streamed chunk a complete WAV file); other formats return 400. The reply arrives in message.audio or streamed delta.audio, with its words in transcript. voice is accepted but does not change the voice.

Response

Successful response.

id
string

The completion id.

object
string

Always "chat.completion".

created
integer

Unix timestamp (seconds).

model
string

The model that generated the response.

choices
any[]

The generated choices.

usage
object

Token counts: { prompt_tokens, completion_tokens, total_tokens }, plus cost in USD when the model is priced. Audio models also report OpenAI's prompt_tokens_details and completion_tokens_details, whose audio_tokens say how much of each total was audio. Some vision models bill each image as a multiple of its tokens, counted in prompt_tokens as OpenAI does. Streaming responses report it on the final usage chunk.