---
title: Gemini Omni Extend-Video | RunAPI
description: 为已完成的 Flash 1.2 视频续写 3 至 10 秒，可选用参考图片。
url: https://runapi.ai/zh-CN/docs/api/gemini-omni/extend-video.md
canonical: https://runapi.ai/zh-CN/docs/api/gemini-omni/extend-video
locale: zh-CN
---

> HTML 版本: https://runapi.ai/zh-CN/docs/api/gemini-omni/extend-video
> 智能体网站索引: https://runapi.ai/llms.txt

# Gemini Omni Extend-Video

## 概览

使用支持的模型提交Extend Video请求。使用返回的 Task ID 查询状态，或提供 callback_url 接收下方列出的投递。

### 快速开始

1. 创建 API Key，并将其设置为 RUNAPI_API_KEY。
2. 选择一个支持的模型，并发送与该模型 Schema 匹配的 POST 请求。
3. 保存返回的任务 ID，随后轮询到终态，或处理下方列出的回调。

## 端点

POST /api/v1/gemini_omni/extend_video

基础 URL: https://runapi.ai

API 版本: v1

身份验证: Authorization: Bearer YOUR_API_TOKEN

## 支持的模型

打开模型页可查看当前价格、限流和商业使用详情。

- [gemini-omni-flash-1-2](https://runapi.ai/zh-CN/models/gemini-omni/flash-1-2)

## 请求 Schema

字段和允许的取值取决于所选模型。提供 callback_url 后，它会收到下方列出的 Task 投递。

### gemini-omni-flash-1-2

```json
{
  "callback_url": {
    "description": "Webhook URL for terminal Task delivery.",
    "type": "string"
  },
  "duration_seconds": {
    "description": "Additional seconds to generate and bill.",
    "max": 10,
    "min": 3,
    "required": true,
    "type": "integer"
  },
  "model": {
    "description": "Gemini Omni Flash 1.2 model slug.",
    "required": true,
    "type": "string"
  },
  "prompt": {
    "description": "Continuation prompt.",
    "length": true,
    "max": 20000,
    "required": true,
    "type": "string"
  },
  "reference_image_urls": {
    "description": "Optional reference images for the extension.",
    "items": {
      "type": "string"
    },
    "max_items": 3,
    "type": "array"
  },
  "source_task_id": {
    "description": "Own completed 1.2 generation or extension Task, at most 15 seconds and 360p or 720p.",
    "required": true,
    "type": "string"
  }
}
```

## 创建已接受

HTTP 202 - POST /api/v1/gemini_omni/extend_video

### 响应 Schema

```json
{
  "properties": {
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "processing"
      ],
      "type": "string"
    },
    "task_replayed": {
      "type": "boolean"
    }
  },
  "required": [
    "id",
    "status"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### 响应示例

```json
{
  "id": "tsk_reference_demo",
  "status": "processing"
}
```

## 轮询处理中

HTTP 200 - GET /api/v1/gemini_omni/extend_video/:id

### 响应 Schema

```json
{
  "properties": {
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "processing"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### 响应示例

```json
{
  "id": "tsk_reference_demo",
  "status": "processing"
}
```

## 轮询已完成

HTTP 200 - GET /api/v1/gemini_omni/extend_video/:id

### 响应 Schema

```json
{
  "properties": {
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "completed"
      ],
      "type": "string"
    },
    "usage": {
      "properties": {
        "cost": {
          "type": "number"
        }
      },
      "required": [
        "cost"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "videos": {
      "items": {
        "properties": {
          "url": {
            "type": "string",
            "x-runapi-generated-media": true
          }
        },
        "required": [
          "url"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    }
  },
  "required": [
    "id",
    "status",
    "videos",
    "usage"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### 响应示例

```json
{
  "id": "tsk_reference_demo",
  "status": "completed",
  "usage": {
    "cost": 0.05
  },
  "videos": [
    {
      "url": "https://file.runapi.ai/reference-video.mp4"
    }
  ]
}
```

## 轮询失败

HTTP 200 - GET /api/v1/gemini_omni/extend_video/:id

### 响应 Schema

```json
{
  "properties": {
    "error": {
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "failed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### 响应示例

```json
{
  "error": "Task processing failed.",
  "id": "tsk_reference_demo",
  "status": "failed"
}
```

## 客户回调：已完成

HTTP 200 - POST callback_url

### 响应 Schema

```json
{
  "properties": {
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "completed"
      ],
      "type": "string"
    },
    "usage": {
      "properties": {
        "cost": {
          "type": "number"
        }
      },
      "required": [
        "cost"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "videos": {
      "items": {
        "properties": {
          "url": {
            "type": "string",
            "x-runapi-generated-media": true
          }
        },
        "required": [
          "url"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    }
  },
  "required": [
    "id",
    "status",
    "videos",
    "usage"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### 响应示例

```json
{
  "id": "tsk_reference_demo",
  "status": "completed",
  "usage": {
    "cost": 0.05
  },
  "videos": [
    {
      "url": "https://file.runapi.ai/reference-video.mp4"
    }
  ]
}
```

## 客户回调：失败

HTTP 200 - POST callback_url

### 响应 Schema

```json
{
  "properties": {
    "error": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "properties": {
            "code": {
              "type": "string"
            },
            "limit_cents": {
              "type": "integer"
            },
            "message": {
              "type": "string"
            },
            "reset_at": {
              "format": "date-time",
              "type": [
                "string",
                "null"
              ]
            },
            "used_cents": {
              "type": "integer"
            },
            "window": {
              "enum": [
                "1h",
                "1d",
                "7d",
                "daily",
                "weekly",
                "monthly",
                "lifetime"
              ],
              "type": "string"
            }
          },
          "required": [
            "code",
            "message"
          ],
          "type": "object",
          "unevaluatedProperties": false
        }
      ]
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "failed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### 响应示例

```json
{
  "error": {
    "code": "generation_failed",
    "message": "Task processing failed."
  },
  "id": "tsk_reference_demo",
  "status": "failed"
}
```

## 错误

HTTP 401 - POST /api/v1/gemini_omni/extend_video

### 响应 Schema

```json
{
  "properties": {
    "error": {
      "description": "Human-readable error message.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### 响应示例

```json
{
  "error": "Authentication required"
}
```

## 错误

HTTP 401 - GET /api/v1/gemini_omni/extend_video/:id

### 响应 Schema

```json
{
  "properties": {
    "error": {
      "description": "Human-readable error message.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### 响应示例

```json
{
  "error": "Authentication required"
}
```

## 错误

HTTP 400 - POST /api/v1/gemini_omni/extend_video

### 响应 Schema

```json
{
  "oneOf": [
    {
      "properties": {
        "error": {
          "description": "Human-readable error message.",
          "type": "string"
        }
      },
      "required": [
        "error"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    {
      "properties": {
        "error": {
          "description": "Human-readable validation summary.",
          "type": "string"
        },
        "errors": {
          "additionalProperties": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "description": "Validation messages keyed by public request field, with an array of human-readable strings for each field.",
          "type": "object"
        }
      },
      "required": [
        "error",
        "errors"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  ]
}
```

### 响应示例

```json
{
  "error": "model must be one of: gemini-omni-flash-1-2"
}
```

## 错误

HTTP 402 - POST /api/v1/gemini_omni/extend_video

### 响应 Schema

```json
{
  "properties": {
    "error": {
      "description": "Human-readable error message.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### 响应示例

```json
{
  "error": "Insufficient balance"
}
```

## 错误

HTTP 429 - POST /api/v1/gemini_omni/extend_video

### 响应 Schema

```json
{
  "properties": {
    "error": {
      "description": "Human-readable error message.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### 响应示例

```json
{
  "error": "API key credit limit exceeded"
}
```

## 错误

HTTP 409 - POST /api/v1/gemini_omni/extend_video

### 响应 Schema

```json
{
  "properties": {
    "error": {
      "description": "Human-readable error message.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### 响应示例

```json
{
  "error": "The request uses features that are not supported for the selected model"
}
```

## 错误

HTTP 429 - POST /api/v1/gemini_omni/extend_video

### 响应 Schema

```json
{
  "properties": {
    "error": {
      "description": "Human-readable error message.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### 响应示例

```json
{
  "error": "Rate limit reached. Please retry later."
}
```

## 错误

HTTP 503 - POST /api/v1/gemini_omni/extend_video

### 响应 Schema

```json
{
  "properties": {
    "error": {
      "description": "Human-readable error message.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### 响应示例

```json
{
  "error": "Service under maintenance, please try again later"
}
```

## 错误

HTTP 503 - POST /api/v1/gemini_omni/extend_video

### 响应 Schema

```json
{
  "properties": {
    "error": {
      "description": "Human-readable error message.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### 响应示例

```json
{
  "error": "The request timed out"
}
```

## 错误

HTTP 404 - GET /api/v1/gemini_omni/extend_video/:id

### 响应 Schema

```json
{
  "properties": {
    "error": {
      "description": "Human-readable error message.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### 响应示例

```json
{
  "error": "Task with id 'tsk_reference_demo' not found"
}
```

## 生成的代码示例

直接使用 cURL，或安装所用语言的 SDK。每个示例都会提交本参考中经过验证的请求。

### curl

```curl
curl -X POST https://runapi.ai/api/v1/gemini_omni/extend_video \
  -H 'Authorization: Bearer YOUR_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"model":"gemini-omni-flash-1-2","source_task_id":"tsk_source_video","prompt":"Continue the camera movement.","duration_seconds":3}'
```

### javascript

#### 安装

```bash
npm install @runapi.ai/gemini-omni
```

```javascript
import { GeminiOmniClient } from "@runapi.ai/gemini-omni";

const client = new GeminiOmniClient({ apiKey: process.env.RUNAPI_API_KEY });
const task = await client.extendVideo.create({
  "model": "gemini-omni-flash-1-2",
  "source_task_id": "tsk_source_video",
  "prompt": "Continue the camera movement.",
  "duration_seconds": 3
});
```

### python

#### 安装

```bash
pip install runapi-gemini-omni
```

```python
import os
from runapi.gemini_omni import GeminiOmniClient

client = GeminiOmniClient(api_key=os.environ["RUNAPI_API_KEY"])
task = client.extend_video.create(
  model="gemini-omni-flash-1-2",
  source_task_id="tsk_source_video",
  prompt="Continue the camera movement.",
  duration_seconds=3
)
```

### go

#### 安装

```bash
go get github.com/runapi-ai/gemini-omni-sdk/go@latest
```

```go
package main

import (
  "context"
  "log"
  "os"

  "github.com/runapi-ai/core-sdk/go/option"
  geminiomni "github.com/runapi-ai/gemini-omni-sdk/go/geminiomni"
)

func main() {
  client, err := geminiomni.NewClient(option.WithAPIKey(os.Getenv("RUNAPI_API_KEY")))
  if err != nil {
    log.Fatal(err)
  }

  task, err := client.ExtendVideo.Create(context.Background(), geminiomni.ExtendVideoParams{
    Model: geminiomni.TextToVideoModel("gemini-omni-flash-1-2"),
    SourceTaskID: "tsk_source_video",
    Prompt: "Continue the camera movement.",
    DurationSeconds: 3,
  })
  if err != nil {
    log.Fatal(err)
  }
  _ = task
}
```

### ruby

#### 安装

```bash
gem install runapi-gemini-omni
```

```ruby
require "runapi/gemini_omni"

client = RunApi::GeminiOmni::Client.new(api_key: ENV.fetch("RUNAPI_API_KEY"))
task = client.extend_video.create(
  model: "gemini-omni-flash-1-2",
  source_task_id: "tsk_source_video",
  prompt: "Continue the camera movement.",
  duration_seconds: 3
)
```

### java

#### 安装

```kotlin
implementation("ai.runapi:runapi-gemini-omni")
```

```java
import ai.runapi.geminiomni.GeminiOmniClient;
import ai.runapi.geminiomni.types.ExtendVideoParams;
import ai.runapi.core.polling.TaskCreateResponse;

public final class Example {
  public static void main(String[] args) {
    GeminiOmniClient client = GeminiOmniClient.builder()
        .apiKey(System.getenv("RUNAPI_API_KEY"))
        .build();
    TaskCreateResponse task = client.extendVideo().create(
        ExtendVideoParams.builder()
        .model(new ai.runapi.geminiomni.types.TextToVideoModel("gemini-omni-flash-1-2"))
        .sourceTaskId("tsk_source_video")
        .prompt("Continue the camera movement.")
        .durationSeconds(3)
            .build()
    );
  }
}
```

### php

#### 安装

```bash
composer require runapi-ai/gemini-omni
```

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use RunApi\Core\ClientOptions;
use RunApi\GeminiOmni\GeminiOmniClient;

$client = new GeminiOmniClient(new ClientOptions(apiKey: getenv('RUNAPI_API_KEY')));
$task = $client->extendVideo->create([
  "model" => "gemini-omni-flash-1-2",
  "source_task_id" => "tsk_source_video",
  "prompt" => "Continue the camera movement.",
  "duration_seconds" => 3
]);
```

## 相关指南

- [API 身份验证](https://runapi.ai/zh-CN/docs/guides/authentication.md)
- [快速开始](https://runapi.ai/zh-CN/docs/guides/task-api/quickstart.md)

---

## RunAPI 的更多内容

- [首页](https://runapi.ai/zh-CN/.md)
- [模型目录](https://runapi.ai/zh-CN/models.md)
- [定价](https://runapi.ai/zh-CN/pricing.md)
- [提供方](https://runapi.ai/zh-CN/models)
- [提示词库](https://runapi.ai/zh-CN/prompts.md)
- [文档](https://runapi.ai/zh-CN/docs/guides)
- [SDK](https://runapi.ai/zh-CN/sdk.md)
- [CLI](https://runapi.ai/zh-CN/cli.md)
- [MCP Server](https://runapi.ai/zh-CN/mcp.md)
- [x402](https://runapi.ai/zh-CN/x402.md)
- [Claude Code 与 Cursor](https://runapi.ai/zh-CN/claude-code-vs-cursor.md)
- [Cursor API 设置](https://runapi.ai/zh-CN/cursor-api-setup.md)
- [RunAPI 与 OpenRouter](https://runapi.ai/zh-CN/openrouter-alternative.md)
- [企业版](https://runapi.ai/zh-CN/contact.md)
- [邀请返利](https://runapi.ai/zh-CN/referral-program.md)
- [联系](https://runapi.ai/zh-CN/contact.md)
- [服务条款](https://runapi.ai/zh-CN/terms.md)
- [隐私政策](https://runapi.ai/zh-CN/privacy.md)
- [智能体网站索引](https://runapi.ai/llms.txt)

联系我们: contact@runapi.ai

## 结构化数据

```json
[
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-CN",
    "@type": "WebSite",
    "name": "RunAPI",
    "url": "https://runapi.ai/zh-CN",
    "potentialAction": {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://runapi.ai/zh-CN/models?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    }
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-CN",
    "@type": "Organization",
    "name": "RunAPI",
    "url": "https://runapi.ai/zh-CN",
    "logo": {
      "@type": "ImageObject",
      "url": "https://runapi.ai/icon.svg"
    },
    "sameAs": [
      "https://github.com/runapi-ai"
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-CN",
    "@type": "TechArticle",
    "headline": "Gemini Omni Extend-Video",
    "description": "为已完成的 Flash 1.2 视频续写 3 至 10 秒，可选用参考图片。",
    "url": "https://runapi.ai/zh-CN/docs/api/gemini-omni/extend-video",
    "mainEntityOfPage": "https://runapi.ai/zh-CN/docs/api/gemini-omni/extend-video"
  }
]
```
