Lunos supports video input for compatible models through the Chat Completions API. You can send video as a public URL or as a base64 data URL.
Video URL behavior depends on provider-level capabilities. For example, some Gemini routes only accept YouTube links while others require base64 payloads.
POST /v1/chat/completions
Send video in the message content array using type: "video_url":
{
"type": "video_url",
"video_url": {
"url": "https://example.com/video.mp4"
}
}
Only models with video input capability can process this payload. Check model metadata and ensure inputModalities includes video.
curl -X POST "https://api.lunos.tech/v1/chat/completions" \
-H "Authorization: Bearer YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "google/gemini-2.5-flash",
"messages": [
{
"role": "user",
"content": [
{ "type": "text", "text": "Describe what happens in this video." },
{ "type": "video_url", "video_url": { "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" } }
]
}
]
}'
import requests
payload = {
"model": "google/gemini-2.5-flash",
"messages": [
{
"role": "user",
"content": [
{"type": "text", "text": "Describe what happens in this video."},
{
"type": "video_url",
"video_url": {"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"},
},
],
}
],
}
response = requests.post(
"https://api.lunos.tech/v1/chat/completions",
headers={
"Authorization": "Bearer YOUR_SECRET_KEY",
"Content-Type": "application/json",
},
json=payload,
)
print(response.json())
const response = await fetch("https://api.lunos.tech/v1/chat/completions", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_SECRET_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "google/gemini-2.5-flash",
messages: [
{
role: "user",
content: [
{ type: "text", text: "Describe what happens in this video." },
{
type: "video_url",
video_url: { url: "https://www.youtube.com/watch?v=dQw4w9WgXcQ" },
},
],
},
],
}),
});
console.log(await response.json());
Use this method when the video is local/private or when your provider route does not accept direct video URLs.
import base64
import requests
def encode_video(path):
with open(path, "rb") as f:
return base64.b64encode(f.read()).decode("utf-8")
base64_video = encode_video("path/to/video.mp4")
data_url = f"data:video/mp4;base64,{base64_video}"
payload = {
"model": "google/gemini-2.5-flash",
"messages": [
{
"role": "user",
"content": [
{"type": "text", "text": "What is shown in this video?"},
{"type": "video_url", "video_url": {"url": data_url}},
],
}
],
}
response = requests.post(
"https://api.lunos.tech/v1/chat/completions",
headers={
"Authorization": "Bearer YOUR_SECRET_KEY",
"Content-Type": "application/json",
},
json=payload,
)
print(response.json())
import { readFile } from "node:fs/promises";
async function encodeVideo(path: string) {
const buffer = await readFile(path);
return `data:video/mp4;base64,${buffer.toString("base64")}`;
}
const dataUrl = await encodeVideo("path/to/video.mp4");
const response = await fetch("https://api.lunos.tech/v1/chat/completions", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_SECRET_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "google/gemini-2.5-flash",
messages: [
{
role: "user",
content: [
{ type: "text", text: "What is shown in this video?" },
{ type: "video_url", video_url: { url: dataUrl } },
],
},
],
}),
});
console.log(await response.json());
video/mp4video/mpegvideo/movvideo/webmvideo in inputModalities.No headings found on this page.
