Gemini Omni Zamiana tekstu na wideo
Użyj punktu końcowego text to video, aby utworzyć asynchroniczne zadanie.
Omówienie
Użyj punktu końcowego text to video z obsługiwanym modelem. Użyj zwróconego identyfikatora zadania, aby pobrać jego stan, lub podaj callback_url dla dostarczeń udokumentowanych poniżej.
Szybki start
- Utwórz klucz API i ustaw go jako RUNAPI_API_KEY.
- Wybierz obsługiwany model i wyślij żądanie POST, którego treść odpowiada schematowi tego modelu.
- Zapisz zwrócony identyfikator zadania, a następnie odpytuj do momentu osiągnięcia stanu końcowego lub obsłuż wywołania zwrotne opisane poniżej.
Punkt końcowy
- Bazowy URL
https://runapi.ai- Wersja API
v1- Uwierzytelnianie
Authorization: Bearer YOUR_API_TOKEN
Obsługiwane modele
Otwórz stronę modelu, aby zapoznać się z aktualnymi cenami, limitami żądań i szczegółami dotyczącymi użytku komercyjnego.
Schemat żądania
Pola i dozwolone wartości zależą od wybranego modelu. Jeśli zostanie podany, callback_url będzie odbierać dostarczenia zadań (Task) opisane poniżej.
gemini-omni-flash-1-116 pola
aspect_ratiostringWspółczynnik proporcji danych wyjściowych.
Dozwolone wartości:16:9, 9:16
audio_idsarrayIdentyfikatory ustawień wstępnych audio zwrócone przez create-audio.
Limit elementów:3
callback_urlstringURL webhooka dla końcowego dostarczenia zadania.
character_idsarrayIdentyfikatory postaci zwracane przez create-character; postacie z dwoma obrazami zajmują dwie z siedmiu wspólnych jednostek referencyjnych.
Limit elementów:3
duration_secondsintegerCzas trwania danych wyjściowych w sekundach.
Dozwolone wartości:4, 6, 8, 10
first_frame_image_urlstringPubliczny adres URL obrazu pierwszej klatki; wzajemnie wykluczający się z obrazami referencyjnymi, identyfikatorami audio, klipami wideo i identyfikatorami postaci.
last_frame_image_urlstringPubliczny adres URL obrazu ostatniej klatki; wymaga first_frame_image_url.
modelstringIdentyfikator modelu; domyślnie gemini-omni-text-to-video, jeśli pominięty.
output_resolutionstringRozdzielczość wyjściowa.
Dozwolone wartości:360p, 720p, 1080p, 4k
Domyślna wartość: 720p
promptstringPrompt generowania wideo.
Zakres:20000
reference_image_urlsarrayPubliczne adresy URL referencyjnych obrazów; obrazy, klipy wideo i postacie współdzielą limit siedmiu jednostek referencyjnych.
Limit elementów:7
seedintegerDeterministyczny zarodek generowania.
Zakres:0 - 2147483647
video_listarrayŹródłowe klipy wideo; każdy klip zużywa dwie jednostki referencyjne.
Limit elementów:1
video_list[].endsnumberCzas zakończenia klipu w sekundach; musi być większy niż czas początkowy i nie więcej niż 10 sekund po czasie początkowym.
Zakres:0
video_list[].startnumberCzas rozpoczęcia klipu w sekundach.
Zakres:0
video_list[].urlstringPubliczny adres URL wideo źródłowego.
gemini-omni-flash-preview5 pola
aspect_ratiostringWspółczynnik proporcji danych wyjściowych.
Dozwolone wartości:16:9, 9:16
Domyślna wartość: 16:9
callback_urlstringURL webhooka dla końcowego dostarczenia zadania.
modelstringIdentyfikator modelu; domyślnie gemini-omni-text-to-video, jeśli pominięty.
output_resolutionstringRozdzielczość wyjściowa.
Dozwolone wartości:720p
Domyślna wartość: 720p
promptstringPrompt generowania wideo.
Zakres:20000
gemini-omni-text-to-video14 pola
aspect_ratiostringWspółczynnik proporcji danych wyjściowych.
Dozwolone wartości:16:9, 9:16
audio_idsarrayIdentyfikatory ustawień wstępnych audio zwrócone przez create-audio.
Limit elementów:3
callback_urlstringURL webhooka dla końcowego dostarczenia zadania.
character_idsarrayIdentyfikatory postaci zwracane przez create-character; postacie z dwoma obrazami zajmują dwie z siedmiu wspólnych jednostek referencyjnych.
Limit elementów:3
duration_secondsintegerCzas trwania danych wyjściowych w sekundach.
Dozwolone wartości:4, 6, 8, 10
modelstringIdentyfikator modelu; domyślnie gemini-omni-text-to-video, jeśli pominięty.
Domyślna wartość:gemini-omni-text-to-video
output_resolutionstringRozdzielczość wyjściowa.
Dozwolone wartości:720p, 1080p, 4k
Domyślna wartość: 720p
promptstringPrompt generowania wideo.
Zakres:20000
reference_image_urlsarrayPubliczne adresy URL referencyjnych obrazów; obrazy, klipy wideo i postacie współdzielą limit siedmiu jednostek referencyjnych.
Limit elementów:7
seedintegerDeterministyczny zarodek generowania.
Zakres:0 - 2147483647
video_listarrayŹródłowe klipy wideo; każdy klip zużywa dwie jednostki referencyjne.
Limit elementów:1
video_list[].endsnumberCzas zakończenia klipu w sekundach; musi być większy niż czas początkowy i nie więcej niż 10 sekund po czasie początkowym.
Zakres:0
video_list[].startnumberCzas rozpoczęcia klipu w sekundach.
Zakres:0
video_list[].urlstringPubliczny adres URL wideo źródłowego.
Reguły warunkowe
Te wymagania obowiązują, gdy spełnione są wszystkie wymienione warunki.
-
Kiedy
first_frame_image_url = {"present" => true},model = gemini-omni-flash-1-1- Wymagane
- Nie jest akceptowane
reference_image_urls,audio_ids,video_list,character_ids
-
Kiedy
last_frame_image_url = {"present" => true},model = gemini-omni-flash-1-1- Wymagane
first_frame_image_url- Nie jest akceptowane
-
Kiedy
model = gemini-omni-flash-preview- Wymagane
- Nie jest akceptowane
reference_image_urls,audio_ids,video_list,character_ids,first_frame_image_url,last_frame_image_url,duration_seconds,seed
-
Kiedy
model = gemini-omni-text-to-video- Wymagane
- Nie jest akceptowane
first_frame_image_url,last_frame_image_url
Tworzenie akceptacji
POST /api/v1/gemini_omni/text_to_video
Schemat odpowiedzi
{
"properties": {
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"id": {
"type": "string"
},
"status": {
"enum": [
"processing"
],
"type": "string"
},
"task_replayed": {
"type": "boolean"
}
},
"required": [
"id",
"status",
"billing"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
{
"billing": {
"refund": null,
"reservation": null,
"settlement": null
},
"id": "tsk_reference_demo",
"status": "processing"
}
Odpytywanie w toku
GET /api/v1/gemini_omni/text_to_video/:id
Schemat odpowiedzi
{
"properties": {
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"id": {
"type": "string"
},
"status": {
"enum": [
"processing"
],
"type": "string"
}
},
"required": [
"id",
"status",
"billing"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
{
"billing": {
"refund": null,
"reservation": null,
"settlement": null
},
"id": "tsk_reference_demo",
"status": "processing"
}
Odpytywanie zakończone
GET /api/v1/gemini_omni/text_to_video/:id
Schemat odpowiedzi
{
"properties": {
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"id": {
"type": "string"
},
"status": {
"enum": [
"completed"
],
"type": "string"
},
"videos": {
"items": {
"properties": {
"url": {
"type": "string",
"x-runapi-generated-media": true
}
},
"required": [
"url"
],
"type": "object",
"unevaluatedProperties": false
},
"type": "array"
}
},
"required": [
"id",
"status",
"videos",
"billing"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
{
"billing": {
"refund": null,
"reservation": null,
"settlement": null
},
"id": "tsk_reference_demo",
"status": "completed",
"videos": [
{
"url": "https://file.runapi.ai/reference-video.mp4"
}
]
}
Odpytywanie nie powiodło się
GET /api/v1/gemini_omni/text_to_video/:id
Schemat odpowiedzi
{
"properties": {
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"error": {
"type": "string"
},
"id": {
"type": "string"
},
"status": {
"enum": [
"failed"
],
"type": "string"
}
},
"required": [
"id",
"status",
"error",
"billing"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
{
"billing": {
"refund": null,
"reservation": null,
"settlement": null
},
"error": "Task processing failed.",
"id": "tsk_reference_demo",
"status": "failed"
}
Wywołanie zwrotne klienta: ukończono
POST callback_url
Schemat odpowiedzi
{
"properties": {
"id": {
"type": "string"
},
"status": {
"enum": [
"completed"
],
"type": "string"
},
"videos": {
"items": {
"properties": {
"url": {
"type": "string",
"x-runapi-generated-media": true
}
},
"required": [
"url"
],
"type": "object",
"unevaluatedProperties": false
},
"type": "array"
}
},
"required": [
"id",
"status",
"videos"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
{
"id": "tsk_reference_demo",
"status": "completed",
"videos": [
{
"url": "https://file.runapi.ai/reference-video.mp4"
}
]
}
Wywołanie zwrotne klienta: niepowodzenie
POST callback_url
Schemat odpowiedzi
{
"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
}
Przykład odpowiedzi
{
"error": {
"code": "generation_failed",
"message": "Task processing failed."
},
"id": "tsk_reference_demo",
"status": "failed"
}
Błędy
POST /api/v1/gemini_omni/text_to_video
Schemat odpowiedzi
{
"properties": {
"error": {
"description": "Czytelny dla człowieka komunikat o błędzie.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
{
"error": "Authentication required"
}
Błędy
GET /api/v1/gemini_omni/text_to_video/:id
Schemat odpowiedzi
{
"properties": {
"error": {
"description": "Czytelny dla człowieka komunikat o błędzie.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
{
"error": "Authentication required"
}
Błędy
POST /api/v1/gemini_omni/text_to_video
Schemat odpowiedzi
{
"oneOf": [
{
"properties": {
"error": {
"description": "Czytelny dla człowieka komunikat o błędzie.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
},
{
"properties": {
"error": {
"description": "Czytelne dla człowieka podsumowanie walidacji.",
"type": "string"
},
"errors": {
"additionalProperties": {
"items": {
"type": "string"
},
"type": "array"
},
"description": "Komunikaty walidacyjne identyfikowane przez publiczne pole żądania, z tablicą czytelnych dla człowieka ciągów znaków dla każdego pola.",
"type": "object"
}
},
"required": [
"error",
"errors"
],
"type": "object",
"unevaluatedProperties": false
}
]
}
Przykład odpowiedzi
{
"error": "model must be one of: gemini-omni-flash-1-1, gemini-omni-flash-preview, gemini-omni-text-to-video"
}
Błędy
POST /api/v1/gemini_omni/text_to_video
Schemat odpowiedzi
{
"properties": {
"error": {
"description": "Czytelny dla człowieka komunikat o błędzie.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
{
"error": "Insufficient balance"
}
Błędy
POST /api/v1/gemini_omni/text_to_video
Schemat odpowiedzi
{
"properties": {
"error": {
"description": "Czytelny dla człowieka komunikat o błędzie.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
{
"error": "API key credit limit exceeded"
}
Błędy
POST /api/v1/gemini_omni/text_to_video
Schemat odpowiedzi
{
"properties": {
"error": {
"description": "Czytelny dla człowieka komunikat o błędzie.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
{
"error": "The request uses features that are not supported for the selected model"
}
Błędy
POST /api/v1/gemini_omni/text_to_video
Schemat odpowiedzi
{
"properties": {
"error": {
"description": "Czytelny dla człowieka komunikat o błędzie.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
{
"error": "Rate limit reached. Please retry later."
}
Błędy
POST /api/v1/gemini_omni/text_to_video
Schemat odpowiedzi
{
"properties": {
"error": {
"description": "Czytelny dla człowieka komunikat o błędzie.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
{
"error": "Service under maintenance, please try again later"
}
Błędy
POST /api/v1/gemini_omni/text_to_video
Schemat odpowiedzi
{
"properties": {
"error": {
"description": "Czytelny dla człowieka komunikat o błędzie.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
{
"error": "The request timed out"
}
Błędy
GET /api/v1/gemini_omni/text_to_video/:id
Schemat odpowiedzi
{
"properties": {
"error": {
"description": "Czytelny dla człowieka komunikat o błędzie.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Przykład odpowiedzi
{
"error": "Task with id 'tsk_reference_demo' not found"
}
Wygenerowane przykłady kodu
Używaj bezpośrednio cURL lub zainstaluj SDK dla swojego języka. Każdy przykład przesyła zwalidowane żądanie pokazane w tej dokumentacji.
Instalacja
pip install runapi-gemini-omni
import os
from runapi.gemini_omni import GeminiOmniClient
client = GeminiOmniClient(api_key=os.environ["RUNAPI_API_KEY"])
task = client.text_to_video.create(
model="gemini-omni-text-to-video",
prompt="A presenter walks through a bright studio.",
duration_seconds=4
)