Get Gemini video task
curl --request GET \
--url https://api.aiohub.org/v1beta/models/{model}/operations/{operation} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.aiohub.org/v1beta/models/{model}/operations/{operation}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.aiohub.org/v1beta/models/{model}/operations/{operation}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aiohub.org/v1beta/models/{model}/operations/{operation}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.aiohub.org/v1beta/models/{model}/operations/{operation}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.aiohub.org/v1beta/models/{model}/operations/{operation}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aiohub.org/v1beta/models/{model}/operations/{operation}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"name": "models/doubao-seedance-2-5-260628/operations/task_example",
"done": false
}Get video · Gemini API
Check task status, handle failures and find the completed video.
GET
/
v1beta
/
models
/
{model}
/
operations
/
{operation}
Get Gemini video task
curl --request GET \
--url https://api.aiohub.org/v1beta/models/{model}/operations/{operation} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.aiohub.org/v1beta/models/{model}/operations/{operation}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.aiohub.org/v1beta/models/{model}/operations/{operation}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aiohub.org/v1beta/models/{model}/operations/{operation}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.aiohub.org/v1beta/models/{model}/operations/{operation}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.aiohub.org/v1beta/models/{model}/operations/{operation}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aiohub.org/v1beta/models/{model}/operations/{operation}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"name": "models/doubao-seedance-2-5-260628/operations/task_example",
"done": false
}Polling and status
Replace<OPERATION_NAME> with the full name from creation and poll every 10 to 15 seconds:
curl "https://api.aiohub.org/v1beta/<OPERATION_NAME>" \
-H "Authorization: Bearer <AIOHUB_API_KEY>"
| Response | Action |
|---|---|
done: false | Keep polling |
done: true with response | Download the video |
done: true with error | Stop polling and read error.message |
done: true means the operation ended, not necessarily that it succeeded.
Read a successful result
Key fields in a successful response:{
"name": "models/doubao-seedance-2-5-260628/operations/task_example",
"done": true,
"response": {
"generateVideoResponse": {
"generatedSamples": [
{
"video": {
"uri": "https://api.aiohub.org/v1beta/files/<FILE_NAME>:download?alt=media"
}
}
]
}
}
}
Failures and retries
After a polling disconnect, keep polling the samename rather than calling predictLongRunning again. Correct fields before retrying a 400. If a terminal operation has error, do not read the success response fields. Files remain for 72 hours and task records for 7 days.
After a 429 or temporary service error, wait before retrying the read; do not create another task. If a task is missing, check the identifier and the account that owns the API key.Authorizations
API key (sk-xxx)
Path Parameters
Full Seedance model name.
Example:
"doubao-seedance-2-5-260628"
The identifier after operations/ in the returned name, not the full name.
Example:
"task_example"
Response
Current task state; generation failures can also return HTTP 200.