Skip to main content
POST
/
v1
/
animation
Python
from magic_hour import Client
from os import getenv

client = Client(token=getenv("API_TOKEN"))
res = client.v1.animation.generate(
    assets={
        "audio_file_path": "/path/to/1234.mp3",
        "audio_source": "file",
        "image_file_path": "/path/to/1234.png",
    },
    end_seconds=15.0,
    fps=12.0,
    height=960,
    style={
        "art_style": "Painterly Illustration",
        "camera_effect": "Simple Zoom In",
        "prompt": "Cyberpunk city",
        "prompt_type": "custom",
        "transition_speed": 5,
    },
    width=512,
    name="Animation video",
    wait_for_completion=True,
    download_outputs=True,
    download_directory="outputs"
)
{
  "id": "cuid-example",
  "credits_charged": 450
}

Authorizations

Authorization
string
header
required

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

application/json

Body

fps
number
required

The desire output video frame rate

Required range: x >= 1
Example:

12

end_seconds
number<float>
required

This value determines the duration of the output video.

Required range: x >= 0.1
Example:

15

height
integer
required

The height of the final output video. The maximum height depends on your subscription. Please refer to our pricing page for more details

Required range: x >= 64
Example:

960

width
integer
required

The width of the final output video. The maximum width depends on your subscription. Please refer to our pricing page for more details

Required range: x >= 64
Example:

512

style
object
required

Defines the style of the output video

assets
object
required

Provide the assets for animation.

name
string
default:Animation - dateTime

Give your video a custom name for easy identification.

Example:

"My Animation video"

Response

Success

Success

id
string
required

Unique ID of the video. Use it with the Get video Project API to fetch status and downloads.

Example:

"cuid-example"

credits_charged
integer
required

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.

Example:

450