reference_image_urlsarray<string>必須キャラクター、物、衣装、場所のための最大 7 枚の参照写真。JPEG か PNG。プロンプトの中でそれぞれを <<<image_1>>>、<<<image_2>>> などと呼んでください。
- デフォルト値
- 指定なし
- 制約
- minItems:1maxItems:7
kling/o3/reference-to-videoKling O3(Kling 3.0 Omni)reference-to-video は、人物・衣装・場所などの参照画像を最大 7 枚、ひとつの新しいショットに登場させます。720p・1080p・4K の 3〜15 秒で、ネイティブ音声は任意です。
例は、選択中のエンドポイントの公開パラメーター定義から作っています。API キーとサンプル素材を差し替えて、ご自身のサーバーから送信してください。
SDK・連携https://api.spicyapi.ai/api/v1/jobs/createTaskAPI キーはサーバーの環境変数 SPICY_API_KEY に保存します。Bearer 認証を使用し、JSON リクエストには Content-Type: application/json を指定してください。
Authorization: Bearer $SPICY_API_KEY# Generate the idempotency key once; reuse it when retrying after a lost response.
export SPICY_IDEMPOTENCY_KEY="${SPICY_IDEMPOTENCY_KEY:-$(uuidgen)}"
curl -X POST https://api.spicyapi.ai/api/v1/jobs/createTask \
-H "Authorization: Bearer $SPICY_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $SPICY_IDEMPOTENCY_KEY" \
-d '{
"model": "kling/o3/reference-to-video",
"input": {
"aspect_ratio": "16:9",
"duration_seconds": 5,
"generate_audio": false,
"prompt": "A slow aerial shot drifting over a misty pine forest at sunrise",
"reference_image_urls": [
"https://example.com/reference.png"
],
"resolution": "720p",
"shot_type": "single"
}
}'
# Copy data.taskId from the response into TASK_ID, then poll the status.
TASK_ID="TASK_ID_FROM_RESPONSE"
curl "https://api.spicyapi.ai/api/v1/jobs/recordInfo?taskId=$TASK_ID" \
-H "Authorization: Bearer $SPICY_API_KEY"このモデルの入力スキーマから生成した例です。API はどのリクエストも、同じスキーマで検証します。
これらのフィールドは、リクエスト本文の input オブジェクトに指定します。名前と型は API と一致します。デフォルト値の指定がない項目に、デフォルト値があると想定しないでください。
このモデルには項目どうしの依存関係があります。「条件付きで必須」の項目は、ほかの入力の内容によって必須になります。詳しい条件は、下の JSON Schema で確認してください。
reference_image_urlsarray<string>必須キャラクター、物、衣装、場所のための最大 7 枚の参照写真。JPEG か PNG。プロンプトの中でそれぞれを <<<image_1>>>、<<<image_2>>> などと呼んでください。
promptstring必須番号付けした各参照が何であるか(<<<image_1>>>、<<<image_2>>> など)を言い、それらが一緒に作るべきショットを描写してください。各写真が担う役割を名指しすることが、それが他と混ざるのを防ぎます。
multi_promptarray<object>条件付きで必須shot_type を customize にしたときのショットリストです。最大 6 ショットを順番に並べ、それぞれにプロンプト(最大 512 文字)と整数秒の長さを指定します。長さの合計は duration_seconds と一致させてください。課金は引き続き duration_seconds で計算されます。
multi_prompt[].duration_secondsintegerオブジェクト内で必須Length of this shot in whole seconds, 1 to 15.
multi_prompt[].promptstringオブジェクト内で必須What happens in this shot, up to 512 characters.
shot_typestring任意single は 1 つの連続したテイクを求めます(絶対の保証ではありません)。multi はモデルが自分で複数のショットに切り分けます。customize は multi_prompt に書いたショットリストどおりに切ります。どれを選んでも料金は変わりません。
"single""multi""customize"duration_secondsinteger任意料金に影響丸秒単位で 3 から 15。解像度と音声とともに価格を左右します。
keep_original_audioboolean任意参照動画にもともと入っている音を結果に残します。既定でオンで、参照動画を渡したときだけ意味があります。料金は変わりません。
generate_audioboolean任意料金に影響同じ工程に生成されたサウンドトラック――引用符内のセリフ、効果音、環境音――を加えます。720p と 1080p では無音より秒あたりの料金が高くなりますが、4K では音声の有無で料金は変わりません。参照動画と一緒には使えません。
resolutionstring任意料金に影響720p、1080p、4K。上位階層ほど秒あたりの費用が上がります。
"720p""1080p""4k"aspect_ratiostring任意16:9、9:16、1:1。構図が収まるよう、ショットを書く前に選んでください。
"16:9""9:16""1:1"elementsarray<object>任意4K 用の名前付き被写体を 1 件指定します。名前、1 行の説明、同じ人物または物の写真 2〜4 枚(5〜30 秒の音声サンプルは任意)を指定し、プロンプトやショットリストの被写体を登場させたい位置に @名前 と書きます。1 リクエストにつき 1 件で、reference_image_urls と合わせて 7 件までの枠に数えられます。料金は変わりません。
elements[].descriptionstringオブジェクト内で必須One line on who or what this subject is.
elements[].image_urlsarray<string>オブジェクト内で必須2 to 4 images of this subject.
elements[].namestringオブジェクト内で必須Name for this subject; write @name in the prompt where it should appear.
elements[].end_msinteger任意Trim end, in milliseconds, when the subject is taken from a video clip. Defaults to 8000.
elements[].reference_audio_urlsarray<string>任意Optional voice samples for this subject, 5 to 30 seconds each.
elements[].start_msinteger任意Trim start, in milliseconds, when the subject is taken from a video clip. Defaults to 0.
reference_video_urlsarray<string>任意料金に影響任意の参照動画(1 本)で、新しいショットはその動き、カメラワーク、人物を参考にします。プロンプトでは <<<video_1>>> と呼んでください。動画を使うときは参照画像は 4 枚までで、generate_audio はオフのままにする必要があります。参照動画ありの実行は、なしより秒単価が高くなります。4K では使えません。
{
"additionalProperties": false,
"allOf": [
{
"if": {
"properties": {
"shot_type": {
"const": "customize"
}
},
"required": [
"shot_type"
]
},
"then": {
"required": [
"multi_prompt"
]
}
}
],
"properties": {
"aspect_ratio": {
"default": "16:9",
"description": "Output aspect ratio.",
"enum": [
"16:9",
"9:16",
"1:1"
],
"type": "string",
"x-ui": {
"order": 80,
"widget": "radio"
}
},
"duration_seconds": {
"default": 5,
"description": "Output length in whole seconds, from 3 to 15. Billed per second.",
"maximum": 15,
"minimum": 3,
"type": "integer",
"x-ui": {
"affects_price": true,
"order": 60,
"step": 1,
"unit": "s",
"widget": "slider"
}
},
"elements": {
"description": "One named subject built from 2 to 4 images of the same character or object. Write @name in the prompt where it should appear. 4K only.",
"items": {
"additionalProperties": false,
"properties": {
"description": {
"description": "One line on who or what this subject is.",
"maxLength": 500,
"minLength": 1,
"type": "string"
},
"end_ms": {
"description": "Trim end, in milliseconds, when the subject is taken from a video clip. Defaults to 8000.",
"minimum": 0,
"type": "integer"
},
"image_urls": {
"description": "2 to 4 images of this subject.",
"items": {
"format": "uri",
"type": "string"
},
"maxItems": 4,
"minItems": 2,
"type": "array"
},
"name": {
"description": "Name for this subject; write @name in the prompt where it should appear.",
"maxLength": 64,
"minLength": 1,
"type": "string"
},
"reference_audio_urls": {
"description": "Optional voice samples for this subject, 5 to 30 seconds each.",
"items": {
"format": "uri",
"type": "string"
},
"type": "array"
},
"start_ms": {
"description": "Trim start, in milliseconds, when the subject is taken from a video clip. Defaults to 0.",
"minimum": 0,
"type": "integer"
}
},
"required": [
"name",
"description",
"image_urls"
],
"type": "object"
},
"maxItems": 1,
"type": "array",
"x-ui": {
"order": 87,
"widget": "object-list"
}
},
"generate_audio": {
"default": false,
"description": "Generate a native soundtrack (voices, effects, ambience) with the picture. Audio costs more per second. Not available with a reference video.",
"type": "boolean",
"x-ui": {
"affects_price": true,
"order": 65,
"widget": "switch"
}
},
"keep_original_audio": {
"default": true,
"description": "Keep the reference video's own sound in the result. Only matters when a reference video is given.",
"type": "boolean",
"x-ui": {
"order": 63,
"widget": "switch"
}
},
"multi_prompt": {
"description": "Shot list for shot_type customize: one entry per shot, in order, each with its own prompt and length in seconds. The lengths must add up to duration_seconds.",
"items": {
"additionalProperties": false,
"properties": {
"duration_seconds": {
"description": "Length of this shot in whole seconds, 1 to 15.",
"maximum": 15,
"minimum": 1,
"type": "integer"
},
"prompt": {
"description": "What happens in this shot, up to 512 characters.",
"maxLength": 512,
"minLength": 1,
"type": "string"
}
},
"required": [
"prompt",
"duration_seconds"
],
"type": "object"
},
"maxItems": 6,
"minItems": 1,
"type": "array",
"x-ui": {
"order": 54,
"widget": "object-list"
}
},
"prompt": {
"description": "Say who and what each reference is (<<<image_1>>>, <<<image_2>>> and so on) and describe the shot they should produce.",
"maxLength": 2500,
"minLength": 1,
"type": "string",
"x-ui": {
"order": 100,
"primary": true,
"reference_tokens": {
"elements": "@{name}",
"reference_image_urls": "<<<image_{index}>>>",
"reference_video_urls": "<<<video_{index}>>>"
},
"widget": "textarea"
}
},
"reference_image_urls": {
"description": "Reference images for characters, objects, outfits or places, up to 7. Refer to them in the prompt as <<<image_1>>>, <<<image_2>>> and so on.",
"items": {
"contentMediaType": [
"image/jpeg",
"image/png",
"image/webp",
"image/gif"
],
"format": "uri",
"type": "string"
},
"maxItems": 7,
"minItems": 1,
"type": "array",
"x-ui": {
"max_size_mb": 10,
"order": 90,
"widget": "multi-upload"
}
},
"reference_video_urls": {
"description": "Optional reference video (one clip) whose motion, camera or characters the new shot should draw on. Refer to it in the prompt as <<<video_1>>>. With a video, use up to 4 reference images. A run with a reference video is billed at a higher per-second rate.",
"items": {
"contentMediaType": [
"video/mp4",
"video/webm",
"video/quicktime"
],
"format": "uri",
"type": "string"
},
"maxItems": 1,
"minItems": 1,
"type": "array",
"x-ui": {
"accept": [
"video/mp4",
"video/webm"
],
"affects_price": true,
"order": 88,
"widget": "multi-upload"
}
},
"resolution": {
"default": "720p",
"description": "Output resolution. Higher tiers cost more per second.",
"enum": [
"720p",
"1080p",
"4k"
],
"type": "string",
"x-ui": {
"affects_price": true,
"order": 70,
"widget": "radio"
}
},
"shot_type": {
"default": "single",
"description": "single keeps one continuous shot; multi lets the model cut the prompt into several shots on its own; customize follows the shot list you give in multi_prompt.",
"enum": [
"single",
"multi",
"customize"
],
"type": "string",
"x-ui": {
"order": 55,
"widget": "radio"
}
}
},
"required": [
"prompt",
"reference_image_urls"
],
"type": "object",
"x-pricing": {
"billingMode": "variant_matrix",
"presenceFields": {
"with_video": "reference_video_urls"
},
"variantFields": [
"resolution",
"generate_audio",
"with_video"
],
"variantKeyOmitDefaults": [
"with_video"
]
}
}HTTP 202 はタスクを受け付けたという意味で、生成が終わったという意味ではありません。返ってきた taskId を保存し、そのタスクの状態を問い合わせてください。結果を待っている間に、同じ内容でタスクを作り直さないでください。
HTTP/1.1 202 Accepted
Location: /api/v1/jobs/recordInfo?taskId=job_01k3m8x9q2z4v7n5p6r8s0t1w3
{
"code": 200,
"msg": "success",
"request_id": "req_example_create",
"data": {
"taskId": "job_01k3m8x9q2z4v7n5p6r8s0t1w3",
"state": "queued",
"estimatedCost": "0.750000"
}
}受理レスポンスには今回の概算料金が含まれるため、アプリのタスク履歴と請求画面に同じ金額を表示できます。
curl --get "https://api.spicyapi.ai/api/v1/jobs/recordInfo" \
--data-urlencode "taskId=$TASK_ID" \
-H "Authorization: Bearer $SPICY_API_KEY"ポーリングは約 2 秒間隔から始め、徐々に間隔を延ばします。終了状態になったら止めてください。通信が切れたときも、元の taskId で状態を確認します。作成をやり直すときは、同じ冪等キーと同じ本文をそのまま使い回してください。
import { verifyWebhook } from "@spicyapi/sdk";
// express.raw keeps the bytes we signed; express.json never matches.
app.post("/hooks/spicy", express.raw({ type: "application/json" }), (req, res) => {
const { payload } = verifyWebhook({
rawBody: req.body,
timestamp: req.header("X-Webhook-Timestamp"),
signature: req.header("X-Webhook-Signature"),
payloadVersion: Number(req.header("X-Webhook-Payload-Version")),
secret: process.env.SPICY_WEBHOOK_SECRET,
});
res.status(200).end();
void handleFinishedTask(payload);
});タスク作成時に callBackUrl を渡せば、完了したレコードが POST で届きます——ポーリングは一切不要です。配信には毎回 X-Webhook-Timestamp、X-Webhook-Signature、X-Webhook-Payload-Version が付きます。署名は taskId.timestamp.sha256(body) に対する HMAC-SHA256(base64)なので、生のバイト列で検証してください。JSON を解析して再度文字列化するとバイト列が変わり、検証は必ず失敗します。失敗した配信は再送されるため同じ taskId が二度届くことがあります。ハンドラーは冪等に。まず 2xx を返し、処理はその後で——応答が遅いと配信失敗として扱われます。
output を読むのは、state が succeeded のときだけにしてください。失敗したときは errorCode、errorMessage、request_id を手がかりに調べます。例に出ている料金や状態は、実際の請求ではありません。
{
"code": 200,
"msg": "success",
"request_id": "req_example_record",
"data": {
"taskId": "job_01k3m8x9q2z4v7n5p6r8s0t1w3",
"model": "kling/o3/reference-to-video",
"state": "succeeded",
"output": {
"assets": [
{
"key": "tasks/2026/08/28/job_01k3m8x9q2z4v7n5p6r8s0t1w3/3f7a1c9e5b2d48f0a6c1e3d5b7f9a1c3.mp4",
"mime": "video/mp4",
"url": "https://example.r2.cloudflarestorage.com/results/job_01k3m8x9q2z4v7n5p6r8s0t1w3/result.mp4?X-Amz-Signature=SIGNATURE_FROM_RESPONSE",
"expiresAt": "2026-08-28T12:20:08.000Z"
}
]
},
"cost": "0.750000",
"settled": true,
"createdAt": "2026-08-28T12:00:00Z",
"completedAt": "2026-08-28T12:00:30Z"
}
}利用可能なファイルは assets[].url からそのまま開くか、ダウンロードできます。API の Authorization ヘッダーは不要です。署名付き URL は expiresAt で失効しますが、保存期間内であればタスクを再取得することで更新できます。処理中または利用できないファイルに URL はありません。署名付き URL は非公開情報として扱ってください。
アプリ、ターミナル、AI アシスタント、ビジュアルワークフローで SpicyAPI を活用。接続ガイドを選んでください。
上のコードを書く必要はありません。MCP サーバーを 1 回接続すれば、MCP に対応するエージェント(Claude Code、Codex、Cursor、Windsurf、VS Code、Gemini CLI、Cline、LibreChat)がこのモデルを名前で実行できます。シェルから 1 つのコマンドで実行することもできます。
Use kling/o3/reference-to-video to make a five-second shot of a neon-lit rooftop at dusk, slow push-in, and save it to ./out/.
エージェントは公開カタログからモデルを引き、ローカルファイルを代わりにアップロードし、正確な見積もりと上限額を示して確認を待ちます。承認するまで課金は発生しません。
claude mcp add spicyapi -e SPICY_API_KEY=$SPICY_API_KEY \
-- npx --yes --package=@spicyapi/mcp spicyapi-mcp
npx skills add spicyapi-ai/spicy-skill1 行目でツールを、2 行目で Skill を渡します。Skill は使い方の取り決めです——課金の前に見積もりを取り、ローカルファイルはバイト列を貼らずにアップロードし、完成した成果物の URL を推測せずに読む。ほかのクライアントも同じサーバーをそれぞれの設定ファイルから使います。開発者向けページをご覧ください。
npx @spicyapi/cli tasks create --model kling/o3/reference-to-video \
--input-json '{"aspect_ratio":"16:9","duration_seconds":5,"generate_audio":false,"prompt":"A slow aerial shot drifting over a misty pine forest at sunrise","reference_image_urls":["https://example.com/reference.png"],"resolution":"720p","shot_type":"single"}' \
--wait入力は上の例と同じ、このエンドポイント固有のスキーマに従います。--wait はタスクの完了までポーリングして結果を表示します。CI では --yes を追加すると確認を省略できます。先に SPICY_API_KEY を設定してください。API、CLI、MCP サーバーで同じキーを使えます。
npx @spicyapi/cli tasks create --model kling/o3/reference-to-video \
--input-json '{…}' --retention 1h --wait
npx @spicyapi/cli tasks get $TASK_ID # read back the retention that applied--retention は保持期間を短くするだけです——30m、1h、7d、あるいは 0 なら終了と同時に削除。実際に効くのはリクエスト・アカウント設定・プラットフォーム上限のうち最も短い値なので、指定した数値が通った前提で進めず、タスクレコードから読み戻してください。アカウントの許容より長い値を渡しても何も起きません。
ComfyUI Manager か下のコマンドで SpicyAPI ノードをインストールしたら、キャンバスで Kling O3 · Reference to Video を検索してください。このノードにはこのページと同じオプションがあり、実行前に価格が表示されます。
cd ComfyUI/custom_nodes
git clone https://github.com/spicyapi-ai/comfyui-spicyapi埋め込みパネルはこのページと同じスキーマを参照するため、API 仕様とのずれを防げます。ドキュメント内の検索対象にする場合は、/api/embed/models/ の JSON を取得して描画してください。
<iframe src="https://spicyapi.ai/embed/ja/models/kling-o3/api?model=kling%2Fo3%2Freference-to-video" width="100%" height="560" loading="lazy" title="リクエスト例" style="border:1px solid rgba(0,0,0,.12)"></iframe>