oxDocs
Browse documentation
Introduction
Vision API
Inference API
Realtime
Integrations
LiveKit & SIP
Administration
Reference

Core resources

Models, media, and chat completions

List enabled models, upload reusable media, and stream chat completions.

Choose an enabled model

List the models enabled for the current project before selecting one. Upload image or video bytes once when several questions will reuse the same content.

TypeScript

import { readFile } from "node:fs/promises";

const models = await ox.models.list();
const model = models.data[0];
if (!model) throw new Error("No Ox models are enabled for this project");

const media = await ox.media.create(await readFile("inspection.mp4"), {
  contentType: "video/mp4",
});

const completion = await ox.chat.completions.create({
  model: model.id,
  media_ids: [media.id],
  messages: [{ role: "user", content: "Describe the first safety issue." }],
  temperature: 0,
});

console.log(completion.choices[0]?.message.content);

Stream a response

For incremental output, set stream: true and consume the returned async iterable. Abort the request when the downstream client disconnects.

TypeScript

const stream = await ox.chat.completions.create({
  model: "Qwen/Qwen3-VL-30B-A3B-Instruct",
  messages: [{ role: "user", content: "Summarize the scene." }],
  stream: true,
  stream_options: { include_usage: true },
}, { signal: request.signal, timeoutMs: 60_000 });

for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta.content ?? "");
}

Media uploads accept Blob, ArrayBuffer, or an array-buffer view and are limited to 256 MiB. Use ox.media.exists(media.id) to check a content-addressed object without downloading it.

Help improve this guideFound something unclear or incomplete?
Report an issue ↗View source ↗