# G 视频生成 API Documentation

> 多模态图像和视频生成模型，可以将文本或图像转换为短视频，具有流畅的动态效果和同步音频。

## Overview

This document describes how to call the **G 视频生成** API.

- **Model / path slug**: `video/grok`
- **Task type**: `async` (`sync` = synchronous, `async` = create task then poll / callback)
- **HTML docs**: `/doc/15`

## Authentication

All API requests require your platform API key as the query parameter `key`:

```
?key=YOUR_API_KEY
```

Get API Key:
1. Sign in to the console
2. Open [API Key Management](/user/key) and create or copy your key
3. Append `key=YOUR_API_KEY` to the request URL (or pass it in form/JSON when the endpoint accepts it)

---

## API Information

- **URL**: `POST https://apis.xiaobao.ink/api/video/grok`
- **Content-Type**: `application/json` (request body commonly `application/json` or `application/x-www-form-urlencoded` for POST)
- **HTTP Method**: `POST`

### Request Parameters

| Parameter | Required | Description |
|-----------|----------|-------------|
| `callBackUrl` | Yes | https://your-domain.com/api/callback |
| `prompt` | Yes | A couple of doors open to the right one by one randomly and stay open, to show the inside, each is either a living room, or a kitchen, or a bedroom or an office, with little people living inside. |
| `aspect_ratio` | Yes | 2:3 |
| `image_urls` | Yes | [url] |
| `duration` | Yes | 6 |
| `resolution` | Yes | 480p |

> **Note**: `key` (API key) is required for authenticated calls even if omitted from the parameter list above.

### Request Example

```
https://apis.xiaobao.ink/api/video/grok?key=你的密钥
```

## Details

## 请求HEADER：

| 名称 | 值 |
| --- | --- |
| Content-Type | application/json |

## 请求参数说明：

| 名称 | 必填 | 类型 | 示例值 | 说明 |
| --- | --- | --- | --- | --- |
| key | 是 | string | 35kj5jnlj53453kl5j43nj5 | 接口密钥,在控制台->密钥管理查看 |
| prompt | 是 | string | 一只手从画面中伸进来，递给女孩一杯外带咖啡。女孩走出画面，看起来很疲惫，然后接过咖啡，高兴地说：“谢谢！回去工作了。”说完，她走出画面，径直走向办公室的另一个区域。 | 描述期望视频运动的文本提示。 |
| duration | 是 | number | 6 | 生成的视频时长（秒）（6-30）。（最小值：6，最大值：30，步长：1） |
| resolution | 否 | string | 480p | 生成视频的分辨率。480p、720p |
| aspect_ratio | 否 | string | 16:9 | 图像比例选择，仅适用于多图生成模式，单图模式下视频宽高参考图片宽高。 2:3 3:2  1:1 16:9 9:16 |
| image_urls | 否 | string | ["https://fx.com/2.png"] | 提供一个外部图像 URL 作为视频生成的参考。支持最多7个图像，在提示词中引用已上传图片时，请输入 @image(n)，并在其后加一个空格（例如：@image1 海边日落）。 支持 JPEG、PNG、WEBP 格式每张图像最大文件大小：10MB 使用外部图像时 Spicy 模式不可用 数组最多包含七个 URL |
| callBackUrl | 是 | string | http://your-callback-url.com/complete | 用于接收视频生成任务完成更新的URL地址。可选但推荐在生产环境中使用。 |

## 返回参数说明：

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| code | int | 状态码 |
| msg | string | 状态信息 |
| data | string | 请求结果数据集 |
| -task_id | string | 任务 ID 可与“获取任务详细信息”端点一起使用，以查询任务状态 |
| debug | string/array | 调试数据 |
| exec_time | float | 执行耗时 |
| user_ip | string | 客户端IP |

## Response Example

```
{  "code": 200,  "msg": "success",  "data": {    "taskId": "veo_task_abcdef123456"  }}
```

## Error Codes

响应状态码

200: 成功 - 请求已成功处理
401: 未授权 - 缺少身份验证凭据或凭据无效
402: 额度不足 - 账户额度不足，无法执行该操作
404: 未找到 - 请求的资源或接口不存在
422: 校验错误 - 请求参数未通过校验检查
429: 请求受限 - 已超过该资源的请求频率限制
455: 服务不可用 - 系统目前正在维护中
500: 服务器错误 - 处理请求时发生了意外错误
501: 生成失败 - 内容生成任务失败
505: 功能禁用 - 请求的功能目前已禁用

## Usage Flow

1. **Create Task**: Call this API with your `key` and required parameters
2. **Get Task ID**: Read the task id from the response
3. **Wait for Results**: Use the notify/callback URL if provided, or poll the related query endpoint
4. **Get Results**: When the task succeeds, read result URLs / payload from the response

---

_Generated for AI / LLM consumption. Source of truth: `api_list` (same as HTML `/doc/{id}`)._
