When to Use Responses API vs Chat Completions
Use Chat Completions if you have an existing integration and only need basic Q&A over media description collections.
Use Responses API for new projects, streaming UIs, entity-backed reasoning, or when you need background processing.
Model Selection
nimbus-001
Fast general question answering model. Works with media description collections for speech, visual, and text understanding. Good for straightforward Q&A and summarization.nimbus-002-preview
Light reasoning model capable of multi-step reasoning and inspecting your video assets from different dimensions. In addition to media description collections, it accepts entity collections and metadata collections directly in the knowledge base (see below), and it supports entity-backed knowledge — combining structured entity data with unstructured video descriptions for richer, more precise answers. When to use which:- nimbus-001 — Fast Q&A, summarization, general questions over video content
- nimbus-002-preview — Multi-step reasoning, cross-video synthesis, queries that need structured + unstructured data together
Basic Response (Sync)
The simplest usage — send a question and get a complete response.- Python
- Node
The Python SDK uses a top-level
collections parameter, while the TypeScript SDK nests it under knowledge_base: { collections: [...] }. Both achieve the same result — the difference is SDK-specific.Streaming Responses
For real-time UIs, stream the response as it’s generated via Server-Sent Events (SSE). The JavaScript SDK uses web-standard APIs (fetch + ReadableStream) internally, so streaming works in both Node.js 18+ and modern browsers — including Next.js client components, React apps, and other browser environments.
The stream emits three event types:
response.output_text.delta— Incremental text chunksresponse.completed— Final event with the full response object (including annotations)error— Error event if something goes wrong
- Python
- Node
Entity-Backed Knowledge
This is the key differentiator ofnimbus-002-preview. Entity-backed knowledge lets the model reason over both your structured entity data (extracted schemas) and unstructured media descriptions simultaneously.
For example, if you have an entity collection with extracted recipe schemas (ingredients, cook times, difficulty) and a media description collection with the full video transcripts, the model can answer questions like “Which beginner recipes take under 30 minutes?” by combining both data sources.
When an entity collection is in scope, the model is given structured-data tools — it can introspect the schema and run read-only SQL over your extracted entities to compute exact answers (counts, rankings, group-bys) instead of estimating from retrieved text. Each query it runs appears in the response output as a cloudglue_query_call item — the SQL it ran plus row counts (result rows are not included). See Structured Queries for that query surface, which you can also call directly via /v1/query.
How It Works
- Create an entity collection with your extraction schema (see Entity Collections)
- Create a media description collection with your videos
- Pass both to the Responses API via
entity_backed_knowledgeconfiguration
- Python
- Node
The Python SDK provides helper methods for building entity-backed knowledge configs:
Configuration Fields
entity_backed_knowledge_config (top-level)
Entity collection config (per-collection)
Entity-Backed Knowledge + Streaming
You can combine entity-backed knowledge with streaming for real-time entity-aware responses:- Python
- Node
Entity Collections in the Knowledge Base
Withnimbus-002-preview, you can also pass an entity collection directly in knowledge_base.collections, just like a media description collection. The model retrieves the collection’s extracted entity data via search: file-level entity collections (enable_video_level_entities or enable_metadata_mode) are retrieved as file-level entity documents, while segment-level collections (enable_segment_level_entities) are retrieved per segment with real timestamps — so answers can cite the exact moments where entity values occur.
- Python
- Node
Entity collections (and metadata collections) in
knowledge_base.collections
require nimbus-002-preview — nimbus-001 rejects them with a 400 error.entity_backed_knowledge_config above: knowledge base collections are retrieved by search (find the relevant files or moments by their extracted data), while entity-backed knowledge gives the model structured lookups and read-only SQL over the same collections for exact computed answers. You can use both in one request — an entity collection as a main collection for retrieval plus entity_backed_knowledge_config for structured queries.
Multi-Turn Conversations
Theinput parameter accepts either a string (single question) or a message array (multi-turn conversation). For multi-turn, include the full conversation history.
- Python
- Node
The Python SDK uses a simplified message format (
{"role": ..., "content": ...}) while the TypeScript SDK uses the full OpenAI Responses format with type: 'message' and structured content arrays.Instructions
Use theinstructions parameter to control response behavior — set a persona, language, format, or domain constraints.
- Python
- Node
Background Processing + Polling
For long-running queries or batch workflows, usebackground: true. The response returns immediately with status in_progress, and you poll for completion.
- Python
- Node
Rich Citations
Request detailed media description annotations on citations by passing theinclude parameter. This returns speech transcripts, visual scene descriptions, and scene text for each cited segment.
- Python
- Node
Filters
Constrain which videos are searched using metadata, file, or video info filters.- Python
- Node
The Python SDK provides a
create_filter() helper:Supported Filter Operations
Filter Categories
metadata— Filter on custom metadata fields (e.g.,metadata.topic)file— Filter on file properties (e.g.,id)video_info— Filter on video properties (e.g.,duration_seconds,has_audio)
Best Practices
Model Selection
- Start with nimbus-001 for fast Q&A and summarization
- Use nimbus-002-preview when you need multi-step reasoning, cross-video synthesis, entity-backed knowledge, or entity/metadata collections in the knowledge base
- Both models support streaming, background processing, multi-turn, and instructions
Streaming vs Background
- Streaming for interactive UIs where users see text appear in real-time
- Background for batch processing, long-running analysis, or server-to-server workflows
- You cannot use both simultaneously
Entity Collections
- Set a top-level
descriptiononentity_backed_knowledge_configto give the model overall context — e.g.,"Customer support calls from enterprise accounts in Q1 2025"helps the model frame its reasoning across all collections - Give each entity collection descriptive
nameanddescriptionvalues — the model uses these to decide when and how to query each collection - A
namelike"recipes"with adescriptionlike"Ingredients, cook times, and difficulty levels for each dish"is more helpful than"data"with no description
Multi-Turn Conversations
- Include the full conversation history in each request for proper context
- For long conversations, consider trimming older turns to stay within token limits
- Use
instructionsto set consistent behavior across turns rather than repeating guidance in each message
Citations
- Use
include: ["cloudglue_citations.media_descriptions"]when you need to display source segments to users or verify answers - Citation annotations include timestamps, speech, visual descriptions, and scene text — useful for building “jump to source” features
Try It Out
Ready to build with the Responses API?- Quickstart: Responses API Quickstart
- API Reference: Create Response
- SDKs: JavaScript | Python
- Playground: Try in browser