# 查询视频生成任务状态

> 视频生成

查询异步视频生成任务的执行状态和结果。
异步任务提交后，通过此接口轮询查询任务状态，直到状态变为 `completed` 或 `failed`。
查询返回的 JSON 结构与同步执行成功的响应结构一致。

**请求示例**

**查询任务状态**

```bash
curl -X GET "https://api.modelverse.cn/v1beta/models/interactions/{id}" \
  -H "Authorization: Bearer $MODELVERSE_API_KEY"
```

其中 `{id}` 替换为异步任务提交时返回的任务 ID。

**响应示例**

**1. 任务进行中**

```json
{
  "id": "video-ea2b5872-12eb-452f-96d5-d6abf1ee25da",
  "status": "in_progress",
  "role": "model",
  "steps": [
    {
      "type": "user_input",
      "content": [
        {
          "text": "用一个视频来介绍一下故宫的历史",
          "type": "text"
        }
      ]
    }
  ],
  "object": "interaction",
  "model": "gemini-omni-flash-preview"
}
```

**2. 任务已完成**

```json
{
  "id": "video-088fa9f5-81bd-419c-95bb-4ee03b28fc5d",
  "status": "completed",
  "usage": {
    "total_tokens": 116229,
    "total_input_tokens": 57815,
    "input_tokens_by_modality": [
      {
        "modality": "text",
        "tokens": 215
      }
    ],
    "total_output_tokens": 57920,
    "output_tokens_by_modality": [
      {
        "modality": "video",
        "tokens": 57920
      }
    ]
  },
  "role": "model",
  "created": "2026-07-07T06:20:37Z",
  "updated": "2026-07-07T06:25:12Z",
  "steps": [
    {
      "content": [
        {
          "mime_type": "video/mp4",
          "data": "MP4视频的base64数据",
          "type": "video"
        }
      ],
      "type": "model_output"
    }
  ],
  "object": "interaction",
  "model": "gemini-omni-flash-preview"
}
```

**3. 任务失败**

```json
{
  "id": "video-088fa9f5-81bd-419c-95bb-4ee03b28fc5d",
  "status": "failed"
}
```

## 请求地址

`GET https://api.modelverse.cn/v1beta/models/interactions/{id}`

## 请求参数

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| id | path | string | Yes | 任务 ID（异步提交时返回的 id） |

## 响应

- **200** — 任务状态查询成功。
- **404** — 任务不存在。
- **default** — 错误响应。

## OpenAPI 定义

