跳转到主要内容
POST
/
v1
/
videos
/
generations
curl --request POST \
  --url https://toapis.com/v1/videos/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "kling-v3",
    "prompt": "一只金色的猫咪在阳光下的草地上奔跑,慢动作,电影质感",
    "mode": "std",
    "duration": 5,
    "aspect_ratio": "16:9"
  }'
{
  "id": "<string>",
  "object": "<string>",
  "model": "<string>",
  "status": "<string>",
  "created_at": 123
}

Documentation Index

Fetch the complete documentation index at: https://docs.toapis.com/llms.txt

Use this file to discover all available pages before exploring further.

  • 异步任务接口,提交后返回任务 ID
  • 支持文生视频、图生视频、首尾帧
  • mode=std 对应 720P,mode=pro 对应 1080P
  • audio=true 会生成有声视频,并按 Sound 价格计费
  • 文生视频支持 15 秒;图生视频最长 10 秒
请传入公网可访问的图片 URL。不要在 image_urls 中直接传 base64 图片数据;本地图片请先使用 上传图片接口 获取 URL。

认证

Authorization
string
必填
所有接口均需要使用 Bearer Token 认证。
Authorization: Bearer YOUR_API_KEY

请求参数

model
string
必填
视频生成模型名称,固定为 kling-v3
prompt
string
必填
视频提示词。建议描述主体、动作、场景、镜头语言和风格。示例:"一只金色的猫咪在阳光下的草地上奔跑,慢动作,电影质感"
mode
string
默认值:"std"
生成模式,同时决定计费分辨率。
  • std - 标准模式,720P
  • pro - 专业模式,1080P
duration
integer
默认值:"5"
视频时长,单位秒。可选值:51015
15 秒仅文生视频支持;传入 image_urls 的图生视频最长 10 秒。
aspect_ratio
string
默认值:"16:9"
视频宽高比。常用值:16:99:161:1
image_urls
string[]
图片 URL 数组,用于图生视频。
  • 传 1 张:首帧图生视频
  • 传 2 张:首尾帧视频,第一张为首帧,第二张为尾帧
最多支持 2 张。
audio
boolean
默认值:"false"
是否生成有声视频。
  • false - 普通视频
  • true - 有声视频,按 Sound 价格计费
metadata
object
扩展参数。

计费映射

请求参数计费规格
mode=std, audio=false720P
mode=pro, audio=false1080P
mode=std, audio=true720P+Sound
mode=pro, audio=true1080P+Sound

响应

id
string
任务 ID,用于查询任务状态。
object
string
对象类型,通常为 generation.task
model
string
本次请求使用的模型名称。
status
string
任务状态:queuedin_progresscompletedfailed
created_at
integer
任务创建时间戳。

示例

文生视频

{
  "model": "kling-v3",
  "prompt": "一只金色的猫咪在阳光下的草地上奔跑,慢动作,电影质感",
  "mode": "std",
  "duration": 5,
  "aspect_ratio": "16:9"
}

1080P 视频

{
  "model": "kling-v3",
  "prompt": "雨夜东京街头,霓虹灯倒映在湿润地面上,电影镜头",
  "mode": "pro",
  "duration": 10,
  "aspect_ratio": "16:9"
}

图生视频

{
  "model": "kling-v3",
  "prompt": "画面中的人物缓缓转身并微笑",
  "image_urls": ["https://example.com/portrait.jpg"],
  "mode": "std",
  "duration": 5
}

首尾帧

{
  "model": "kling-v3",
  "prompt": "城市从白天自然过渡到夜晚",
  "image_urls": [
    "https://example.com/day.jpg",
    "https://example.com/night.jpg"
  ],
  "mode": "pro",
  "duration": 5
}

有声视频

{
  "model": "kling-v3",
  "prompt": "舞台上的歌手正在演唱,观众欢呼,灯光闪烁",
  "mode": "std",
  "duration": 5,
  "audio": true
}
视频生成为异步任务。提交后使用 获取视频任务状态 查询进度和结果。
curl --request POST \
  --url https://toapis.com/v1/videos/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "kling-v3",
    "prompt": "一只金色的猫咪在阳光下的草地上奔跑,慢动作,电影质感",
    "mode": "std",
    "duration": 5,
    "aspect_ratio": "16:9"
  }'