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

# AI Video Editor API

> Edit existing videos with natural-language prompts.

export const ToolSection = ({type = "image", outputs = [], title = "", productSlug = "", apiSlug = ""}) => <>
    <CardGroup cols={2}>
      <Card title={`${title} API reference`} icon="webhook" horizontal href={`/api-reference/${type}-projects/${apiSlug}`}>
        Request fields, responses, and examples
      </Card>
      <Card title="API quickstart" icon="forward-fast" horizontal href="/get-started/quick-start">
        Install an SDK and complete your first generation
      </Card>
    </CardGroup>

    <p>
      Check <a href="/billing/overview">API pricing</a> and <a href="/api-reference/models">model credit costs</a>, then <a href={`https://magichour.ai/developer?tab=api-keys&ref=docs-tool-${apiSlug}&utm_source=docs&utm_medium=referral&utm_campaign=tools`}>create an API key</a>.
    </p>
    <p>
      To try {title} without code, use the <a href={`https://magichour.ai/products/${productSlug}${productSlug.includes("?") ? "&" : "?"}utm_source=docs&utm_medium=referral&utm_campaign=tools`}>browser tool</a>.
    </p>

    {outputs && outputs.length > 0 && <Tabs>
        {outputs.map((output, idx) => <Tab key={idx} title={`Example Output ${idx + 1}`}>
            <Frame>
              {type === "video" ? <video controls preload="metadata" playsInline className="rounded-lg h-80" src={`${output.src}#t=0.001`} type={`${output.src?.endsWith("mp4") ? 'video/mp4' : "video/webm"}`}>
                </video> : type === "audio" ? <audio controls preload="metadata" className="w-full" src={output.src}>
                  Your browser does not support the audio element.
                </audio> : <img height="320" className="rounded-lg h-80" src={output.src} alt={`${title} example output ${idx + 1}`} />}
            </Frame>
          </Tab>)}
      </Tabs>}

  </>;

## Overview

AI Video Editor changes existing footage from a text prompt. Use it to remove or replace objects, change colors, add scene details, or restyle a clip without a manual timeline workflow.

<ToolSection
  title="AI Video Editor"
  productSlug="ai-video-editor"
  apiSlug="ai-video-editor"
  type="video"
  outputs={[
{
  src: "https://d28dkohlqf5vwj.cloudfront.net/products/ai-video-editor/examples/add-birds.mp4",
},
{
  src: "https://d28dkohlqf5vwj.cloudfront.net/products/ai-video-editor/examples/change-color-to-blue.mp4",
},
]}
/>

## How It Works

1. **Upload a source video** - Use the [file upload API](/api-reference/files/generate-asset-upload-urls) and copy its `file_path`
2. **Describe the edit** - Provide a prompt such as "Change the car color to blue"
3. **Choose the clip range** - Set `start_seconds` and `end_seconds`
4. **Create the job** - Submit the edit and poll until its status is `complete`
5. **Download the result** - Retrieve the edited video from `downloads`

## Use Cases

* **Object removal** - Remove distracting people, props, logos, or background details
* **Scene changes** - Replace backgrounds or add new visual elements
* **Color and lighting edits** - Change colors, lighting, and other scene details
* **Creative restyling** - Turn footage into cinematic, illustrated, or branded variants
* **Ad variants** - Produce multiple edits from one source clip

## Best Practices

<Tip>
  **Use short, stable clips first** - Test a focused 3-10 second segment before processing more
  footage.
</Tip>

* **Write one clear edit** - A focused instruction is easier to apply consistently than several unrelated changes
* **Name the subject** - Identify the object, person, or region you want changed
* **Describe the result** - State the desired color, object, environment, or visual style
* **Use clear footage** - Stable motion, good lighting, and visible subjects improve consistency
* **Review the full clip** - Check transitions and fast-moving details before using the output

## Models and limits

| Model             | Clip duration  | Resolutions       | Default tier |
| :---------------- | :------------- | :---------------- | :----------- |
| `ltx-2.3`         | 0.5–45 seconds | 480p, 720p, 1080p | Free         |
| `gemini-omni-1.1` | 3–10 seconds   | 720p, 1080p       | Paid         |

The selected duration is `end_seconds - start_seconds`. Output resolution defaults to `480p` on the free tier and `720p` on paid tiers, subject to plan limits. Set `model` explicitly to use its duration and resolution limits. The older `gemini-omni` value is deprecated.

## Code Example

The input file must be a direct URL or a `file_path` returned by the file upload API.

```bash cURL theme={null}
curl --request POST \
  --url https://api.magichour.ai/v1/ai-video-editor \
  --header 'accept: application/json' \
  --header 'authorization: Bearer <token>' \
  --header 'content-type: application/json' \
  --data '
{
  "name": "My Video Editor video",
  "start_seconds": 0,
  "end_seconds": 5,
  "style": {
    "prompt": "Change the car color to blue"
  },
  "assets": {
    "video_file_path": "api-assets/id/1234.mp4"
  }
}
'
```

## Pricing

Credits are charged for frames that render. The create response provides an estimate, and the completed job reports the final total in `credits_charged`. See [Billing](/billing/overview) for current rates.

## API Reference

<Card title="AI Video Editor API Reference" icon="webhook" href="/api-reference/video-projects/ai-video-editor">
  View all request fields, models, limits, and response formats
</Card>

## Related Tools

<CardGroup cols={2}>
  <Card title="Video to Video" icon="video" href="/tools/video/video-to-video">
    Apply a new visual style to existing footage
  </Card>

  <Card title="Character Replace" icon="user" href="/tools/video/character-replace">
    Replace a person throughout a video
  </Card>
</CardGroup>
