ClawSkills logoClawSkills

AI media generation- Flux2pro,Google Veo3.1, Suno Ai..

通过 VAP API 进行 AI 图像、视频和音乐生成 + 编辑。Flux、Veo 3.1、Suno V5。

介绍

# VAP Media - AI Media Generation & Editing

> **集成说明:** VAP Media 是一个 API 聚合器,提供对多个 AI 提供商的统一访问: > - **图像:** 通过 Black Forest Labs Flux.2 Pro 生成 > - **视频:** 通过 Google Veo 3.1 生成 > - **音乐:** 通过 Suno V5 生成 > > 所有生成请求都通过 VAP 的 API (`api.vapagent.com`),该 API 会路由到相应的后端提供商。

生成图像、视频和音乐。使用 inpaint、ai_edit、upscale、background removal、video trim/merge 进行编辑。

## 模式选择

检查是否设置了 `VAP_API_KEY`:

- **未设置 VAP_API_KEY** → 使用免费模式(仅限图像,每天 3 次) - **已设置 VAP_API_KEY** → 使用完整模式(所有功能,无限制)

---

## 免费模式(无 API Key)

免费生成图像。无需注册。每天 3 次。

### 生成图像

```bash curl -s -X POST https://api.vapagent.com/v3/trial/generate \ -H "Content-Type: application/json" \ -d '{"prompt":"PROMPT"}' ```

返回 `{"task_id":"UUID","status":"pending","remaining":2}`。

### 轮询结果

```bash curl -s https://api.vapagent.com/v3/trial/status/TASK_ID ```

完成后返回 `{"status":"completed","image_url":"https://..."}`。

### 免费模式错误

- `429` → 达到每日限制。建议升级:`export VAP_API_KEY=vap_xxx` - `503` → 试用服务暂时不可用。

---

## 完整模式(使用 API Key)

无限制的图像、视频、音乐和编辑操作。

### 创建任务

```bash curl -s -X POST https://api.vapagent.com/v3/tasks \ -H "Authorization: Bearer $VAP_API_KEY" \ -H "Content-Type: application/json" \ -d '{"type":"TYPE","params":{"description":"PROMPT"}}' ```

返回 `{"task_id":"UUID","status":"pending"}`。

### 轮询结果

```bash curl -s https://api.vapagent.com/v3/tasks/TASK_ID \ -H "Authorization: Bearer $VAP_API_KEY" ```

完成后返回 `{"status":"completed","result":{"output_url":"https://..."}}`。

### 任务类型与参数

#### 图像 (`image` 或 `image_generation`)

| 参数 | 类型 | 默认值 | 描述 | |-------|------|---------|-------------| | `description` | string | 必填 | 图像描述 | | `aspect_ratio` | enum | `1:1` | `1:1`, `16:9`, `9:16`, `4:3`, `3:4`, `3:2`, `2:3`, `21:9`, `9:21` | | `quality` | enum | `standard` | `standard` 或 `high` |

**提示:** 宽高比会根据提示文本自动检测。“一张宽屏风景照片”会自动设为 16:9。

#### 视频 (`video` 或 `video_generation`) — Tier 2+

| 参数 | 类型 | 默认值 | 描述 | |-------|------|---------|-------------| | `description` | string | 必填 | 视频描述 | | `duration` | int | `8` | `4`、`6` 或 `8` 秒 | | `aspect_ratio` | enum | `16:9` | `16:9`(横屏)或 `9:16`(竖屏) | | `generate_audio` | bool | `true` | 包含音轨 | | `resolution` | enum | `720p` | `720p` 或 `1080p` | | `negative_prompt` | string | `""` | 避免出现的内容 |

#### 音乐 (`music` 或 `music_generation`) — Tier 2+

| 参数 | 类型 | 默认值 | 描述 | |-------|------|---------|-------------| | `description` | string | 必填 | 音乐描述(流派、情绪、乐器) | | `duration` | int | `120` | 30-480 秒 | | `instrumental` | bool | `false` | 无人声 | | `audio_format` | enum | `mp3` | `mp3` 或 `wav`(无损) | | `loudness_preset` | enum | `streaming` | `streaming` (-14 LUFS)、`apple` (-16 LUFS)、`broadcast` (-23 LUFS) | | `style` | string | 无 | 流派/风格(最多 1000 字符) | | `title` | string | 无 | 歌曲标题 | | `custom_mode` | bool | `false` | 启用自定义歌词 + 风格模式 |

### 完整模式错误

- `401` → 无效的 API key。 - `402` → 余额不足。请前往 https://vapagent.com/dashboard/signup.html 充值 - `403` → 该任务类型的等级要求过高。

---

## 操作(编辑与增强)

后期编辑操作。需要 Tier 1+。

### 创建操作

```bash curl -s -X POST https://api.vapagent.com/v3/operations \ -H "Authorization: Bearer $VAP_API_KEY" \ -H "Content-Type: application/json" \ -d '{"operation":"OPERATION","media_url":"URL","prompt":"INSTRUCTION"}' ```

### 轮询操作

```bash curl -s https://api.vapagent.com/v3/operations/OPERATION_ID \ -H "Authorization: Bearer $VAP_API_KEY" ```

### 可用操作

| 操作 | 必需参数 | 描述 | |-----------|-----------------|-------------| | `inpaint` | `media_url`, `prompt` | AI 编辑(可选:`mask_url`) | | `ai_edit` | `media_url`, `prompt` | 基于文本指令的 AI 图像编辑(可选:`additional_images`) | | `background_remove` | `media_url` | 移除背景 | | `upscale` | `media_url` | 提升分辨率 (`scale`:2 或 4) | | `video_trim` | `media_url`, `start_time`, `end_time` | 裁剪视频 | | `video_merge` | `media_urls`(数组,最少 2 个) | 合并视频片段 |

