Download Gemini video
curl --request GET \
--url https://api.aiohub.org/v1beta/files/{file}:download \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.aiohub.org/v1beta/files/{file}:download"
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/files/{file}:download', 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/files/{file}:download",
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/files/{file}:download"
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/files/{file}:download")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aiohub.org/v1beta/files/{file}:download")
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"<string>""<string>"{
"error": {
"code": 123,
"message": "<string>",
"status": "<string>"
}
}{
"error": {
"code": 123,
"message": "<string>",
"status": "<string>"
}
}{
"error": {
"code": 123,
"message": "<string>",
"status": "<string>"
}
}{
"error": {
"code": 123,
"message": "<string>",
"status": "<string>"
}
}{
"error": {
"code": 123,
"message": "<string>",
"status": "<string>"
}
}Download video · Gemini API
Download the video using the full video.uri returned by polling.
GET
/
v1beta
/
files
/
{file}
:download
Download Gemini video
curl --request GET \
--url https://api.aiohub.org/v1beta/files/{file}:download \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.aiohub.org/v1beta/files/{file}:download"
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/files/{file}:download', 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/files/{file}:download",
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/files/{file}:download"
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/files/{file}:download")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aiohub.org/v1beta/files/{file}:download")
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"<string>""<string>"{
"error": {
"code": 123,
"message": "<string>",
"status": "<string>"
}
}{
"error": {
"code": 123,
"message": "<string>",
"status": "<string>"
}
}{
"error": {
"code": 123,
"message": "<string>",
"status": "<string>"
}
}{
"error": {
"code": 123,
"message": "<string>",
"status": "<string>"
}
}{
"error": {
"code": 123,
"message": "<string>",
"status": "<string>"
}
}Replace
Use the full returned
<VIDEO_URL> with the returned response.generateVideoResponse.generatedSamples[0].video.uri:
curl --fail -L -o video.mp4 "<VIDEO_URL>" \
-H "Authorization: Bearer <AIOHUB_API_KEY>"
uri, including :download?alt=media. Do not construct a file name yourself. The Google GenAI SDK can download this URI through files.download.
file is the file name in the returned URL, not task_id or the entire URL. Use an API key belonging to the account that created the task. Files expire 72 hours after success and return 410 afterward.Authorizations
API key (sk-xxx)
Headers
Optional byte range, for example bytes=0-1023.
Path Parameters
File name between files/ and :download in the returned URI.
Example:
"7461736b5f6578616d706c65"
Query Parameters
Use media to download the binary file.
Available options:
media Response
MP4 video file.
The response is of type file.