Video Inputs
How to send video files to Linkora models
Linkora supports sending video files to compatible models via the API. This guide shows you how to work with video through the API.
Linkora supports both direct URLs and base64-encoded data URLs for videos:
- URLs: Efficient for publicly accessible videos as they don't require local encoding
- Base64 Data URLs: Required for local files or private videos that aren't publicly accessible
Video Inputs
You can send video files to compatible models through the Responses API (/api/v1/responses) using the input_video content type. The video_url can be either a URL or a base64-encoded data URL. Only models with video processing capabilities handle these requests.
You can search for models that support video by filtering to video input modality on our Models page.
Using Video URLs
Here's how to send a video using a URL. Note that for Google Gemini on AI Studio, only YouTube links are supported:
import { Linkora } from '@linkora/sdk';
const linkora = new Linkora({
apiKey: '<LINKORA_API_KEY>',
});
const result = await linkora.responses.send({
responsesRequest: {
model: "google/gemini-2.5-flash",
input: [
{
role: "user",
content: [
{
type: "input_text",
text: "Please describe what's happening in this video.",
},
{
type: "input_video",
videoUrl: "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
},
],
},
],
stream: false,
},
});
console.log(result);Using Base64 Encoded Videos
For locally stored videos, you can send them using base64 encoding as data URLs:
import { Linkora } from '@linkora/sdk';
import * as fs from 'fs';
const linkora = new Linkora({
apiKey: '<LINKORA_API_KEY>',
});
async function encodeVideoToBase64(videoPath: string): Promise<string> {
const videoBuffer = await fs.promises.readFile(videoPath);
const base64Video = videoBuffer.toString('base64');
return `data:video/mp4;base64,${base64Video}`;
}
// Read and encode the video
const videoPath = 'path/to/your/video.mp4';
const base64Video = await encodeVideoToBase64(videoPath);
const result = await linkora.responses.send({
responsesRequest: {
model: 'google/gemini-2.5-flash',
input: [
{
role: 'user',
content: [
{
type: 'input_text',
text: "What's in this video?",
},
{
type: 'input_video',
videoUrl: base64Video,
},
],
},
],
stream: false,
},
});
console.log(result);Video Processing Mode
processing field.Google Gemini's agentic video understanding lets the model dynamically navigate a video, loading only the frames, transcript, and audio it needs based on your prompt, instead of sampling the whole video at a fixed frame rate.
Set the optional processing field on the video part to control this:
agentic: The model actively navigates the video timeline while answering. Best for long-form videos or queries targeting specific momentsstatic: The video is sampled at a fixed frame rate in a single pass. Best for latency-sensitive queries on short clips
If processing is omitted, Linkora does not send a value upstream and Gemini's default applies.
For supported models, mode selection guidance, and token accounting details, refer to Google's video understanding docs as the source of truth.
The processing field is supported in two Linkora APIs:
- Responses API (
/api/v1/responses): on theinput_videocontent part - Chat Completions API (
/api/v1/chat/completions): on thevideo_urlcontent part
The Messages API (/api/v1/messages) does not support video inputs.
Responses API
import requests
url = "https://link-ora.net/api/v1/responses"
headers = {
"Authorization": f"Bearer {API_KEY_REF}",
"Content-Type": "application/json"
}
payload = {
"model": "google/gemini-2.5-flash",
"input": [
{
"role": "user",
"content": [
{
"type": "input_text",
"text": "What is the height of the Rio Cathedral?"
},
{
"type": "input_video",
"video_url": "https://www.youtube.com/watch?v=-11ookL1yPA",
"processing": "agentic"
}
]
}
]
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())Chat Completions API
import requests
url = "https://link-ora.net/api/v1/chat/completions"
headers = {
"Authorization": f"Bearer {API_KEY_REF}",
"Content-Type": "application/json"
}
payload = {
"model": "google/gemini-2.5-flash",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "What is the height of the Rio Cathedral?"
},
{
"type": "video_url",
"video_url": {
"url": "https://www.youtube.com/watch?v=-11ookL1yPA",
"processing": "agentic"
}
}
]
}
]
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())Response handling per API
When agentic processing is used, the model's internal video navigation steps are returned as encrypted reasoning rather than as tool calls, and the response finishes normally. The exact shape depends on the API:
- Responses API: The navigation steps appear as
reasoningoutput items withencrypted_content. To preserve the video context on follow-up turns, echo the response's output items (including thereasoningitems) back in theinputof the next request. - Chat Completions API: The navigation steps appear as encrypted
reasoning_detailsentries on the assistant message, and the response finishes withfinish_reason: "stop". To preserve the video context on follow-up turns, send the assistant message back with itsreasoning_detailsintact, as with other reasoning token round-tripping.
Supported Video Formats
Linkora supports the following video formats:
video/mp4video/mpegvideo/movvideo/webm
Common Use Cases
Video inputs enable a wide range of applications:
- Video Summarization: Generate text summaries of video content
- Object and Activity Recognition: Identify objects, people, and actions in videos
- Scene Understanding: Describe settings, environments, and contexts
- Sports Analysis: Analyze gameplay, movements, and tactics
- Surveillance: Monitor and analyze security footage
- Educational Content: Analyze instructional videos and provide insights
Best Practices
File Size Considerations
Video files can be large, which affects both upload time and processing costs:
- Compress videos when possible to reduce file size without significant quality loss
- Trim videos to include only relevant segments
- Consider resolution: Lower resolutions (e.g., 720p vs 4K) reduce file size while maintaining usability for most analysis tasks
- Frame rate: Lower frame rates can reduce file size for videos where high temporal resolution isn't critical
Optimal Video Length
Different models may have different limits on video duration:
- Check model-specific documentation for maximum video length
- For long videos, consider splitting into shorter segments
- Focus on key moments rather than sending entire long-form content
Quality vs. Size Trade-offs
Balance video quality with practical considerations:
- High quality (1080p+, high bitrate): Best for detailed visual analysis, object detection, text recognition
- Medium quality (720p, moderate bitrate): Suitable for most general analysis tasks
- Lower quality (480p, lower bitrate): Acceptable for basic scene understanding and action recognition
Provider-Specific Video URL Support
Video URL support varies significantly by provider:
- Google Gemini (AI Studio): Only supports YouTube links (e.g.,
https://www.youtube.com/watch?v=...) - Google Gemini (Vertex AI): Does not support video URLs. Use base64-encoded data URLs instead
- Other providers: Check model-specific documentation for video URL support
Troubleshooting
Video not processing?
- Verify the model supports video input (check
input_modalitiesincludes"video") - If using a video URL, confirm the provider supports video URLs (see Provider-Specific Video URL Support above)
- For Gemini on AI Studio, ensure you're using a YouTube link, not a direct video file URL
- If the video URL isn't working, try using a base64-encoded data URL instead
- Check that the video format is supported
- Verify the video file isn't corrupted
Large file errors?
- Compress the video to reduce file size
- Reduce video resolution or frame rate
- Trim the video to a shorter duration
- Check model-specific file size limits
- Consider using a video URL (if supported by the provider) instead of base64 encoding for large files
Poor analysis results?
- Ensure video quality is sufficient for the task
- Provide clear, specific prompts about what to analyze
- Consider if the video duration is appropriate for the model
- Check if the video content is clearly visible and well-lit
