提交视频生成任务
curl --request POST \
--url https://api.maxapi.ai/aistudio/v1beta/models/{model}:predictLongRunning \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"instances": [
{
"prompt": "A cat playing with a ball in a sunny garden"
}
],
"parameters": {
"aspectRatio": "16:9",
"durationSeconds": 8,
"sampleCount": 1,
"personGeneration": "allow_all"
}
}
'import requests
url = "https://api.maxapi.ai/aistudio/v1beta/models/{model}:predictLongRunning"
payload = {
"instances": [{ "prompt": "A cat playing with a ball in a sunny garden" }],
"parameters": {
"aspectRatio": "16:9",
"durationSeconds": 8,
"sampleCount": 1,
"personGeneration": "allow_all"
}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
instances: [{prompt: 'A cat playing with a ball in a sunny garden'}],
parameters: {
aspectRatio: '16:9',
durationSeconds: 8,
sampleCount: 1,
personGeneration: 'allow_all'
}
})
};
fetch('https://api.maxapi.ai/aistudio/v1beta/models/{model}:predictLongRunning', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.maxapi.ai/aistudio/v1beta/models/{model}:predictLongRunning"
payload := strings.NewReader("{\n \"instances\": [\n {\n \"prompt\": \"A cat playing with a ball in a sunny garden\"\n }\n ],\n \"parameters\": {\n \"aspectRatio\": \"16:9\",\n \"durationSeconds\": 8,\n \"sampleCount\": 1,\n \"personGeneration\": \"allow_all\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<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://api.maxapi.ai/aistudio/v1beta/models/{model}:predictLongRunning")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"instances\": [\n {\n \"prompt\": \"A cat playing with a ball in a sunny garden\"\n }\n ],\n \"parameters\": {\n \"aspectRatio\": \"16:9\",\n \"durationSeconds\": 8,\n \"sampleCount\": 1,\n \"personGeneration\": \"allow_all\"\n }\n}")
.asString();{
"name": "projects/jhcj-0108-02/locations/us-central1/publishers/google/models/veo-3.1-fast-generate-preview/operations/de44639e-6005-46df-954b-99ee6601393f"
}实际路径: /vertex/v1/publishers/google/models/:predictLongRunning
POST
https://api.maxapi.ai
/
aistudio
/
v1beta
/
models
/
{model}
:predictLongRunning
提交视频生成任务
curl --request POST \
--url https://api.maxapi.ai/aistudio/v1beta/models/{model}:predictLongRunning \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"instances": [
{
"prompt": "A cat playing with a ball in a sunny garden"
}
],
"parameters": {
"aspectRatio": "16:9",
"durationSeconds": 8,
"sampleCount": 1,
"personGeneration": "allow_all"
}
}
'import requests
url = "https://api.maxapi.ai/aistudio/v1beta/models/{model}:predictLongRunning"
payload = {
"instances": [{ "prompt": "A cat playing with a ball in a sunny garden" }],
"parameters": {
"aspectRatio": "16:9",
"durationSeconds": 8,
"sampleCount": 1,
"personGeneration": "allow_all"
}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
instances: [{prompt: 'A cat playing with a ball in a sunny garden'}],
parameters: {
aspectRatio: '16:9',
durationSeconds: 8,
sampleCount: 1,
personGeneration: 'allow_all'
}
})
};
fetch('https://api.maxapi.ai/aistudio/v1beta/models/{model}:predictLongRunning', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.maxapi.ai/aistudio/v1beta/models/{model}:predictLongRunning"
payload := strings.NewReader("{\n \"instances\": [\n {\n \"prompt\": \"A cat playing with a ball in a sunny garden\"\n }\n ],\n \"parameters\": {\n \"aspectRatio\": \"16:9\",\n \"durationSeconds\": 8,\n \"sampleCount\": 1,\n \"personGeneration\": \"allow_all\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<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://api.maxapi.ai/aistudio/v1beta/models/{model}:predictLongRunning")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"instances\": [\n {\n \"prompt\": \"A cat playing with a ball in a sunny garden\"\n }\n ],\n \"parameters\": {\n \"aspectRatio\": \"16:9\",\n \"durationSeconds\": 8,\n \"sampleCount\": 1,\n \"personGeneration\": \"allow_all\"\n }\n}")
.asString();{
"name": "projects/jhcj-0108-02/locations/us-central1/publishers/google/models/veo-3.1-fast-generate-preview/operations/de44639e-6005-46df-954b-99ee6601393f"
}授权
格式: Bearer {api_key}
路径参数
模型: veo-3.1-fast-generate-preview 等
请求体
application/json
响应
200 - application/json
成功