# PixVerse V6

> 用首尾帧生成转场，或用参考图生成新场景。支持 720p 和可选原生音频。

- 模型页: https://yir.ai/zh/models/pixverse-v6
- 模型 ID: `pixverse/pixverse-v6`
- 计费：按实际执行渠道的上游计费收取；上游未计费的尝试不收费。

## 价格

同一输出规格下各渠道的当前公开价；官方价为参考。实际按执行渠道计费，故障转移时可能切换渠道。

| 输出规格 | 渠道 | 公开价 |
|---|---|---|
| 无音频 | PixVerse (官方) | $0.04 / 秒 |
| 无音频 | APIMart | $0.032 / 秒 |
| 含音频 | PixVerse (官方) | $0.0533 / 秒 |
| 含音频 | APIMart | $0.04 / 秒 |

## 参数

- 操作: `generate_video`

| 参数 | 可选值 | 默认值 |
|---|---|---|
| `input` | image / reference | image |
| `resolution` | 720p | 720p |
| `aspect_ratio` | auto | auto |
| `duration` | 5 / 8 | 5 |
| `generate_audio` | true / false | false |

## 接入

两种方式任选：新项目用官方 SDK；已按 OpenAI 协议对接的项目换 Base URL 即可。

### 官方 SDK（TypeScript）

SDK 调用 Standard API（https://gateway.yir.ai），支持提交、等待和获取结果，另有 Go SDK。 https://yir.ai/zh/docs/integrations/sdk

```bash
pnpm add @yir-ai/sdk
```

```ts
// Replace https://example.com/your-reference-image.png with your publicly accessible HTTPS image URL.
import { createNodeYirClient } from "@yir-ai/sdk/server";

// Reads YIR_API_KEY from the environment by default: process.env.YIR_API_KEY
const client = createNodeYirClient();

// 1. Submit a video generation job
const job = await client.submitVideo({
  model: "pixverse/pixverse-v6",
  input: {
    type: "image",
    prompt: "一只海龟缓缓游过珊瑚礁，镜头从侧面平稳跟随，阳光穿过清澈海水，在龟背上形成流动的光纹",
    references: [{ role: "first_frame", ...{ url: "https://example.com/your-reference-image.png" } }],
  },
  parameters: {
    duration: 5,
    resolution: "720p",
    aspect_ratio: "auto",
    generate_audio: false,
    n: 1,
  },
});

// 2. Wait for the job to finish and deliver its result
const result = await client.waitForJob(job.id);
console.log("Delivered files:", result.result);
if (result.result && "files" in result.result) {
  for (const file of result.result.files) {
    console.log("->", file.url);
  }
}
```

### OpenAI 兼容 API

OpenAI Images 与 Sora Videos 协议，适用于 OpenAI SDK 和 new-api 等网关；不支持对话。 https://yir.ai/zh/docs/integrations/openai-compatibility

- OpenAI SDK base_url: `https://gateway.yir.ai/openai/v1`
- new-api 渠道 Base URL（渠道类型 OpenAI）: `https://gateway.yir.ai/openai`
- 模型 ID: `pixverse/pixverse-v6`

```bash
# Replace https://example.com/your-reference-image.png with your publicly accessible HTTPS image URL.
curl https://gateway.yir.ai/openai/v1/videos \
  -H "Authorization: Bearer $YIR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "pixverse/pixverse-v6",
    "prompt": "一只海龟缓缓游过珊瑚礁，镜头从侧面平稳跟随，阳光穿过清澈海水，在龟背上形成流动的光纹",
    "resolution": "720p",
    "aspect_ratio": "auto",
    "input_reference": {
      "image_url": "https://example.com/your-reference-image.png"
    },
    "seconds": "5"
  }'
```

## 常见问题

### PixVerse V6 有官方 API 吗？

有。PixVerse 通过自己的官方 API 提供 PixVerse V6。同规格下，Yir 上第三方渠道的公开价最多比官方低 25%（见上表），用一个 Yir API Key 即可全部调用。

## 接入须知

- 使用 Authorization: Bearer $YIR_API_KEY 鉴权；Key 只放服务端环境变量，不进浏览器代码、仓库、提示词或日志。
- 任务是异步的：提交后保存 Job ID，等待终态再读取结果；处理失败与取消。
- 安全重试时复用同一个幂等键和请求，不要在结果未知时盲目重新提交。
- 结果链接是临时的，需要长期保存请自行转存。

## 链接

- [快速开始](https://yir.ai/zh/docs/getting-started/quickstart)
- [API 参考](https://yir.ai/zh/docs/reference)
- [llms.txt](https://yir.ai/llms.txt)