```json
{
  "openapi": "3.1.0",
  "x-language": "zh-CN",
  "info": {
    "title": "gemini-omni-flash-preview 任务状态查询接口文档",
    "version": "1.0.0",
    "description": "这是 ModelVerse 上 `gemini-omni-flash-preview` 的视频生成任务状态查询接口文档。\n接口路径为 `GET /v1beta/models/interactions/{id}`。\n"
  },
  "servers": [
    {
      "url": "https://api.modelverse.cn",
      "description": "该模型文档中使用的 ModelVerse API 端点。"
    }
  ],
  "tags": [
    {
      "name": "gemini-omni-flash-preview",
      "description": "gemini-omni-flash-preview 视频生成任务状态查询接口。"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/v1beta/models/interactions/{id}": {
      "get": {
        "tags": [
          "gemini-omni-flash-preview"
        ],
        "operationId": "getVideoTaskStatus",
        "summary": "查询视频生成任务状态",
        "description": "查询异步视频生成任务的执行状态和结果。\n异步任务提交后，通过此接口轮询查询任务状态，直到状态变为 `completed` 或 `failed`。\n查询返回的 JSON 结构与同步执行成功的响应结构一致。\n\n**请求示例**\n\n**查询任务状态**\n\n```bash\ncurl -X GET \"https://api.modelverse.cn/v1beta/models/interactions/{id}\" \\\n  -H \"Authorization: Bearer $MODELVERSE_API_KEY\"\n```\n\n其中 `{id}` 替换为异步任务提交时返回的任务 ID。\n\n**响应示例**\n\n**1. 任务进行中**\n\n```json\n{\n  \"id\": \"video-ea2b5872-12eb-452f-96d5-d6abf1ee25da\",\n  \"status\": \"in_progress\",\n  \"role\": \"model\",\n  \"steps\": [\n    {\n      \"type\": \"user_input\",\n      \"content\": [\n        {\n          \"text\": \"用一个视频来介绍一下故宫的历史\",\n          \"type\": \"text\"\n        }\n      ]\n    }\n  ],\n  \"object\": \"interaction\",\n  \"model\": \"gemini-omni-flash-preview\"\n}\n```\n\n**2. 任务已完成**\n\n```json\n{\n  \"id\": \"video-088fa9f5-81bd-419c-95bb-4ee03b28fc5d\",\n  \"status\": \"completed\",\n  \"usage\": {\n    \"total_tokens\": 116229,\n    \"total_input_tokens\": 57815,\n    \"input_tokens_by_modality\": [\n      {\n        \"modality\": \"text\",\n        \"tokens\": 215\n      }\n    ],\n    \"total_output_tokens\": 57920,\n    \"output_tokens_by_modality\": [\n      {\n        \"modality\": \"video\",\n        \"tokens\": 57920\n      }\n    ]\n  },\n  \"role\": \"model\",\n  \"created\": \"2026-07-07T06:20:37Z\",\n  \"updated\": \"2026-07-07T06:25:12Z\",\n  \"steps\": [\n    {\n      \"content\": [\n        {\n          \"mime_type\": \"video/mp4\",\n          \"data\": \"MP4视频的base64数据\",\n          \"type\": \"video\"\n        }\n      ],\n      \"type\": \"model_output\"\n    }\n  ],\n  \"object\": \"interaction\",\n  \"model\": \"gemini-omni-flash-preview\"\n}\n```\n\n**3. 任务失败**\n\n```json\n{\n  \"id\": \"video-088fa9f5-81bd-419c-95bb-4ee03b28fc5d\",\n  \"status\": \"failed\"\n}\n```\n",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "任务 ID（异步提交时返回的 id）",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "任务状态查询成功。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoGenerateResponse"
                }
              }
            }
          },
          "404": {
            "description": "任务不存在。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "错误响应。",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API key",
        "description": "API Key 认证，在请求头中携带 `Authorization: Bearer {API_KEY}`。"
      }
    },
    "schemas": {
      "VideoGenerateResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "status",
          "role",
          "object",
          "model"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "交互唯一标识符。"
          },
          "status": {
            "type": "string",
            "enum": [
              "completed",
              "failed",
              "in_progress"
            ],
            "description": "任务状态。"
          },
          "usage": {
            "$ref": "#/components/schemas/Usage"
          },
          "role": {
            "type": "string",
            "const": "model",
            "description": "角色。固定为 model。"
          },
          "created": {
            "type": "string",
            "format": "date-time",
            "description": "创建时间（ISO 8601 格式）。"
          },
          "updated": {
            "type": "string",
            "format": "date-time",
            "description": "更新时间（ISO 8601 格式）。"
          },
          "steps": {
            "type": "array",
            "description": "生成步骤列表。",
            "items": {
              "$ref": "#/components/schemas/Step"
            }
          },
          "object": {
            "type": "string",
            "const": "interaction",
            "description": "对象类型。固定为 interaction。"
          },
          "model": {
            "type": "string",
            "const": "gemini-omni-flash-preview",
            "description": "模型名称。"
          }
        }
      },
      "Usage": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "total_tokens": {
            "type": "integer",
            "description": "总 token 数。"
          },
          "total_input_tokens": {
            "type": "integer",
            "description": "输入 token 总数。"
          },
          "input_tokens_by_modality": {
            "type": "array",
            "description": "按模态分类的输入 token 数。",
            "items": {
              "$ref": "#/components/schemas/InputModalityTokens"
            }
          },
          "total_output_tokens": {
            "type": "integer",
            "description": "输出 token 总数。"
          },
          "output_tokens_by_modality": {
            "type": "array",
            "description": "按模态分类的输出 token 数。",
            "items": {
              "$ref": "#/components/schemas/OutputModalityTokens"
            }
          },
          "total_tool_use_tokens": {
            "type": "integer",
            "description": "工具使用 token 数。"
          },
          "total_thought_tokens": {
            "type": "integer",
            "description": "思考 token 数。"
          }
        }
      },
      "InputModalityTokens": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "modality": {
            "type": "string",
            "enum": [
              "text",
              "image",
              "video"
            ],
            "description": "输入模态类型。"
          },
          "tokens": {
            "type": "integer",
            "description": "token 数量。"
          }
        }
      },
      "OutputModalityTokens": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "modality": {
            "type": "string",
            "enum": [
              "text",
              "video"
            ],
            "description": "输出模态类型。"
          },
          "tokens": {
            "type": "integer",
            "description": "token 数量。"
          }
        }
      },
      "Step": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "signature": {
            "type": "string",
            "description": "签名。"
          },
          "summary": {
            "type": "array",
            "description": "摘要列表。",
            "items": {
              "$ref": "#/components/schemas/SummaryItem"
            }
          },
          "type": {
            "type": "string",
            "enum": [
              "thought",
              "model_output",
              "user_input"
            ],
            "description": "步骤类型。"
          },
          "content": {
            "type": "array",
            "description": "输出内容列表（当 type 为 model_output 时）。",
            "items": {
              "$ref": "#/components/schemas/OutputContent"
            }
          }
        }
      },
      "SummaryItem": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "text": {
            "type": "string",
            "description": "摘要文本。"
          },
          "type": {
            "type": "string",
            "const": "text",
            "description": "内容类型。"
          }
        }
      },
      "OutputContent": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "mime_type": {
            "type": "string",
            "description": "MIME 类型。",
            "examples": [
              "video/mp4"
            ]
          },
          "data": {
            "type": "string",
            "description": "base64 编码的视频数据。"
          },
          "type": {
            "type": "string",
            "enum": [
              "text",
              "video"
            ],
            "description": "输出内容类型。支持的模态：\n- `text`: 文本（输出）\n- `video`: 视频（输出）\n"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "$ref": "#/components/schemas/ErrorObject"
          }
        }
      },
      "ErrorObject": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "message",
          "type"
        ],
        "properties": {
          "message": {
            "type": "string",
            "description": "错误信息。"
          },
          "type": {
            "type": "string",
            "description": "错误类型。"
          },
          "code": {
            "type": "string",
            "description": "错误代码。"
          },
          "param": {
            "type": "string",
            "description": "相关请求参数。"
          }
        }
      }
    }
  }
}
```
