The Hailuo PHP SDK is the language-specific package for Hailuo on RunAPI. Use this package when your application needs Composer installs, associative-array request bodies, task status lookup, and consistent RunAPI errors in PHP.
This README is the PHP package guide for the public hailuo-php split
repository. For model details, use https://runapi.ai/models/hailuo; for API
reference, use https://runapi.ai/docs/api/hailuo/text-to-video; for SDK docs, use
https://runapi.ai/docs/resources/sdks.
composer require runapi-ai/hailuo<?php
require __DIR__ . "/vendor/autoload.php";
use RunApi\Hailuo\HailuoClient;
$client = new HailuoClient(); // reads RUNAPI_API_KEY
$imageToVideoTask = $client->imageToVideo->create([
'model' => 'hailuo-02-image-to-video-pro',
'duration_seconds' => 6,
'enable_safety_checker' => true,
'first_frame_image_url' => 'https://cdn.runapi.ai/public/samples/image.jpg',
'last_frame_image_url' => 'https://cdn.runapi.ai/public/samples/image.jpg',
'output_resolution' => '768p',
'prompt' => 'Make it golden hour',
'prompt_optimizer' => true,
]);
$task = $client->textToVideo->create([
'model' => 'hailuo-02-text-to-video-pro',
'duration_seconds' => 6,
'enable_safety_checker' => true,
'prompt' => 'A precise product render on white marble',
'prompt_optimizer' => true,
]);
$status = $client->textToVideo->get($task->id);
$result = $client->textToVideo->run([
'model' => 'hailuo-02-text-to-video-pro',
'duration_seconds' => 6,
'enable_safety_checker' => true,
'prompt' => 'A serene mountain lake at dawn',
'prompt_optimizer' => true,
]);
echo $result->videos[0]->url . PHP_EOL;Use create() to submit a task and return quickly, get() to fetch the latest
task state, and run() when a script should create and poll until completion.
In web request handlers, prefer create() plus webhook or later get()
polling so a worker is not held open.
RunAPI-generated file URLs are temporary. Download and store generated files in your own durable storage within the retention window; do not treat returned URLs as long-term assets.
Pass request parameters as associative arrays with snake_case keys. The
available resources are textToVideo, imageToVideo. Keep RUNAPI_API_KEY in the environment
or your secret manager; never commit API keys or callback secrets.
- Model page: https://runapi.ai/models/hailuo
- SDK docs: https://runapi.ai/docs/resources/sdks
- Product docs: https://runapi.ai/docs/api/hailuo/text-to-video
- Pricing and rate limits: https://runapi.ai/models/hailuo/02-text-to-video-pro
- Full catalog: https://runapi.ai/models
- GitHub repository: https://github.com/runapi-ai/hailuo-php
- Multi-language SDK repository: https://github.com/runapi-ai/hailuo-sdk
Licensed under the Apache License, Version 2.0.