Skills

图像与视频生成

在 Claude Code 中通过自然语言直接生成 AI 图像和视频。

概述

VibeVideo Claude Code Skill 让你在 Claude Code 中使用自然语言提示直接生成 AI 图像和视频。无需安装,只需一个 API Key。

前提条件

  • VibeVideo API Key — 在 Dashboard → Settings → API Keys 中创建
  • 已安装 Claude Code(claude.ai/code

配置步骤

  1. 设置环境变量:
export VIBEVIDEO_API_KEY="your-api-key-here"
  1. 将 Skill 文件保存到项目的 .claude/skills/ 目录:
mkdir -p .claude/skills/vibevideo-generate
  1. 创建 .claude/skills/vibevideo-generate/SKILL.md — 从 SKILL.md 源文件 复制内容

使用方式

配置完成后,直接用自然语言对 Claude Code 说:

  • "生成一张猫坐在彩虹上的图片"
  • "创建一个 5 秒的日落海浪视频"
  • "有哪些图像模型?"

工作原理

Skill 通过 curl 调用 VibeVideo REST API:

  1. 创建任务POST /api/ai/generate,传入提示词、模型和参数
  2. 轮询状态POST /api/ai/query,每 5 秒查询一次直到完成
  3. 返回结果 — 从 taskUrls 获取媒体 URL

认证使用 Authorization: Bearer <API_KEY> 请求头。每次生成扣除积分,与网页端一致。

生成图片

curl -s -X POST ${VIBEVIDEO_BASE_URL:-https://vibevideo.app}/api/ai/generate \
  -H "Authorization: Bearer $VIBEVIDEO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "mediaType": "image",
    "scene": "text-to-image",
    "model": "nano-banana-2",
    "prompt": "A cat sitting on a rainbow",
    "options": {
      "aspect_ratio": "1:1",
      "quality": "2K"
    }
  }'

图生图请设置 "scene": "image-to-image" 并在 options 中添加 "image_url"

生成视频

curl -s -X POST ${VIBEVIDEO_BASE_URL:-https://vibevideo.app}/api/ai/generate \
  -H "Authorization: Bearer $VIBEVIDEO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "mediaType": "video",
    "scene": "text-to-video",
    "model": "seedance-2-0",
    "prompt": "A dog playing in a park",
    "options": {
      "resolution": "720p",
      "duration": "5s",
      "aspect_ratio": "16:9"
    }
  }'

图生视频请设置 "scene": "image-to-video" 并在 options 中添加 "image_url"。 首尾帧生成视频请添加 "start_image_url""end_image_url"

查询任务状态

任务为异步执行,轮询直到状态为 successfailedcanceled

curl -s -X POST ${VIBEVIDEO_BASE_URL:-https://vibevideo.app}/api/ai/query \
  -H "Authorization: Bearer $VIBEVIDEO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "taskId": "YOUR_TASK_ID" }'

计算费用

生成前查询所需积分:

curl -s -X POST ${VIBEVIDEO_BASE_URL:-https://vibevideo.app}/api/ai/cost \
  -H "Authorization: Bearer $VIBEVIDEO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "seedance-2-0",
    "mediaType": "video",
    "scene": "text-to-video",
    "options": { "resolution": "720p", "duration": "5s" }
  }'

取消任务

curl -s -X DELETE ${VIBEVIDEO_BASE_URL:-https://vibevideo.app}/api/ai/tasks/YOUR_TASK_ID \
  -H "Authorization: Bearer $VIBEVIDEO_API_KEY"

图像模型

ID标签厂商场景画质选项
nano-banana-2Nano Banana 2Googletext-to-image, image-to-image1K, 2K, 4K
gpt-image-1-5GPT Image 1.5OpenAItext-to-image, image-to-imageMedium, High
grok-imagineGrok ImagineGroktext-to-image, image-to-image
seedream-5-0Seedream 5.0ByteDancetext-to-image, image-to-imageBasic, High
qwen-imageQwen ImageQwentext-to-image, image-to-image
wan-2-7-imageWan 2.7 ImageQwen/Alibabatext-to-image, image-to-image1K, 2K
wan-2-7-image-proWan 2.7 Image ProQwen/Alibabatext-to-image, image-to-image1K, 2K, 4K

text-to-image 默认模型:nano-banana-2

视频模型

ID标签厂商场景分辨率时长
seedance-2-0Seedance 2.0ByteDancetext-to-video, image-to-video, frames-to-video, reference-to-video720p, 1080p5s, 10s, 15s
seedance-2-0-fastSeedance 2.0 FastByteDancetext-to-video, image-to-video, frames-to-video, reference-to-video720p, 1080p5s, 10s, 15s
seedance-1-5-proSeedance 1.5 ProByteDancetext-to-video, image-to-video480p, 720p, 1080p4s, 8s, 12s
grok-imagineGrok ImagineGroktext-to-video, image-to-video480p, 720p6s, 10s, 15s
kling-2-6Kling 2.6Klingtext-to-video, image-to-video5s, 10s
runwayRunwayRunwaytext-to-video, image-to-video720p, 1080p5s, 10s
veo-3-1Veo 3.1Googletext-to-video, image-to-video, frames-to-video, reference-to-video720p, 1080p, 4k
veo-3-1-fastVeo 3.1 FastGoogletext-to-video, image-to-video, frames-to-video, reference-to-video720p, 1080p, 4k
seedence-1-0-proSeedence 1.0 ProByteDancetext-to-video, image-to-video480p, 720p, 1080p5s, 10s
seedence-1-0-pro-fastSeedence 1.0 Pro FastByteDanceimage-to-video720p, 1080p5s, 10s
seedence-1-0-liteSeedence 1.0 LiteByteDancetext-to-video, image-to-video480p, 720p, 1080p5s, 10s

text-to-video 默认模型:seedance-2-0

错误处理

错误码消息解决方案
-1"no auth"设置 VIBEVIDEO_API_KEY 环境变量
-1002"insufficient credits"在 VibeVideo 后台购买积分
-1"invalid..."检查模型 ID、场景或媒体类型是否正确

API 响应格式

所有接口返回:

{ "code": 0, "message": "ok", "data": { ... } }

code: 0 表示成功,非零 code 表示错误(查看 message)。

On this page