# Grok Video API

{% hint style="danger" %}
此文档已停止维护，最新文档地址：<https://docs.ttapi.io>
{% endhint %}

## 生成视频

<mark style="color:green;">`POST`</mark> `https://api.ttapi.io/grok/generations`

> 文字 & 图片生成视频

**Headers**

| Name         | Value                |
| ------------ | -------------------- |
| Content-Type | `application/json`   |
| TT-API-KEY   | 用于请求授权 TT-API 的API密钥 |

**Body**

<table><thead><tr><th width="234">参数</th><th width="129">类型</th><th width="116">是否必须</th><th>描述</th></tr></thead><tbody><tr><td><code>prompt</code></td><td>string</td><td>是</td><td>提示词</td></tr><tr><td><code>aspect_ratio</code></td><td>string</td><td>否</td><td>视频宽高比<br>可选值：2:3、3:2、1:1、9:16、16:9。<br>默认 16:9</td></tr><tr><td><code>video_length</code></td><td>string</td><td>否</td><td>视频时长<br>取值范围为 10 到 30。<br>默认 10</td></tr><tr><td><code>resolution_name</code></td><td>integer</td><td>否</td><td>输出分辨率，当前仅支持 720p。<br>默认  720p</td></tr><tr><td><code>refer_images</code></td><td>list</td><td>否</td><td><p>垫图地址</p><pre><code><strong>["https://cdn.ttapi.io/other/2026-03-13/a86ca2c7-6333-4840-b337-395a5d02a182.png",
</strong>"https://cdn.ttapi.io/other/2026-03-13/64a858ed-6095-45ce-92d5-b515c9864703.png"]
</code></pre></td></tr><tr><td><code>hook_url</code></td><td>string</td><td>否</td><td>回调地址，任务完成或失败将通过请地址进行通知，通知数据结构与<a href="#jie-guo-can-shu-xiang-jie">fetch结构</a>一致。如果未设置，则需要请求fetch接口进行查询。</td></tr></tbody></table>

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "data": {
        "jobId": "3b178ca1-78ee-41c1-94d7-3464b27a2439"
    },
    "message": "success",
    "status": "SUCCESS"
}
```

{% endtab %}

{% tab title="400" %}

```json
[
"https://cdn.ttapi.io/other/2026-03-13/0157df8d-5687-4639-af9e-07ee23d00594.png",
"https://cdn.ttapi.io/other/2026-03-13/a86ca2c7-6333-4840-b337-395a5d02a182.png",
"https://cdn.ttapi.io/other/2026-03-13/64a858ed-6095-45ce-92d5-b515c9864703.png"
]
```

{% endtab %}
{% endtabs %}

## 查询任务结果

<mark style="color:green;">`GET`</mark> `https://api.ttapi.io/grok/fetch`

通过jobId查询当前任务生成结果

**Headers**

| Name         | Value                  |
| ------------ | ---------------------- |
| Content-Type | `application/json`     |
| TT-API-KEY   | `用于请求授权 TT-API 的API密钥` |

**Body**

<table><thead><tr><th width="178">参数</th><th width="108">类型</th><th width="116">是否必须</th><th>描述</th></tr></thead><tbody><tr><td><code>jobId</code></td><td>String</td><td>是</td><td>生成的视频的jobId</td></tr></tbody></table>

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "status": "SUCCESS",
    "message": "success",
    "jobId": "c822d894-fba8-4cd7-8b34-5cf54284af61",
    "data": {
        "videoId": "video_b96164dd8bfa43518c858bcf",
        "prompt": "镜头不动，石灯上的蚂蚁正在爬行，背景的花草随风有微微的晃动，背景音乐有蝉鸣的声音",
        "aspectRatio": "9:16",
        "videoLength": "30",
        "resolutionName": "720p",
        "referImage": "https://api.nananobanana.cn/api/cos-proxy/default-tenant-001/images/a515af9c-1619-42e8-abc7-97a6792ec524.png",
        "videoUrl": "https://cdn.ttapi.io/other/2026-03-10/56a8bece963a4e8e9a585f41c5d24162.mp4",
        "quota": "9",
        "finishTime": "2026-03-10 09:52:59",
        "hookUrl": null
    }
}
```

{% endtab %}
{% endtabs %}

## 结果参数详解

<table><thead><tr><th width="189">参数</th><th>详解</th></tr></thead><tbody><tr><td>status</td><td>结果状态，<br>ON_QUEUE：执行中<br>SUCCESS：成功<br>FAILED：失败</td></tr><tr><td>message</td><td>成功失败信息</td></tr><tr><td>data.quota</td><td>实际消耗额度</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-zh.mjapiapp.com/api/grok-video-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
