# see2ai_video_generation_kling_3_0_v1

> AI 视频生成服务，基于 SEE2AI 高精度视频生成引擎 模型，支持文生视频、图生视频（通过 image_urls 支持单图和首尾帧）以及多镜头生成

## 📖 接入指引

**Endpoint**: `POST /api/v1/actions/see2ai_video_generation_kling_3_0_v1`

**认证方式**: Bearer Token (租户 API Key)

> **⚠️ 重要提示**
> 
> 本 API 是 SEE2AI 平台封装后的接口，**参数格式与上游官方（如火山引擎、OpenAI等）API 不同**。
> 请直接使用下方 Schema 中定义的参数，无需参考官方文档。
> 
> *例如：*
> *- 文本模型参数可能是 `query` 而不是 `messages` 数组*
> *- 视频模型参数可能是 `brief` (创意简报) 而不是复杂的配置项*

## 📥 输入参数 (Input Schema)

```json
{
  "description": "AI视频生成输入参数模型",
  "properties": {
    "prompt": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "描述想要生成的视频的文本提示词。当 multi_shots 为 false 时生效。",
      "title": "Prompt"
    },
    "image_urls": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "maxItems": 2,
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": [],
      "description": "输入的参考图片 URL 列表（支持首尾帧，图生视频必填）。注意：只接受公网 URL。如果长度为1，则作为首帧；长度为2，则作为首尾帧。",
      "title": "Image Urls"
    },
    "sound": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": false,
      "description": "是否开启音效。",
      "title": "Sound"
    },
    "duration": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": "5",
      "description": "生成视频的时长（秒），支持 3 到 15。",
      "examples": [
        "5",
        "10",
        "15"
      ],
      "title": "Duration"
    },
    "aspect_ratio": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": "16:9",
      "description": "生成视频的宽高比。提供 image_urls 时可选，系统将自动适配。",
      "examples": [
        "16:9",
        "9:16",
        "1:1"
      ],
      "title": "Aspect Ratio"
    },
    "mode": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": "pro",
      "description": "生成模式，std（标准分辨率）或 pro（高分辨率）。",
      "examples": [
        "std",
        "pro"
      ],
      "title": "Mode"
    },
    "multi_shots": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": false,
      "description": "是否启用多镜头模式。",
      "title": "Multi Shots"
    },
    "multi_prompt": {
      "anyOf": [
        {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": [],
      "description": "多镜头模式下的分镜提示词数组，每个元素包含 prompt 和 duration。",
      "title": "Multi Prompt"
    },
    "kling_elements": {
      "anyOf": [
        {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": [],
      "description": "引用元素列表。每个元素包含 name (如 element_dog), description, 和 element_input_urls (2-4个图片URL)。在 prompt 中通过 @element_dog 引用。",
      "title": "Kling Elements"
    },
    "callBackUrl": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "可选的回调 URL，用于在生成任务完成时接收包含生成结果的 POST 请求。",
      "title": "Callbackurl"
    }
  },
  "title": "VideoGenerationInput",
  "type": "object"
}
```

### 参数说明

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| `prompt` | string | ❌ 否 | `-` | 描述想要生成的视频的文本提示词。当 multi_shots 为 false 时生效。 |
| `image_urls` | string | ❌ 否 | `[]` | 输入的参考图片 URL 列表（支持首尾帧，图生视频必填）。注意：只接受公网 URL。如果长度为1，则作为首帧；长度为2，则作为首尾帧。 |
| `sound` | string | ❌ 否 | `False` | 是否开启音效。 |
| `duration` | string | ❌ 否 | `5` | 生成视频的时长（秒），支持 3 到 15。 |
| `aspect_ratio` | string | ❌ 否 | `16:9` | 生成视频的宽高比。提供 image_urls 时可选，系统将自动适配。 |
| `mode` | string | ❌ 否 | `pro` | 生成模式，std（标准分辨率）或 pro（高分辨率）。 |
| `multi_shots` | string | ❌ 否 | `False` | 是否启用多镜头模式。 |
| `multi_prompt` | string | ❌ 否 | `[]` | 多镜头模式下的分镜提示词数组，每个元素包含 prompt 和 duration。 |
| `kling_elements` | string | ❌ 否 | `[]` | 引用元素列表。每个元素包含 name (如 element_dog), description, 和 element_input_urls (2-4个图片URL)。在 prompt 中通过 @element_dog 引用。 |
| `callBackUrl` | string | ❌ 否 | `-` | 可选的回调 URL，用于在生成任务完成时接收包含生成结果的 POST 请求。 |

## 📤 输出结果 (Output Schema)

