Skip to content

文生视频 ​

接口与可灵官网一致;详细字段以官方文档为准

  • 路径 POST /kling/v1/videos/text2video
  • 与官网一致:本页所有请求体、字段命名与返回结构与可灵官网保持一致
  • 字段详解:请参考官网权威文档

请求参数

参数类型必填说明
model_namestring否模型名称,默认 kling-v1。可选:kling-video-o1、kling-v1、kling-v1-5、kling-v1-6、kling-v2-master、kling-v2-1、kling-v2-1-master、kling-v2-5-turbo、kling-v2-6、kling-v3
promptstring是正向文本提示词
negative_promptstring否负向文本提示词
cfg_scalenumber否生成自由度 [0, 1],仅 kling-v1/kling-v1-5/kling-v1-6 支持
soundstring否是否生成声音:on/off(仅 kling-v2-6 支持)
modestring否生成模式:std(标准)、pro(专业),默认 std
camera_controlobject否摄像机运动控制,详见下方说明
aspect_ratiostring否画面纵横比:16:9、9:16、1:1,默认 16:9
durationstring否视频时长:5(5秒)、10(10秒),默认 5
watermark_infoobject否是否生成含水印结果
callback_urlstring否回调通知地址
external_task_idstring否自定义任务ID(幂等控制)

摄像机控制

json
{
  "camera_control": {
    "type": "simple",  // simple, down_back, forward_up, right_turn_forward, left_turn_forward
    "config": {        // type=simple 时必填
      "horizontal": 5  // 水平运镜 [-10, 10]
      // 其他可选:vertical, pan, tilt, roll, zoom(只能有一个非零)
    }
  }
}

补充约束

  • prompt 不能超过 2500 字符。
  • cfg_scale 仅 kling-v1/kling-v1-5/kling-v1-6 支持,kling-v2 系列不支持。
  • camera_control.type=simple 时,config 只能有一个字段为非零值,其余必须为 0。
  • 历史输入 kling-v2-5 会归一为 kling-v2-5-turbo;对外展示和渠道自动填充使用 canonical 模型名。
  • kling-v3-omni 请使用 Omni 视频入口 /kling/v1/videos/omni-video。
  • Kling 3.0 Turbo 暂未确认官方可调用 schema,当前不放行。

场景一:简单文生视频 ​

bash
curl --request POST \
  --url https://aiapi.fhddos.com/kling/v1/videos/text2video \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model_name": "kling-v1",
    "prompt": "A man picks up a book, then reads with focused expression.",
    "mode": "std",
    "duration": "5",
    "aspect_ratio": "16:9"
  }'

示例响应(创建任务)

json
{
  "code": 0,
  "message": "success",
  "request_id": "req_1735558800_abc123",
  "data": {
    "task_id": "task_01JGHK...",
    "task_status": "submitted",
    "created_at": 1735558800000,
    "updated_at": 1735558800000
  }
}

场景二:带摄像机运镜 ​

bash
curl --request POST \
  --url https://aiapi.fhddos.com/kling/v1/videos/text2video \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model_name": "kling-v2-master",
    "prompt": "Sunset over mountains, golden light spreading across valleys",
    "mode": "pro",
    "duration": "10",
    "aspect_ratio": "16:9",
    "camera_control": {
      "type": "forward_up"
    }
  }'

场景三:V2.6 声音控制 ​

bash
curl --request POST \
  --url https://aiapi.fhddos.com/kling/v1/videos/text2video \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model_name": "kling-v2-6",
    "prompt": "A calm ocean scene with gentle waves",
    "mode": "std",
    "duration": "5",
    "aspect_ratio": "16:9",
    "sound": "on"
  }'

任务状态说明

状态含义
submitted已提交
processing处理中
succeed成功
failed失败

OpenAPI ​

yaml
openapi: 3.0.3
info:
  title: Fhddos Core API
  version: '1.0'
  description: >-
    Core OpenAI-compatible and model-family endpoints used by the Fhddos user
    docs.
servers:
  - url: https://aiapi.fhddos.com
security:
  - BearerAuth: []
paths:
  /kling/v1/videos/text2video:
    post:
      tags:
        - Kling
      summary: Kling text to video
      requestBody:
        $ref: '#/components/requestBodies/JsonObject'
      responses:
        '200':
          $ref: '#/components/responses/JsonObject'
components:
  requestBodies:
    JsonObject:
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/GenericObject'
  responses:
    JsonObject:
      description: OK
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/GenericObject'
  schemas:
    GenericObject:
      type: object
      additionalProperties: true
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: 'Authorization: Bearer <token>'

Fhddos AI 用户文档