Gemini predictLongRunning
curl --request POST \
--url https://maas.apigo.ai/v1beta/models/{model}:predictLongRunning \
--header 'Content-Type: application/json' \
--header 'x-goog-api-key: <api-key>' \
--data '
{
"instances": [
{
"prompt": "一只小猫在花园中奔跑"
}
],
"parameters": {
"durationSeconds": 5,
"aspectRatio": "16:9"
}
}
'import requests
url = "https://maas.apigo.ai/v1beta/models/{model}:predictLongRunning"
payload = {
"instances": [{ "prompt": "一只小猫在花园中奔跑" }],
"parameters": {
"durationSeconds": 5,
"aspectRatio": "16:9"
}
}
headers = {
"x-goog-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-goog-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
instances: [{prompt: '一只小猫在花园中奔跑'}],
parameters: {durationSeconds: 5, aspectRatio: '16:9'}
})
};
fetch('https://maas.apigo.ai/v1beta/models/{model}:predictLongRunning', 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://maas.apigo.ai/v1beta/models/{model}:predictLongRunning",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'instances' => [
[
'prompt' => '一只小猫在花园中奔跑'
]
],
'parameters' => [
'durationSeconds' => 5,
'aspectRatio' => '16:9'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-goog-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://maas.apigo.ai/v1beta/models/{model}:predictLongRunning"
payload := strings.NewReader("{\n \"instances\": [\n {\n \"prompt\": \"一只小猫在花园中奔跑\"\n }\n ],\n \"parameters\": {\n \"durationSeconds\": 5,\n \"aspectRatio\": \"16:9\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-goog-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://maas.apigo.ai/v1beta/models/{model}:predictLongRunning")
.header("x-goog-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"instances\": [\n {\n \"prompt\": \"一只小猫在花园中奔跑\"\n }\n ],\n \"parameters\": {\n \"durationSeconds\": 5,\n \"aspectRatio\": \"16:9\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://maas.apigo.ai/v1beta/models/{model}:predictLongRunning")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-goog-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"instances\": [\n {\n \"prompt\": \"一只小猫在花园中奔跑\"\n }\n ],\n \"parameters\": {\n \"durationSeconds\": 5,\n \"aspectRatio\": \"16:9\"\n }\n}"
response = http.request(request)
puts response.read_body{
"name": "operations/abc123",
"done": false,
"metadata": {
"progressPercent": 0
}
}{
"error": 123,
"message": "<string>"
}Video
/v1beta/models/{model}:predictLongRunning
Veo 비디오 생성과 같은 장기 실행 Gemini 예측 작업을 제출합니다.
POST
/
v1beta
/
models
/
{model}
:predictLongRunning
Gemini predictLongRunning
curl --request POST \
--url https://maas.apigo.ai/v1beta/models/{model}:predictLongRunning \
--header 'Content-Type: application/json' \
--header 'x-goog-api-key: <api-key>' \
--data '
{
"instances": [
{
"prompt": "一只小猫在花园中奔跑"
}
],
"parameters": {
"durationSeconds": 5,
"aspectRatio": "16:9"
}
}
'import requests
url = "https://maas.apigo.ai/v1beta/models/{model}:predictLongRunning"
payload = {
"instances": [{ "prompt": "一只小猫在花园中奔跑" }],
"parameters": {
"durationSeconds": 5,
"aspectRatio": "16:9"
}
}
headers = {
"x-goog-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-goog-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
instances: [{prompt: '一只小猫在花园中奔跑'}],
parameters: {durationSeconds: 5, aspectRatio: '16:9'}
})
};
fetch('https://maas.apigo.ai/v1beta/models/{model}:predictLongRunning', 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://maas.apigo.ai/v1beta/models/{model}:predictLongRunning",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'instances' => [
[
'prompt' => '一只小猫在花园中奔跑'
]
],
'parameters' => [
'durationSeconds' => 5,
'aspectRatio' => '16:9'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-goog-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://maas.apigo.ai/v1beta/models/{model}:predictLongRunning"
payload := strings.NewReader("{\n \"instances\": [\n {\n \"prompt\": \"一只小猫在花园中奔跑\"\n }\n ],\n \"parameters\": {\n \"durationSeconds\": 5,\n \"aspectRatio\": \"16:9\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-goog-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://maas.apigo.ai/v1beta/models/{model}:predictLongRunning")
.header("x-goog-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"instances\": [\n {\n \"prompt\": \"一只小猫在花园中奔跑\"\n }\n ],\n \"parameters\": {\n \"durationSeconds\": 5,\n \"aspectRatio\": \"16:9\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://maas.apigo.ai/v1beta/models/{model}:predictLongRunning")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-goog-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"instances\": [\n {\n \"prompt\": \"一只小猫在花园中奔跑\"\n }\n ],\n \"parameters\": {\n \"durationSeconds\": 5,\n \"aspectRatio\": \"16:9\"\n }\n}"
response = http.request(request)
puts response.read_body{
"name": "operations/abc123",
"done": false,
"metadata": {
"progressPercent": 0
}
}{
"error": 123,
"message": "<string>"
}이 엔드포인트를 사용하여 Veo 스타일의 장기 실행 비디오 생성 요청을 제출하세요.
- 일반적인 인증 패턴은
x-goog-api-key: {API_KEY}이지만 쿼리 문자열 API 키도 지원됩니다. - 이 엔드포인트는 최종 비디오 콘텐츠가 아닌 장기 실행 작업 핸들을 반환합니다.
- 나중에 폴링하기 위해 반환된 작업 이름 또는 ID를 유지합니다.
- 완료를 추적하려면
/v1beta/operations/{operation_id}를 폴링해야 합니다.
⌘I
