鉴权与连接
- Base URL
https://host.docker.internal:8000- Authorization
Authorization: Bearer YOUR_API_KEY- Content-Type
application/json- 模型名 (model)
gemini-omni-flash-preview
接入协议
为什么选这个协议
适合使用 Google Interactions 原生接口提交多模态视频任务并轮询状态的用户。
接口地址
POST/v1beta/interactions
Authorization: Bearer YOUR_API_KEYContent-Type: application/json请求 / 响应 JSON
// REQUEST
{
"model": "gemini-omni-flash-preview",
"background": true,
"input": [
{
"type": "image",
"data": "BASE64_IMAGE_DATA",
"mime_type": "image/jpeg"
},
{
"type": "text",
"text": "让参考图中的主体自然运动,保持外观一致,使用单一连续镜头。"
}
],
"generation_config": {
"video_config": {
"task": "image_to_video"
}
},
"response_format": {
"type": "video",
"aspect_ratio": "16:9",
"delivery": "uri"
}
}// RESPONSE
{
"id": "interaction_example",
"object": "interaction",
"status": "completed",
"model": "gemini-omni-flash-preview",
"steps": [
{
"type": "model_output",
"content": [
{
"type": "video",
"mime_type": "video/mp4",
"uri": "https://host.docker.internal:8000/v1beta/files/file_example:download"
}
]
}
],
"usage": {
"total_input_tokens": 22,
"total_output_tokens": 58805,
"total_tokens": 59183
}
}请求字段 / 响应字段
// INPUT SCHEMA
| 字段 | 类型 | 必填 |
|---|---|---|
| model | string | Y |
| background | boolean | Y |
| input | array | Y |
| input[] | object | Y |
| input[].type | string | Y |
| input[].data | string | Y |
| input[].mime_type | string | Y |
| generation_config | object | Y |
| generation_config.video_config | object | Y |
| generation_config.video_config.task | string | Y |
| response_format | object | Y |
| response_format.type | string | Y |
| response_format.aspect_ratio | string | Y |
| response_format.delivery | string | Y |
// RESPONSE SCHEMA
| 字段 | 类型 | 必填 |
|---|---|---|
| id | string | Y |
| object | string | Y |
| status | string | Y |
| model | string | Y |
| steps | array | Y |
| steps[] | object | Y |
| steps[].type | string | Y |
| steps[].content | array | Y |
| steps[].content[] | object | Y |
| steps[].content[].type | string | Y |
| steps[].content[].mime_type | string | Y |
| steps[].content[].uri | string | Y |
| usage | object | Y |
| usage.total_input_tokens | integer | Y |
| usage.total_output_tokens | integer | Y |
| usage.total_tokens | integer | Y |
代码示例
cURLrequest.sh
curl -X POST "https://host.docker.internal:8000/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "gemini-omni-flash-preview",
"background": true,
"input": [
{
"type": "image",
"data": "BASE64_IMAGE_DATA",
"mime_type": "image/jpeg"
},
{
"type": "text",
"text": "让参考图中的主体自然运动,保持外观一致,使用单一连续镜头。"
}
],
"generation_config": {
"video_config": {
"task": "image_to_video"
}
},
"response_format": {
"type": "video",
"aspect_ratio": "16:9",
"delivery": "uri"
}
}'
# 查询任务状态 cURL
# 将 interaction_example 替换为提交响应返回的 interaction_id
curl -X GET "https://host.docker.internal:8000/v1beta/interactions/interaction_example" \
-H "Authorization: Bearer YOUR_API_KEY"