```json
{
  "description": "AI视频生成输出参数模型",
  "properties": {
    "input_tokens": {
      "default": 0,
      "description": "输入消耗的词元数量",
      "title": "Input Tokens",
      "type": "integer"
    },
    "output_tokens": {
      "default": 0,
      "description": "输出消耗的词元数量",
      "title": "Output Tokens",
      "type": "integer"
    },
    "total_tokens": {
      "default": 0,
      "description": "总消耗的词元数量",
      "title": "Total Tokens",
      "type": "integer"
    },
    "model": {
      "default": "",
      "description": "实际使用的模型名称（由各 action 显式填写）",
      "title": "Model",
      "type": "string"
    },
    "source": {
      "default": "",
      "description": "模型提供商（由各 action 显式填写）",
      "title": "Source",
      "type": "string"
    },
    "cost_points": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "预先计算的扣费词元（如果插件内部已经计算好费用，则直接使用此值，忽略基于词元的计算）",
      "title": "Cost Points"
    },
    "result_urls": {
      "default": [],
      "description": "生成的视频 URL 列表",
      "items": {
        "type": "string"
      },
      "title": "Result Urls",
      "type": "array"
    },
    "task_id": {
      "description": "生成任务的 ID",
      "title": "Task Id",
      "type": "string"
    },
    "cost_time": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "生成耗时（毫秒）",
      "title": "Cost Time"
    },
    "state": {
      "description": "任务最终状态",
      "title": "State",
      "type": "string"
    },
    "provider_config_id": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "供应商配置 ID（用于追溯）",
      "title": "Provider Config Id"
    }
  },
  "required": [
    "task_id",
    "state"
  ],
  "title": "VideoGenerationOutput",
  "type": "object"
}
```

### 输出字段说明

| 字段名 | 类型 | 说明 |
|--------|------|------|
| `input_tokens` | integer | 输入消耗的词元数量 |
| `output_tokens` | integer | 输出消耗的词元数量 |
| `total_tokens` | integer | 总消耗的词元数量 |
| `model` | string | 实际使用的模型名称（由各 action 显式填写） |
| `source` | string | 模型提供商（由各 action 显式填写） |
| `cost_points` | string | 预先计算的扣费词元（如果插件内部已经计算好费用，则直接使用此值，忽略基于词元的计算） |
| `result_urls` | array | 生成的视频 URL 列表 |
| `task_id` | string | 生成任务的 ID |
| `cost_time` | string | 生成耗时（毫秒） |
| `state` | string | 任务最终状态 |
| `provider_config_id` | string | 供应商配置 ID（用于追溯） |

## 💡 调用示例

### cURL 示例

```bash
curl -X POST "https://see2ai.com/api/v1/actions/see2ai_video_generation_kling_3_0_v1" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer sk-your-tenant-api-key" \
     -d '{
  "prompt": "示例值",
  "image_urls": "https://example.com/image.jpg",
  "sound": "示例值",
  "duration": "示例值",
  "aspect_ratio": "https://example.com/image.jpg",
  "mode": "示例值",
  "multi_shots": "示例值",
  "multi_prompt": "示例值",
  "kling_elements": "示例值",
  "callBackUrl": "示例值"
}'
```

### Python 示例

```python
import requests

API_KEY = "sk-your-tenant-api-key"
ENDPOINT = "https://see2ai.com/api/v1/actions/see2ai_video_generation_kling_3_0_v1"

headers = {
    "Content-Type": "application/json",
    "Authorization": f"Bearer {API_KEY}"
}

payload = {
  "prompt": "\u793a\u4f8b\u503c",
  "image_urls": "https://example.com/image.jpg",
  "sound": "\u793a\u4f8b\u503c",
  "duration": "\u793a\u4f8b\u503c",
  "aspect_ratio": "https://example.com/image.jpg",
  "mode": "\u793a\u4f8b\u503c",
  "multi_shots": "\u793a\u4f8b\u503c",
  "multi_prompt": "\u793a\u4f8b\u503c",
  "kling_elements": "\u793a\u4f8b\u503c",
  "callBackUrl": "\u793a\u4f8b\u503c"
}

response = requests.post(ENDPOINT, json=payload, headers=headers)
result = response.json()

print(f"结果：{result}")
```

## 💰 计费说明

> 按生成时长、模式（std/pro）和是否带音频动态计费

**注意**: 所有费用都以词元为单位，系统会自动从租户余额中扣除。

## ⚠️ 常见错误码

| HTTP 状态码 | 错误原因 | 解决方案 |
| --- | --- | --- |
| `400` | 参数错误，如缺失 prompt 或无效的时长 | 请稍后重试 |
| `401` | API Key 无效或未授权 | 检查 API Key 是否正确，或联系管理员充值 |
| `402` | 账号余额不足 | 请稍后重试 |
| `429` | 请求超限，达到速率限制 | 降低请求频率，或联系管理员调整限流配置 |
| `500` | 上游服务器内部错误或生成失败 | 稍后重试，如持续失败请联系技术支持 |
| `504` | 任务轮询超时（例如任务处理超过指定时间限制） | 请稍后重试 |

## 📞 技术支持

- **文档问题**: 查看 [SEE2AI 官方文档](https://see2ai.com/docs)
- **API 状态**: 访问 [服务状态页面](https://see2ai.com/status)
- **问题反馈**: 联系技术支持团队

---

**API 版本**: see2ai_video_generation_kling_3_0_v1
**最后更新**: 2026-03-23
