> ## Documentation Index
> Fetch the complete documentation index at: https://docs.socialvision.tisyk.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Grok Imagine 视频参考

> xAI Grok Imagine 视频生成与任务状态

## openai 查询任务

`GET /v1/videos/{id}`

Grok Imagine 任务状态查询（`GET /v1/videos/`{`id`}\`\`）。与 Sora 共用物理路由，按任务 ID / 模型区分来源。
适用于 `POST /v1/videos/generations` 与 `POST /v1/videos/edits` 提交的任务。

### 请求参数 (Query / Path)

<ParamField path="id" type="string" required>
  路径中的资源 / 任务 ID
</ParamField>

<ParamField header="Content-Type" type="string" required>
  请求体 Content-Type，一般为 application/json
</ParamField>

<ParamField header="Accept" type="string" required>
  期望的响应 Content-Type
</ParamField>

<ParamField header="Authorization" type="string">
  Bearer API Key
</ParamField>

<ParamField header="X-Forwarded-Host" type="string">
  转发原始 Host（代理场景）
</ParamField>

### 请求示例 (cURL)

```bash theme={null}
curl "https://socialvision.tisyk.xyz/v1/videos/{id}" \
  -H "Authorization: Bearer sk-YOUR_API_KEY"
```

### 响应示例 (200 OK)

```json theme={null}
{
  "detail": {
    "id": "task_01k6x15vhrff09dkkqjrzwhm60",
    "input": {
      "images": [
        "https://filesystem.site/cdn/20250612/VfgB5ubjInVt8sG6rzMppxnu7gEfde.png",
        "https://filesystem.site/cdn/20250612/998IGmUiM2koBGZM3UnZeImbPBNIUL.png"
      ],
      "model": "sy_ore",
      "orientation": "portrait",
      "prompt": "make animate",
      "size": "small"
    },
    "pending_info": {
      "created_at": "2025-10-06T15:10:26.875Z",
      "generations": [],
      "height": 640,
      "id": "task_01k6x15vhrff09dkkqjrzwhm60",
      "inpaint_items": [
        {
          "frame_index": 0,
          "source_end_frame": 0,
          "source_start_frame": 0,
          "type": "image",
          "upload_media_id": "media_01k6x15tnzezbst05sth2qgd8r"
        },
        {
          "frame_index": 0,
          "source_end_frame": 0,
          "source_start_frame": 0,
          "type": "image",
          "upload_media_id": "media_01k6x15tzafwztz74t018v3enw"
        }
      ],
      "model": "sy_8",
      "moderation_result": {
        "is_output_rejection": false,
        "results_by_frame_index": {},
        "task_id": "task_01k6x15vhrff09dkkqjrzwhm60",
        "type": "passed"
      },
      "n_frames": 450,
      "n_variants": 1,
      "needs_user_review": false,
      "num_unsafe_generations": 0,
      "operation": "simple_compose",
      "priority": 2,
      "progress_pct": 0.9302178175176704,
      "prompt": "make animate",
      "status": "processing",
      "title": "New Video",
      "type": "video_gen",
      "user": "user-a1sGDUIOXV32hNITe59LEkHa",
      "width": 352
    },
    "status": "pending"
  },
  "enhanced_prompt": "",
  "id": "sora-2:task_01k6x15vhrff09dkkqjrzwhm60",
  "status": "pending",
  "status_update_time": 1759763621142,
  "video_url": ""
}
```

***

## 编辑视频

`POST /v1/videos/edits`

Grok Imagine 视频编辑（`POST /v1/videos/edits`）。仅 grok-imagine-video 系列支持。
提交后通过 `GET /v1/videos/`{`id`}\`\` 轮询。

### 请求参数 (Query / Path)

<ParamField header="Content-Type" type="string">
  请求体 Content-Type，一般为 application/json
</ParamField>

<ParamField header="Authorization" type="string">
  Bearer API Key
</ParamField>

### 请求体参数 (Body)

<ParamField body="aspect_ratio" type="string" required>
  ("1:1" | "16:9" | "9:16" )
</ParamField>

<ParamField body="model" type="string" required>
  grok-imagine-video
</ParamField>

<ParamField body="prompt" type="string" required>
  提示词
</ParamField>

<ParamField body="resolution" type="string" required>
  ("480p" | "720p")
</ParamField>

<ParamField body="video" type="object" required>
  视频 URL 或标识
</ParamField>

### 请求示例 (cURL)

```bash theme={null}
curl -X POST "https://socialvision.tisyk.xyz/v1/videos/edits" \
  -H "Authorization: Bearer sk-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### 响应示例 (200 OK)

