Create
Video
Image
Audio
Library
Developer

Developer Hub

No Quickstart key yet
Create a key to use the request code.

API Playground

Configure a request and generate a test result.
Result
Example output
Example image generated with Magic Hour
Step 3

Production code

Matches your prompt and generation settings — ready to copy into your app.
from magic_hour import Client
from os import getenv

client = Client(token=getenv("MAGIC_HOUR_API_KEY"))
res = client.v1.ai_image_generator.generate(
    image_count=1,
    style={
        "prompt": "Black perfume bottle on wet stone, violet light and soft haze.",
        "tool": "general",
    },
    aspect_ratio="16:9",
    model="z-image-turbo",
    name="My first AI image",
    resolution="640px",
    wait_for_completion=True,
    download_outputs=True,
    download_directory="."
)
Uses your API key from MAGIC_HOUR_API_KEY.
Docs

API Playground

Configure a request and generate a test result.
Result
Example output

API Playground

Configure a request and generate a test result.
First frame preview
Example image
Result
Example output
Resources
AI Agent Skills
Create finished videos with Codex or Claude.
Plans & credit packs
Add credits for API generations.
Usage pricing
Pay for API usage as you scale.
Quick Start
Make your first API call in minutes.
API Cookbook
Runnable examples in a Colab notebook.
SDKs
Official client libraries on GitHub.
Community
Get help from our Discord community.
Your API Keys
No API keys yet
Create your first API key to start making requests.
Keep your API keys secure. Do not share them or expose them in client-side code.
API code examples
Choose an endpoint and language to get started.
from magic_hour import Client
from os import getenv

client = Client(token=getenv("MAGIC_HOUR_API_KEY"))
res = client.v1.ai_image_generator.generate(
    image_count=1,
    style={
        "prompt": "Cool image",
        "tool": "ai-anime-generator",
    },
    aspect_ratio="1:1",
    model="default",
    name="My Ai Image image",
    resolution="1k",
    wait_for_completion=True,
    download_outputs=True,
    download_directory="."
)
BASE URL
https://api.magichour.ai
View full API reference
Resources
AI Agent Skills
Create finished videos with Codex or Claude.
Plans & credit packs
Add credits for API generations.
Usage pricing
Pay for API usage as you scale.
Quick Start
Make your first API call in minutes.
API Cookbook
Runnable examples in a Colab notebook.
SDKs
Official client libraries on GitHub.
Community
Get help from our Discord community.
API Calculator
Use our calculator to estimate your API costs.
Tier
Estimated monthly cost

$0.3600