Skip to main content

Blog

Luma Dream Machine API: Ray2 Pricing and First Request

Luma Dream Machine video generation through PiAPI

PiAPI provides Luma Dream Machine Ray2 through its video task API. You can start from a text prompt or guide a clip with an image. This guide uses PiAPI's current Dream Machine task contract and distinguishes API usage prices from subscription plan benefits.

Luma Dream Machine API Pricing on PiAPI

PiAPI's published Dream Machine rate is $0.20 for a 5-second video and $0.40 for a 9-second video. Those are per-task usage prices, not monthly subscription fees. Check the model page and pricing page before budgeting a production batch.

What the Current Luma API Supports

Ray2 generation workflows

  • Text to video: Supply a prompt without a start image to describe the scene and motion.
  • Image to video: Supply a public start_image URL with the prompt to animate a still.
  • End-frame guidance: The documented request also accepts end_image when the destination frame matters.
  • Duration and shape: Choose the documented 5- or 9-second duration and an appropriate aspect_ratio for the target placement.
  • Asynchronous result: Create a task, save its task_id, and poll the task endpoint until it completes or fails.
Diagram showing related start and end images with a motion prompt between them
Start with one scene, describe its motion, and add a related end frame only when the destination matters. Diagram is illustrative.

Check the request contract before shipping

  • Use top-level model: "luma" and task_type: "video_generation".
  • Use input.model: "ray-v2" for the currently documented Ray2 model.
  • Use start_image and end_image for image references; image_url is not the documented field here.
  • Handle pending, completed, and failed task states in your integration instead of assuming a video URL in the create response.

The current PiAPI docs say Ray1 is no longer supported and Ray3 is still in development. Do not label a Ray2 task as a Ray3 generation or promise Ray3 behavior on this endpoint.

How to Make a Dream Machine API Request

Create a task with POST https://api.piapi.ai/api/v1/task and your server-side X-API-Key. The PiAPI request documentation shows the full schema and response.

curl -X POST https://api.piapi.ai/api/v1/task \
  -H "X-API-Key: $PIAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"luma","task_type":"video_generation","input":{"model":"ray-v2","prompt":"A paper boat drifts across a calm pond","duration":5}}'
  1. Text to video: Set model to luma, task_type to video_generation, and input to a prompt, model: "ray-v2", and duration: 5. Add aspect_ratio when your output format requires it.
  2. Image to video: Use the same task shape and add a publicly reachable input.start_image URL. Add input.end_image only when you have a deliberate target frame.
  • Save the returned task_id; task creation normally returns a pending task, not the final media.
  • Poll GET https://api.piapi.ai/api/v1/task/{task_id} with your API key until the status is completed or failed.
  • Read the completed task's output video URL and handle errors, timeouts, and retries in your application.
Diagram of a PiAPI Luma Ray2 task from creation through polling to video URL
The API returns a task ID first. Poll the task until completion before reading its video URL.

Where Dream Machine Fits

  1. Short concept clips: Explore motion and camera ideas from a concise text brief.
  2. Still-image animation: Turn a prepared product or scene image into a short moving shot.
  3. Storyboard tests: Use a start image and optional end image to test a transition before producing a final campaign asset.
  4. Developer prototypes: Verify your task creation, polling, and output handling with a 5-second request before scaling.

These are workflow examples, not claims that every prompt will produce the same result. Keep source images accessible to PiAPI and review each output before use.

Luma Dream Machine API FAQ

How much does Luma Dream Machine cost through PiAPI?

The current published usage price is $0.20 per 5-second task or $0.40 per 9-second task. API usage is charged against your PiAPI credit balance; subscription fees and bonus credits are separate.

Does PiAPI's Free plan include monthly Luma credits?

The Free subscription plan itself lists no recurring free credits. PiAPI's current pricing page says new accounts start with $0.50 in free credits; confirm your balance and model access in the workspace before submitting a task.

How do I try the Ray2 API?

Sign in to PiAPI's Luma workspace, check your available credits, then follow the task documentation to create and poll a 5-second Ray2 request.

Start With a 5-Second Ray2 Task

Read the Luma Dream Machine API docs, compare the model's current pricing, and test a prompt in the PiAPI workspace. The API response gives you a task ID first; retrieve the finished video after the task completes.