Video Chat
For chat over text, images and short videos, use the OpenAI-compatible Chat Completions API.
POST /v2/chat answers natural language questions about up to five of your videos at once. Answers draw on each video’s transcript and captions, and can also look at the frames of a specific time range.
To ask about a short clip without uploading it first, send the video inline with the Chat Completions API with a video input.
Prerequisites
Every video in the request needs the captions feature to be ready. If it is not, the API returns an error listing the missing features. To prepare a video, call Plan Features with {"desired": ["captions"]} and trigger what it returns.
Ask a question
Bash
Python
Response
response: The answer to the question.model: The model that generated the answer.
Request parameters
messages(required): The conversation so far, 1 to 20 messages. Each message has arole(userorassistant) and a non-emptycontentstring. The last message must be from the user.context(required): The videos to analyze, 1 to 5 entries. Each entry has:video_id(required): The video to analyze.start(optional): Start of a time range in seconds. Setting it turns on visual analysis, which extracts and looks at frames from that range. The video’s upload must be complete.end(optional): End of the time range in seconds. Defaults tostartplus 10 seconds, clamped to the video’s duration.
Multi-turn conversations
Send earlier answers back as assistant messages to ask follow-up questions.
Ask about a specific moment
Pair chat with video search: take the video_id, start, and end of a search result and pass them as context, so the answer looks at the frames of that moment.
Question examples
- General: “What is happening in this video?”
- Specific: “What color is the car in the video?”
- Temporal: “What happens at the beginning of the video?”
- Comparative: “How do the two product demos differ?”
- Descriptive: “Describe the setting and atmosphere.”
Error handling
- Video not found: Check that each
video_idincontextexists and belongs to you. - Video not ready: Trigger the
captionsfeature and wait for it to beready. - Upload not complete: Wait for the upload to finish before sending a
starttime.