Overview
The Video API allows you to generate videos using various AI models. You can create videos from text prompts, transform images into videos, or create variations of existing videos. The API handles the complexity of video generation and provides a simple interface for your applications.
AI-Powered Video Generation
Create dynamic videos from text prompts or transform static images into motion with MythIQ's video generation API, powered by state-of-the-art AI models.
Endpoints
Model-specific parameters
Each model may support additional parameters beyond those listed here. For model-specific parameters, please refer to the Models page and select the specific model you're interested in.
/v1/media
List media items with filtering and pagination options.
Query Parameters
Parameter | Type | Description |
---|---|---|
limit | integer | Maximum number of items to return (default: 25, max: 100) |
page | integer | Page number for pagination (default: 0) |
user | string | Filter by user ID or 'me' for current user |
media | string | Set to 'video' to filter for videos only |
size | string | Filter by size (e.g., '1080p') |
model | string | Filter by model ID or 'base/slug' format |
provider | string | Filter by provider ID or slug |
search | string | Search in prompt text |
sort | string | Sort order: 'newest' (default) or 'oldest' |
Response
{
"result": {
"total": 42,
"medias": [
{
"id": "abc123",
"url": "https://cdn.example.com/user/abc123/main.mp4",
"mime": "video/mp4",
"user": "user123",
"media": "video",
"model": "runway/gen-2",
"provider": "runway",
"prompt": "A camera flying through a dense forest with sunlight streaming through the trees",
"size": "1080p",
"duration": 6,
"createdAt": "2025-03-25T12:00:00Z",
"modelSlug": "runway/gen-2:1.0",
"providerName": "Runway"
},
// More video items...
]
},
"success": true
}
/v1/videos/generations
Generate videos using AI models.
Request Body
Parameter | Type | Description |
---|---|---|
model | string | Required. Model ID or 'base/slug[:version]' format |
prompt | string | Required. Text prompt for video generation |
size | string | Video size (default: '1080p') |
image_url | string | Optional. Source image URL for video generation |
duration | number | Duration in seconds (default varies by model, typically 4-6 seconds) |
provider | string | Optional. Specific provider ID or slug |
routing | string | Routing strategy: 'optimal' (default), 'cheapest', or 'compatible' |
public | boolean | Whether the generated media is public (default: true) |
Response
{
"data": [
{
"id": "abc123",
"url": "https://cdn.example.com/user/abc123/main.mp4",
"mime": "video/mp4",
"user": "user123",
"media": "video",
"model": "runway/gen-2",
"provider": "runway",
"prompt": "A camera flying through a dense forest with sunlight streaming through the trees",
"size": "1080p",
"duration": 6,
"createdAt": "2025-03-25T12:00:00Z"
}
],
"price": 0.05,
"success": true,
"stats": {
"setupTime": 120,
"processingTime": 350,
"generationTime": 15000,
"retries": 0,
"providerId": "runway"
}
}
Examples
Code Examples
Generating a Video from Text
import { fetch } from 'cross-fetch';
async function generateVideo() {
const response = await fetch('https://api.mythiq.ai/v1/videos/generations', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY',
},
body: JSON.stringify({
model: 'runway/gen-2',
prompt: 'A camera flying through a dense forest with sunlight streaming through the trees',
size: '1080p',
duration: 6,
}),
});
const data = await response.json();
console.log(data);
}
Generating a Video from an Image
import { fetch } from 'cross-fetch';
async function generateVideoFromImage() {
const response = await fetch('https://api.mythiq.ai/v1/videos/generations', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY',
},
body: JSON.stringify({
model: 'runway/gen-2',
prompt: 'Camera slowly zooming out to reveal the entire landscape',
image_url: 'https://example.com/your-image.jpg',
size: '1080p',
duration: 4,
}),
});
const data = await response.json();
console.log(data);
}
Listing Your Videos
import { fetch } from 'cross-fetch';
async function listVideos() {
const response = await fetch('https://api.mythiq.ai/v1/media?media=video&user=me&limit=10', {
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
}
});
const data = await response.json();
console.log(data.result.medias);
console.log(`Total: ${data.result.total}`);
}
Supported Video Models
MythIQ supports various video generation models, each with different capabilities and characteristics. Here are some of the popular models available:
runway/gen-2
Runway's Gen-2 model for generating videos from text descriptions or image inputs.
Supported Sizes
Special Parameters
Parameter | Type | Description |
---|---|---|
image_url | string | URL of an image to use as the starting point (optional) |
duration | number | Duration in seconds (2-8, default: 4) |
pika/1
Pika Labs' model for generating high-quality videos with detailed motion.
Supported Sizes
Special Parameters
Parameter | Type | Description |
---|---|---|
image_url | string | URL of an image to use as the starting point (optional) |
duration | number | Duration in seconds (3-10, default: 6) |
style | string | Visual style (e.g., "cinematic", "anime", "3d") |
For a complete and up-to-date list of available video models, please refer to the Models page.
Video Processing
When you generate a video through the API, it goes through several processing steps:
- Generation: The AI model creates the video based on your prompt and parameters. This can take anywhere from a few seconds to several minutes depending on the model and complexity.
- Transcoding: The generated video is transcoded into multiple formats for optimal playback across different devices and browsers.
- Thumbnail Creation: Thumbnails are automatically generated for the video to use in listings and previews.
- Storage: The video and its variants are stored in the MythIQ storage system and made available through the CDN.
The API response includes the URL of the processed video, which you can use to display or download the video in your application.