```json theme={null}
{
  "aspect_ratio": "16:9",
  "model": "grok-imagine-video",
  "prompt": "Give the woman a silver necklace",
  "resolution": "480p",
  "video": {
    "url": "https://imageproxy.zhongzhuan.chat/api/proxy/image/5dada4bd5c095d1062b79582a51481bf.mp4"
  }
}
```

***

## 创建视频

`POST /v1/videos/generations`

Grok Imagine 文生/图生视频（`POST /v1/videos/generations`）。xAI 官方原生 JSON 入口，模型如 grok-imagine-video。
提交后通过 `GET /v1/videos/`{`id`}\`\` 轮询。

### 请求参数 (Query / Path)

<ParamField header="Content-Type" type="string">
  请求体 Content-Type，一般为 application/json
</ParamField>

<ParamField header="Authorization" type="string">
  Bearer API Key
</ParamField>

### 请求体参数 (Body)

<ParamField body="aspect_ratio" type="string" required>
  ("1:1" | "16:9" | "9:16")
</ParamField>

<ParamField body="duration" type="integer" required>
  \[1, 15]
</ParamField>

<ParamField body="image" type="object">
  不能和reference\_images一起用
</ParamField>

<ParamField body="model" type="string" required>
  grok-imagine-video、grok-imagine-video-1.5-preview
</ParamField>

<ParamField body="prompt" type="string" required>
  提示词
</ParamField>

<ParamField body="reference_images" type="array">
  不能和reference\_images一起用
</ParamField>

<ParamField body="resolution" type="string" required>
  ("480p" | "720p")
</ParamField>

### 请求示例 (cURL)

```bash theme={null}
curl -X POST "https://socialvision.tisyk.xyz/v1/videos/generations" \
  -H "Authorization: Bearer sk-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### 响应示例 (200 OK)

```json theme={null}
{
  "aspect_ratio": "16:9",
  "duration": 4,
  "model": "grok-imagine-video",
  "prompt": "A serene lake at sunrise with mist rolling over the water",
  "resolution": "480p"
}
```

***

## openai 创建视频，图生

`POST /v1/videos`

### 请求体参数 (Body)

<ParamField body="input_reference" type="string">
  图片 url
</ParamField>

<ParamField body="model" type="string" required>
  模型名称
</ParamField>

<ParamField body="prompt" type="string" required>
  提示词
</ParamField>

<ParamField body="seconds" type="number">
  时长 6s / 10s
</ParamField>

<ParamField body="size" type="string">
  16:9  , 9:16
</ParamField>

### 请求示例 (JSON)

```json theme={null}
{
  "input_reference": "",
  "model": "grok-videos",
  "prompt": "让牛快乐的跳科目三",
  "seconds": 6,
  "size": "16:9"
}
```

### 请求示例 (cURL)

```bash theme={null}
curl -X POST "https://socialvision.tisyk.xyz/v1/videos" \
  -H "Authorization: Bearer sk-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "input_reference": "",
  "model": "grok-videos",
  "prompt": "让牛快乐的跳科目三",
  "seconds": 6,
  "size": "16:9"
}'
```

### 响应示例 (200 OK)

```json theme={null}
{
  "code": 0,
  "data": {
    "task_id": "task_example_001"
  },
  "message": "success"
}
```

***


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.