Before you start
Create an API key in the dashboard withchat:completions for Chat Completions. If your key has a model allowlist, include lume-omni. Keep the key on your server and set it in the shell where you run the examples:
Authorization: Bearer or x-api-key. Supplying both with values returns HTTP 401.
For SDK examples, install the client you use. cURL examples do not need an SDK.
.py file.
Save an MP3 clip as clip.mp3 in the directory where you run an example. The cURL example uses Python to encode the clip and generate JSON, so it also needs Python installed. It does not need the Python SDK.
Send an audio clip
CallPOST /v1/chat/completions with chat:completions. Add an input_audio part to a user message alongside the question. data contains base64 bytes without a data: prefix, and format is mp3 or wav.
choices[0].message.content. To use a WAV file, change the local filename and input_audio.format to wav. Do not send a local path or remote URL in data; encode the file’s bytes as shown.
Limits
Base64 adds roughly one third to the file size. A clip below 25 MiB can still exceed the body limit when combined with other content, encoded data, and JSON. Reduce the clip or split the task when the request is too large.
Use
max_tokens or max_completion_tokens, but not both. Chat defaults to the model’s maximum output if neither is supplied. A requested output budget is reduced to the model maximum and estimated remaining context space. The example uses 256 tokens for a short answer.
Usage and common errors
Audio requests consume model usage. Readusage.prompt_tokens and usage.completion_tokens in the response; Pricing covers model rates and included usage. Requests reserve estimated usage before running and release unused reserved usage afterward.
Messages does not accept audio input. An audio block on that endpoint returns HTTP 400. A response ending with
finish_reason: "length" reached its output budget and may be incomplete. Keep X-Request-Id when reporting a failure.
Next
Image understanding
Ask Lume Omni about visual content.
Generate text
Build a conversation with any Lume model.

