返回顶部
a

ai-videoAI视频生成

Build and execute skills.video video generation REST requests from OpenAPI specs. Use when user needs to create, debug, or document video generation calls on open.skills.video.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.1
安全检测
已通过
109
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

ai-video

ai-video

概述

使用此技能可将OpenAPI定义转换为skills.video可用的视频生成API调用。优先从openapi.json中确定性提取字段,而非猜测字段。

前置条件

  1. 1. 在https://skills.video/dashboard/developer获取API密钥
  2. 使用技能前配置SKILLSVIDEOAPI_KEY

推荐的OpenClaw配置方式:

  • - 打开ai-video的技能设置
  • 添加名为SKILLSVIDEOAPI_KEY的环境变量
  • 将API密钥粘贴为其值

等效配置格式:

json
{
skills: {
entries: {
ai-video: {
enabled: true,
env: {
SKILLSVIDEOAPIKEY: yourapikeyhere
}
}
}
}
}

其他有效的密钥提供方式:

  • - Shell:export SKILLSVIDEOAPIKEY=yourapikeyhere
  • 工具特定环境配置:任何注入SKILLSVIDEOAPI_KEY的运行时环境

工作流程

  1. 1. 首次使用时检查API密钥并引导环境配置。
  2. 识别当前使用的规范。
  3. 为视频模型选择SSE端点对。
  4. 提取请求模式并生成载荷模板。
  5. 默认执行POST /generation/sse/...并保持流连接。
  6. 若SSE未达到终端完成状态,轮询GET /generation/{id}直至终端状态。
  7. 仅返回终端结果(COMPLETED/SUCCEEDED/FAILED/CANCELED),绝不返回IN_PROGRESS。
  8. 应用重试和失败处理机制。

0) 检查API密钥(首次运行)

在任何API调用前执行此检查。

bash
python scripts/ensureapikey.py

如果ok为false,告知用户:

  • - 按照前置条件中的设置进行操作

示例:

bash
export SKILLSVIDEOAPIKEY=API_KEY>

1) 识别规范

优先加载最具体的OpenAPI规范。
  • - 优先使用模型特定的OpenAPI(例如模型命名空间下的/v1/openapi.json)。
  • 回退到平台级别的openapi.json。
  • 使用references/open-platform-api.md获取基础URL、认证和异步生命周期信息。

2) 选择视频端点

如果docs.json存在,从Videos导航组中推导视频端点。 使用脚本输出的default_endpoints作为主列表(优先SSE)。

bash
python scripts/inspect_openapi.py \
--openapi /abs/path/to/openapi.json \
--docs /abs/path/to/docs.json \
--list-endpoints

当docs.json不可用时,直接传递已知端点(例如/generation/sse/kling-ai/kling-v2.6)。
使用references/video-model-endpoints.md作为快照列表。

3) 提取模式并构建载荷

检查端点详情并从必需/默认字段生成请求模板。

bash
python scripts/inspect_openapi.py \
--openapi /abs/path/to/openapi.json \
--endpoint /generation/sse/kling-ai/kling-v2.6 \
--include-template

使用返回的request_template作为起点。
不添加端点模式未定义的字段。
除非需要显式覆盖,否则使用输出中的defaultcreateendpoint。

4) 执行SSE请求(默认)并自动回退

优先使用辅助脚本。它通过SSE创建并保持流连接;如果流在终端完成前结束,自动切换到轮询回退。

bash
python scripts/createandwait.py \
--sse-endpoint /generation/sse/kling-ai/kling-v2.6 \
--payload {prompt:A cinematic dolly shot of neon city rain at night} \
--poll-timeout 900 \
--poll-interval 3

将SSE视为默认结果通道。
不要在INQUEUE或INPROGRESS状态时完成任务。
仅在终端结果后返回。

5) 回退到轮询

仅在SSE无法建立、过早断开或未达到终端状态时使用轮询。 使用GET /generation/{id}(如果OpenAPI使用/v1/...路径,则使用模型特定的等效路径)。

bash
curl -X GET https://open.skills.video/api/v1/generation/ \
-H Authorization: Bearer $SKILLSVIDEOAPI_KEY

在以下终端状态停止轮询:

  • - COMPLETED
  • FAILED
  • CANCELED

推荐辅助脚本:

bash
python scripts/wait_generation.py \
--generation-id \
--timeout 900 \
--interval 3

仅在辅助脚本发出event=terminal后返回给用户。

6) 处理错误和重试

处理创建、SSE和回退轮询操作的以下响应码:
  • - 400:请求格式问题
  • 401:API密钥缺失/无效
  • 402:运行时可能的支付/积分问题
  • 404:端点或生成ID未找到
  • 422:模式验证失败

使用以下命令分类非2xx运行时错误:

bash
python scripts/handleruntimeerror.py \
--status \
--body ERROR
BODYJSONOR_TEXT>

如果类别为insufficient_credits,告知用户充值:

  • - 打开https://skills.video/dashboard并进入账单/积分页面
  • 充值或购买额外积分
  • 充值后重试

可选余额检查:

bash
curl -X GET https://open.skills.video/api/v1/credits \
-H Authorization: Bearer $SKILLSVIDEOAPI_KEY

仅对瞬态条件(网络故障或临时5xx)应用重试。
使用有界指数退避(例如1s、2s、4s,最大16s,然后失败)。
在4xx验证错误后不重试未更改的载荷。

速率限制和超时

除非活动OpenAPI或产品文档中明确说明,否则将速率限制和服务器端超时窗口视为未知。 如果未知,在输出中明确说明并选择保守的客户端默认值。

资源

  • - scripts/ensureapikey.py:验证SKILLSVIDEOAPIKEY并显示首次运行设置指南
  • scripts/handleruntimeerror.py:分类运行时错误并为积分不足提供充值指南
  • scripts/inspectopenapi.py:提取SSE/轮询端点对、合约和载荷模板
  • scripts/createandwait.py:通过SSE创建并在流未达到终端状态时自动回退到轮询
  • scripts/wait_generation.py:轮询生成状态直至终端完成并返回最终响应
  • references/open-platform-api.md:SSE优先生命周期、回退轮询、重试基线
  • references/video-model-endpoints.md:来自docs.json的当前视频端点快照

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 gen-video-1776057132 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 gen-video-1776057132 技能

通过命令行安装

skillhub install gen-video-1776057132

下载

⬇ 下载 ai-video v1.0.1(免费)

文件大小: 17.44 KB | 发布时间: 2026-4-14 13:57

v1.0.1 最新 2026-4-14 13:57
- Skill renamed from "video-generation" to "ai-video"
- Added explicit license information (MIT) and metadata including author, supported OS, required environment variables, and setup help
- Expanded setup and prerequisites instructions for configuring `SKILLS_VIDEO_API_KEY` via OpenClaw or environment variables
- Clarified API key setup in the first-run check section and linked to the expanded prerequisites
- Provided OpenClaw-specific configuration examples and instructions for adding environment variables

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部