> ## Documentation Index
> Fetch the complete documentation index at: https://docs.requesty.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Video Input

> Send video to AI models for analysis and question answering

Requesty supports sending video to AI models that accept video input, such as Google Gemini models. Videos are sent through the standard Chat Completions API using the `input_file` content type — the same format used for [PDF support](/features/pdf-support).

<Note>
  **[Browse supported models](https://app.requesty.ai/model-library)** in the Requesty Console. Look for models with `input_video` pricing — currently this is primarily Gemini models (`google/...` and `vertex/google/...`).
</Note>

## How It Works

Video is sent as part of the message content, either as a public URL or as base64-encoded data. Requesty translates the request into the provider's native format — for Gemini, a video URL becomes a `fileData` part and base64 data becomes an `inlineData` part.

## Using a Video URL

Provide a public `http`/`https` URL via `file_url`. For Gemini models, YouTube URLs are also supported.

```bash theme={"dark"}
curl https://router.requesty.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_REQUESTY_API_KEY" \
  -d '{
    "model": "google/gemini-2.5-flash",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "Describe what happens in this video"
          },
          {
            "type": "input_file",
            "filename": "video.mp4",
            "mime_type": "video/mp4",
            "file_url": "https://example.com/video.mp4"
          }
        ]
      }
    ]
  }'
```

<Note>
  `mime_type` is required when the URL has no recognizable file extension (for example, a YouTube URL or a signed URL without `.mp4`).
</Note>

## Using Base64-Encoded Video

For smaller videos, embed the content directly as a data URL in `file_data`:

```bash theme={"dark"}
curl https://router.requesty.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_REQUESTY_API_KEY" \
  -d '{
    "model": "google/gemini-2.5-flash",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "Summarize this video"
          },
          {
            "type": "input_file",
            "filename": "video.mp4",
            "file_data": "data:video/mp4;base64,AAAAFGZ0eXBpc29t..."
          }
        ]
      }
    ]
  }'
```

## Analyzing a Segment

Use `start_offset` and `end_offset` to analyze only part of a video. Values are durations like `"0s"`, `"15s"`, or `"1m30s"`.

```json theme={"dark"}
{
  "type": "input_file",
  "filename": "video.mp4",
  "mime_type": "video/mp4",
  "file_url": "https://example.com/video.mp4",
  "start_offset": "0s",
  "end_offset": "15s"
}
```

## Parameters

* `type`: Must be `"input_file"`
* `filename`: The name of the video file (e.g., `"video.mp4"`)
* `mime_type`: The MIME type of the video (e.g., `"video/mp4"`). Required when the URL has no recognizable file extension
* `file_url`: Public URL of the video (`http`/`https` only)
* `file_data`: Base64-encoded video content as a data URL (e.g., `data:video/mp4;base64,...`)
* `start_offset`: Optional start of the segment to analyze (e.g., `"10s"`)
* `end_offset`: Optional end of the segment to analyze (e.g., `"25s"`)

Provide either `file_url` or `file_data`, not both.

## Python Example

```python theme={"dark"}
import base64
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_REQUESTY_API_KEY",
    base_url="https://router.requesty.ai/v1",
)

# Option 1: Using a video URL
response = client.chat.completions.create(
    model="google/gemini-2.5-flash",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "Describe what happens in this video"
                },
                {
                    "type": "input_file",
                    "filename": "video.mp4",
                    "mime_type": "video/mp4",
                    "file_url": "https://example.com/video.mp4"
                }
            ]
        }
    ]
)

print(response.choices[0].message.content)

# Option 2: Using base64-encoded video from a file
with open("video.mp4", "rb") as video_file:
    video_data = base64.b64encode(video_file.read()).decode('utf-8')

response = client.chat.completions.create(
    model="google/gemini-2.5-flash",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "Summarize this video"
                },
                {
                    "type": "input_file",
                    "filename": "video.mp4",
                    "file_data": f"data:video/mp4;base64,{video_data}"
                }
            ]
        }
    ]
)

print(response.choices[0].message.content)
```

## JavaScript/TypeScript Example

```javascript theme={"dark"}
import OpenAI from 'openai';
import fs from 'fs';

const client = new OpenAI({
  apiKey: 'YOUR_REQUESTY_API_KEY',
  baseURL: 'https://router.requesty.ai/v1',
});

// Option 1: Using a video URL
const response = await client.chat.completions.create({
  model: 'google/gemini-2.5-flash',
  messages: [
    {
      role: 'user',
      content: [
        {
          type: 'text',
          text: 'Describe what happens in this video'
        },
        {
          type: 'input_file',
          filename: 'video.mp4',
          mime_type: 'video/mp4',
          file_url: 'https://example.com/video.mp4'
        }
      ]
    }
  ]
});

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

// Option 2: Using base64-encoded video from a file
const videoData = fs.readFileSync('video.mp4').toString('base64');

const b64Response = await client.chat.completions.create({
  model: 'google/gemini-2.5-flash',
  messages: [
    {
      role: 'user',
      content: [
        {
          type: 'text',
          text: 'Summarize this video'
        },
        {
          type: 'input_file',
          filename: 'video.mp4',
          file_data: `data:video/mp4;base64,${videoData}`
        }
      ]
    }
  ]
});

console.log(b64Response.choices[0].message.content);
```

## Pricing

Video input is billed per token according to the model's `input_video` price, shown in the [Model Library](https://app.requesty.ai/model-library) and returned by the `/v1/models` endpoint.

## Limitations

* Video input is only supported by models with video capability (primarily Gemini). Sending video to other models will result in an error.
* `file_url` must be a public `http` or `https` URL — the provider fetches it directly.
* Base64 video counts toward the request size limit, so prefer `file_url` for larger files.
