from magic_hour import Client
from os import getenv
client = Client(token=getenv("API_TOKEN"))
res = client.v1.video_to_video.generate(
assets={"video_file_path": "/path/to/1234.mp4", "video_source": "file"},
end_seconds=15.0,
start_seconds=0.0,
style={
"art_style": "3D Render",
"model": "default",
"prompt": "string",
"prompt_type": "default",
"version": "default",
},
fps_resolution="HALF",
name="Video To Video video",
wait_for_completion=True,
download_outputs=True,
download_directory="."
)import { Client } from "magic-hour";
const client = new Client({ token: process.env["API_TOKEN"]!! });
const res = await client.v1.videoToVideo.generate(
{
assets: { videoFilePath: "/path/to/1234.mp4", videoSource: "file" },
endSeconds: 15.0,
fpsResolution: "HALF",
name: "Video To Video video",
startSeconds: 0.0,
style: {
artStyle: "3D Render",
model: "default",
prompt: "string",
promptType: "default",
version: "default",
},
},
{
waitForCompletion: true,
downloadOutputs: true,
downloadDirectory: ".",
},
);package main
import (
os "os"
sdk "github.com/magichourhq/magic-hour-go/client"
nullable "github.com/magichourhq/magic-hour-go/nullable"
video_to_video "github.com/magichourhq/magic-hour-go/resources/v1/video_to_video"
types "github.com/magichourhq/magic-hour-go/types"
)
func main() {
client := sdk.NewClient(
sdk.WithBearerAuth(os.Getenv("API_TOKEN")),
)
res, err := client.V1.VideoToVideo.Create(video_to_video.CreateRequest{
Assets: types.V1VideoToVideoCreateBodyAssets{
VideoFilePath: nullable.NewValue("api-assets/id/1234.mp4"),
VideoSource: types.V1VideoToVideoCreateBodyAssetsVideoSourceEnumFile,
},
EndSeconds: 15.0,
FpsResolution: nullable.NewValue(types.V1VideoToVideoCreateBodyFpsResolutionEnumHalf),
Name: nullable.NewValue("My Video To Video video"),
StartSeconds: 0.0,
Style: types.V1VideoToVideoCreateBodyStyle{
ArtStyle: types.V1VideoToVideoCreateBodyStyleArtStyleEnum3dRender,
Model: nullable.NewValue(types.V1VideoToVideoCreateBodyStyleModelEnumDefault),
PromptType: nullable.NewValue(types.V1VideoToVideoCreateBodyStylePromptTypeEnumDefault),
Version: nullable.NewValue(types.V1VideoToVideoCreateBodyStyleVersionEnumDefault),
},
})
}let client = magic_hour::Client::default()
.with_bearer_auth(&std::env::var("API_TOKEN").unwrap());
let res = client
.v1()
.video_to_video()
.create(magic_hour::resources::v1::video_to_video::CreateRequest {
assets: magic_hour::models::V1VideoToVideoCreateBodyAssets {
video_file_path: Some("api-assets/id/1234.mp4".to_string()),
video_source: magic_hour::models::V1VideoToVideoCreateBodyAssetsVideoSourceEnum::File,
..Default::default()
},
end_seconds: 15.0,
fps_resolution: Some(
magic_hour::models::V1VideoToVideoCreateBodyFpsResolutionEnum::Half,
),
name: Some("My Video To Video video".to_string()),
start_seconds: 0.0,
style: magic_hour::models::V1VideoToVideoCreateBodyStyle {
art_style: magic_hour::models::V1VideoToVideoCreateBodyStyleArtStyleEnum::Enum3dRender,
model: Some(
magic_hour::models::V1VideoToVideoCreateBodyStyleModelEnum::Default,
),
prompt_type: Some(
magic_hour::models::V1VideoToVideoCreateBodyStylePromptTypeEnum::Default,
),
version: Some(
magic_hour::models::V1VideoToVideoCreateBodyStyleVersionEnum::Default,
),
..Default::default()
},
..Default::default()
})
.await;curl --request POST \
--url https://api.magichour.ai/v1/video-to-video \
--header 'accept: application/json' \
--header 'authorization: Bearer <token>' \
--header 'content-type: application/json' \
--data '
{
"name": "My Video To Video video",
"start_seconds": 0,
"end_seconds": 15,
"fps_resolution": "HALF",
"style": {
"art_style": "Minecraft",
"version": "default",
"prompt_type": "default",
"prompt": "string",
"model": "default"
},
"assets": {
"video_source": "file",
"video_file_path": "api-assets/id/1234.mp4",
"youtube_url": "string"
}
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.magichour.ai/v1/video-to-video",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'My Video To Video video',
'start_seconds' => 0,
'end_seconds' => 15,
'fps_resolution' => 'HALF',
'style' => [
'art_style' => 'Minecraft',
'version' => 'default',
'prompt_type' => 'default',
'prompt' => 'string',
'model' => 'default'
],
'assets' => [
'video_source' => 'file',
'video_file_path' => 'api-assets/id/1234.mp4',
'youtube_url' => 'string'
]
]),
CURLOPT_HTTPHEADER => [
"accept: application/json",
"authorization: Bearer <token>",
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.magichour.ai/v1/video-to-video")
.header("accept", "application/json")
.header("content-type", "application/json")
.header("authorization", "Bearer <token>")
.body("{\"name\":\"My Video To Video video\",\"start_seconds\":0,\"end_seconds\":15,\"fps_resolution\":\"HALF\",\"style\":{\"art_style\":\"Minecraft\",\"version\":\"default\",\"prompt_type\":\"default\",\"prompt\":\"string\",\"model\":\"default\"},\"assets\":{\"video_source\":\"file\",\"video_file_path\":\"api-assets/id/1234.mp4\",\"youtube_url\":\"string\"}}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.magichour.ai/v1/video-to-video")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"start_seconds\": 0,\n \"end_seconds\": 15,\n \"style\": {\n \"version\": \"default\",\n \"prompt_type\": \"default\",\n \"prompt\": \"<string>\",\n \"model\": \"default\"\n },\n \"assets\": {\n \"video_source\": \"file\",\n \"video_file_path\": \"api-assets/id/1234.mp4\",\n \"youtube_url\": \"<string>\"\n },\n \"name\": \"My Video To Video video\",\n \"fps_resolution\": \"HALF\"\n}"
response = http.request(request)
puts response.read_body{
"id": "cuid-example",
"credits_charged": 450
}{
"code": "invalid_request",
"message": "<string>"
}{
"code": "unauthorized",
"message": "<string>"
}{
"code": "insufficient_credits",
"message": "<string>"
}{
"code": "not_found",
"message": "<string>"
}{
"code": "unprocessable_entity",
"message": "<string>"
}{
"code": "internal_server_error",
"message": "<string>"
}Video-to-Video
What this API does
Create the same Video To Video you can make in the browser, but programmatically, so you can automate it, run it at scale, or connect it to your own app or workflow.
Good for
- Automation and batch processing
- Adding video to video into apps, pipelines, or tools
How it works (3 steps)
- Upload your inputs (video, image, or audio) with Generate Upload URLs and copy the
file_path. - Send a request to create a video to video job with the basic fields.
- Check the job status until it’s
complete, then download the result fromdownloads.
Key options
- Inputs: usually a file, sometimes a YouTube link, depending on project type
- Resolution: free users are limited to 576px; higher plans unlock HD and larger sizes
- Extra fields: e.g.
face_swap_mode,start_seconds/end_seconds, or a text prompt
Cost
Credits are only charged for the frames that actually render. You’ll see an estimate when the job is queued, and the final total after it’s done.
For detailed examples, see the product page.
from magic_hour import Client
from os import getenv
client = Client(token=getenv("API_TOKEN"))
res = client.v1.video_to_video.generate(
assets={"video_file_path": "/path/to/1234.mp4", "video_source": "file"},
end_seconds=15.0,
start_seconds=0.0,
style={
"art_style": "3D Render",
"model": "default",
"prompt": "string",
"prompt_type": "default",
"version": "default",
},
fps_resolution="HALF",
name="Video To Video video",
wait_for_completion=True,
download_outputs=True,
download_directory="."
)import { Client } from "magic-hour";
const client = new Client({ token: process.env["API_TOKEN"]!! });
const res = await client.v1.videoToVideo.generate(
{
assets: { videoFilePath: "/path/to/1234.mp4", videoSource: "file" },
endSeconds: 15.0,
fpsResolution: "HALF",
name: "Video To Video video",
startSeconds: 0.0,
style: {
artStyle: "3D Render",
model: "default",
prompt: "string",
promptType: "default",
version: "default",
},
},
{
waitForCompletion: true,
downloadOutputs: true,
downloadDirectory: ".",
},
);package main
import (
os "os"
sdk "github.com/magichourhq/magic-hour-go/client"
nullable "github.com/magichourhq/magic-hour-go/nullable"
video_to_video "github.com/magichourhq/magic-hour-go/resources/v1/video_to_video"
types "github.com/magichourhq/magic-hour-go/types"
)
func main() {
client := sdk.NewClient(
sdk.WithBearerAuth(os.Getenv("API_TOKEN")),
)
res, err := client.V1.VideoToVideo.Create(video_to_video.CreateRequest{
Assets: types.V1VideoToVideoCreateBodyAssets{
VideoFilePath: nullable.NewValue("api-assets/id/1234.mp4"),
VideoSource: types.V1VideoToVideoCreateBodyAssetsVideoSourceEnumFile,
},
EndSeconds: 15.0,
FpsResolution: nullable.NewValue(types.V1VideoToVideoCreateBodyFpsResolutionEnumHalf),
Name: nullable.NewValue("My Video To Video video"),
StartSeconds: 0.0,
Style: types.V1VideoToVideoCreateBodyStyle{
ArtStyle: types.V1VideoToVideoCreateBodyStyleArtStyleEnum3dRender,
Model: nullable.NewValue(types.V1VideoToVideoCreateBodyStyleModelEnumDefault),
PromptType: nullable.NewValue(types.V1VideoToVideoCreateBodyStylePromptTypeEnumDefault),
Version: nullable.NewValue(types.V1VideoToVideoCreateBodyStyleVersionEnumDefault),
},
})
}let client = magic_hour::Client::default()
.with_bearer_auth(&std::env::var("API_TOKEN").unwrap());
let res = client
.v1()
.video_to_video()
.create(magic_hour::resources::v1::video_to_video::CreateRequest {
assets: magic_hour::models::V1VideoToVideoCreateBodyAssets {
video_file_path: Some("api-assets/id/1234.mp4".to_string()),
video_source: magic_hour::models::V1VideoToVideoCreateBodyAssetsVideoSourceEnum::File,
..Default::default()
},
end_seconds: 15.0,
fps_resolution: Some(
magic_hour::models::V1VideoToVideoCreateBodyFpsResolutionEnum::Half,
),
name: Some("My Video To Video video".to_string()),
start_seconds: 0.0,
style: magic_hour::models::V1VideoToVideoCreateBodyStyle {
art_style: magic_hour::models::V1VideoToVideoCreateBodyStyleArtStyleEnum::Enum3dRender,
model: Some(
magic_hour::models::V1VideoToVideoCreateBodyStyleModelEnum::Default,
),
prompt_type: Some(
magic_hour::models::V1VideoToVideoCreateBodyStylePromptTypeEnum::Default,
),
version: Some(
magic_hour::models::V1VideoToVideoCreateBodyStyleVersionEnum::Default,
),
..Default::default()
},
..Default::default()
})
.await;curl --request POST \
--url https://api.magichour.ai/v1/video-to-video \
--header 'accept: application/json' \
--header 'authorization: Bearer <token>' \
--header 'content-type: application/json' \
--data '
{
"name": "My Video To Video video",
"start_seconds": 0,
"end_seconds": 15,
"fps_resolution": "HALF",
"style": {
"art_style": "Minecraft",
"version": "default",
"prompt_type": "default",
"prompt": "string",
"model": "default"
},
"assets": {
"video_source": "file",
"video_file_path": "api-assets/id/1234.mp4",
"youtube_url": "string"
}
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.magichour.ai/v1/video-to-video",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'My Video To Video video',
'start_seconds' => 0,
'end_seconds' => 15,
'fps_resolution' => 'HALF',
'style' => [
'art_style' => 'Minecraft',
'version' => 'default',
'prompt_type' => 'default',
'prompt' => 'string',
'model' => 'default'
],
'assets' => [
'video_source' => 'file',
'video_file_path' => 'api-assets/id/1234.mp4',
'youtube_url' => 'string'
]
]),
CURLOPT_HTTPHEADER => [
"accept: application/json",
"authorization: Bearer <token>",
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.magichour.ai/v1/video-to-video")
.header("accept", "application/json")
.header("content-type", "application/json")
.header("authorization", "Bearer <token>")
.body("{\"name\":\"My Video To Video video\",\"start_seconds\":0,\"end_seconds\":15,\"fps_resolution\":\"HALF\",\"style\":{\"art_style\":\"Minecraft\",\"version\":\"default\",\"prompt_type\":\"default\",\"prompt\":\"string\",\"model\":\"default\"},\"assets\":{\"video_source\":\"file\",\"video_file_path\":\"api-assets/id/1234.mp4\",\"youtube_url\":\"string\"}}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.magichour.ai/v1/video-to-video")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"start_seconds\": 0,\n \"end_seconds\": 15,\n \"style\": {\n \"version\": \"default\",\n \"prompt_type\": \"default\",\n \"prompt\": \"<string>\",\n \"model\": \"default\"\n },\n \"assets\": {\n \"video_source\": \"file\",\n \"video_file_path\": \"api-assets/id/1234.mp4\",\n \"youtube_url\": \"<string>\"\n },\n \"name\": \"My Video To Video video\",\n \"fps_resolution\": \"HALF\"\n}"
response = http.request(request)
puts response.read_body{
"id": "cuid-example",
"credits_charged": 450
}{
"code": "invalid_request",
"message": "<string>"
}{
"code": "unauthorized",
"message": "<string>"
}{
"code": "insufficient_credits",
"message": "<string>"
}{
"code": "not_found",
"message": "<string>"
}{
"code": "unprocessable_entity",
"message": "<string>"
}{
"code": "internal_server_error",
"message": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <api_key>, where <api_key> is your API key. To get your API key, go to Developer Hub and click "Create new API Key".
Body
Body
Start time of your clip (seconds). Must be ≥ 0.
x >= 00
End time of your clip (seconds). Must be greater than start_seconds.
x >= 0.115
Show child attributes
Show child attributes
Provide the assets for video-to-video. For video, The video_source field determines whether video_file_path or youtube_url field is used
Show child attributes
Show child attributes
Give your video a custom name for easy identification.
"My Video To Video video"
Determines whether the resulting video will have the same frame per second as the original video, or half.
FULL- the result video will have the same FPS as the input videoHALF- the result video will have half the FPS as the input video
FULL, HALF "HALF"
Response
Success
Success
Unique ID of the video. Use it with the Get video Project API to fetch status and downloads.
"cuid-example"
The amount of credits deducted from your account to generate the video. If the status is not 'complete', this value is an estimate and may be adjusted upon completion based on the actual FPS of the output video.
If video generation fails, credits will be refunded, and this field will be updated to include the refund.
450
Was this page helpful?