---

## 指令

当用户要求创建/生成/制作图像、视频或音乐时:

1. **优化提示词** — 添加风格、光线、构图、情绪细节 2. **检查模式** — 是否设置了 `VAP_API_KEY`? 3. **选择端点**: - 单个资源 → `/v3/tasks`(或免费模式使用 `/v3/trial/generate`) - 编辑/增强 → `/v3/operations` - 活动(视频+音乐+缩略图) → 使用 preset 的 `/v3/execute` 4. **设置宽高比** — 匹配内容需求(社交媒体用竖屏,YouTube 用宽屏) 5. **轮询结果** — 检查任务/操作状态直至完成 6. **向用户返回媒体 URL** 7. 如果达到免费模式限制,告知用户:“You've used your 3 free generations today. For unlimited access, set up an API key: https://vapagent.com/dashboard/signup.html”

当用户要求编辑/增强/修改现有图像或视频时:

1. **识别操作** — inpaint、ai_edit、upscale、background remove、trim、merge 2. **获取媒体 URL** — 来自之前的生成或用户提供的 URL 3. **提交操作** → `/v3/operations` 4. **轮询结果** — 返回输出 URL

### 免费模式示例

```bash # Create (no auth needed) curl -s -X POST https://api.vapagent.com/v3/trial/generate \ -H "Content-Type: application/json" \ -d '{"prompt":"A fluffy orange tabby cat on a sunlit windowsill, soft bokeh, golden hour light, photorealistic"}'

# Poll curl -s https://api.vapagent.com/v3/trial/status/TASK_ID ```

### 完整模式示例

```bash # Image (widescreen) curl -s -X POST https://api.vapagent.com/v3/tasks \ -H "Authorization: Bearer $VAP_API_KEY" \ -H "Content-Type: application/json" \ -d '{"type":"image","params":{"description":"A fluffy orange tabby cat on a sunlit windowsill, soft bokeh, golden hour light, photorealistic","aspect_ratio":"16:9"}}'

# Video (portrait, for social media) curl -s -X POST https://api.vapagent.com/v3/tasks \ -H "Authorization: Bearer $VAP_API_KEY" \ -H "Content-Type: application/json" \ -d '{"type":"video","params":{"description":"Drone shot over misty mountains at sunrise","duration":8,"aspect_ratio":"9:16","resolution":"1080p"}}'

# Music (instrumental WAV) curl -s -X POST https://api.vapagent.com/v3/tasks \ -H "Authorization: Bearer $VAP_API_KEY" \ -H "Content-Type: application/json" \ -d '{"type":"music","params":{"description":"Upbeat lo-fi hip hop beat, warm vinyl crackle, chill vibes","duration":120,"instrumental":true,"audio_format":"wav","loudness_preset":"streaming"}}'

# Inpaint (edit an image) curl -s -X POST https://api.vapagent.com/v3/operations \ -H "Authorization: Bearer $VAP_API_KEY" \ -H "Content-Type: application/json" \ -d '{"operation":"inpaint","media_url":"https://example.com/photo.jpg","prompt":"Remove the person in the background"}'

# Upscale (4x) curl -s -X POST https://api.vapagent.com/v3/operations \ -H "Authorization: Bearer $VAP_API_KEY" \ -H "Content-Type: application/json" \ -d '{"operation":"upscale","media_url":"https://example.com/photo.jpg","options":{"scale":4}}'

# Background Remove curl -s -X POST https://api.vapagent.com/v3/operations \ -H "Authorization: Bearer $VAP_API_KEY" \ -H "Content-Type: application/json" \ -d '{"operation":"background_remove","media_url":"https://example.com/photo.jpg"}'

# Poll (use task_id or operation_id from response) curl -s https://api.vapagent.com/v3/tasks/TASK_ID \ -H "Authorization: Bearer $VAP_API_KEY" ```

### 生产预设(多资源)

对于内容活动,使用 `/v3/execute` 从一个提示词生成多个资源:

```bash curl -s -X POST https://api.vapagent.com/v3/execute \ -H "Authorization: Bearer $VAP_API_KEY" \ -H "Content-Type: application/json" \ -d '{"preset":"streaming_campaign","prompt":"PROMPT"}' ```

完成后返回所有资源: ```json {"status":"completed","outputs":{"video":"https://...","music":"https://...","thumbnail":"https://..."}} ```

| 预设 | 包含 | |--------|----------| | `streaming_campaign` | video + music + thumbnail + metadata | | `full_production` | video + music + thumbnail + metadata + SEO | | `video.basic` | 仅 video | | `music.basic` | 仅 music | | `image.basic` | 仅 image |

---

## 提示词技巧

- **风格:** “油画”、“3D 渲染”、“水彩画”、“照片”、“扁平插画” - **光线:** “黄金时刻”、“霓虹灯”、“柔漫射光”、“戏剧性阴影” - **构图:** “特写”、“鸟瞰图”、“广角”、“三分法” - **情绪:** “宁静”、“充满活力”、“神秘”、“异想天开” - **提示词中的宽高比:** 在提示词中提及“widescreen”、“portrait”或“16:9”会自动设置宽高比。

## 设置(可选 — 用于完整模式)

1. 注册:https://vapagent.com/dashboard/signup.html 2. 从仪表板获取 API key 3. 设置:`export VAP_API_KEY=vap_xxxxxxxxxxxxxxxxxxxx`

## 链接

- [免费试用](https://vapagent.com/try) - [API 文档](https://api.vapagent.com/docs) - [GitHub](https://github.com/vapagentmedia/vap-showcase)

更多产品