Skip to main content
The Magic Hour provider adds image generation and video generation, from text or from an image, to AI SDK 7. It handles uploads, waiting for the job and downloading the result.

Install

Requires AI SDK 7 and Node.js 22 or newer.

Provider source

Supported models and options, settings, and how failures are reported.

Usage

Set MAGIC_HOUR_API_KEY in your terminal and save this as generate.mjs. Keep the key server-side.
Run node generate.mjs, then open magic-hour-video.mp4 in the same folder. Keep the video resolution at 480p on the Free plan. With ltx-2.5 selected explicitly, leaving out the resolution defaults to 720p. See the resolution rules. For text-to-video, pass a string prompt. Generations consume Magic Hour credits, and the provider never retries a paid request. Once a job is accepted, every error is a MagicHourError with its projectId. Retrieve that project instead of generating again. To keep the ID even if your process stops, save it in onProjectCreated: