Generate an image with gemini-3-pro-image
curl --request POST \
--url https://api.yingtu.ai/v1beta/models/gemini-3-pro-image:generateContent \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contents": [
{
"role": "user",
"parts": [
{
"text": "A single yellow ceramic banana on a matte white background, soft studio lighting, no text."
}
]
}
]
}
'import requests
url = "https://api.yingtu.ai/v1beta/models/gemini-3-pro-image:generateContent"
payload = { "contents": [
{
"role": "user",
"parts": [{ "text": "A single yellow ceramic banana on a matte white background, soft studio lighting, no text." }]
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
contents: [
{
role: 'user',
parts: [
{
text: 'A single yellow ceramic banana on a matte white background, soft studio lighting, no text.'
}
]
}
]
})
};
fetch('https://api.yingtu.ai/v1beta/models/gemini-3-pro-image:generateContent', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"candidates": [
{
"content": {
"role": "model",
"parts": [
{
"inlineData": {
"mimeType": "image/jpeg",
"data": "BASE64_IMAGE_DATA"
}
}
]
},
"finishReason": "STOP",
"index": 0
}
],
"usageMetadata": {
"promptTokenCount": 37,
"candidatesTokenCount": 1846,
"totalTokenCount": 1883,
"promptTokensDetails": [
{
"modality": "TEXT",
"tokenCount": 37
}
],
"candidatesTokensDetails": [
{
"modality": "IMAGE",
"tokenCount": 1680
}
]
},
"modelVersion": "gemini-3-pro-image",
"responseId": "response_example"
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "<string>"
}
}Gemini 3 Pro Image
Gemini 3 Pro Image 示例
生成 4K Nano Banana Pro 图片、提交异步任务并安全处理大型 JPEG 响应。
POST
/
v1beta
/
models
/
gemini-3-pro-image:generateContent
Generate an image with gemini-3-pro-image
curl --request POST \
--url https://api.yingtu.ai/v1beta/models/gemini-3-pro-image:generateContent \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contents": [
{
"role": "user",
"parts": [
{
"text": "A single yellow ceramic banana on a matte white background, soft studio lighting, no text."
}
]
}
]
}
'import requests
url = "https://api.yingtu.ai/v1beta/models/gemini-3-pro-image:generateContent"
payload = { "contents": [
{
"role": "user",
"parts": [{ "text": "A single yellow ceramic banana on a matte white background, soft studio lighting, no text." }]
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
contents: [
{
role: 'user',
parts: [
{
text: 'A single yellow ceramic banana on a matte white background, soft studio lighting, no text.'
}
]
}
]
})
};
fetch('https://api.yingtu.ai/v1beta/models/gemini-3-pro-image:generateContent', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"candidates": [
{
"content": {
"role": "model",
"parts": [
{
"inlineData": {
"mimeType": "image/jpeg",
"data": "BASE64_IMAGE_DATA"
}
}
]
},
"finishReason": "STOP",
"index": 0
}
],
"usageMetadata": {
"promptTokenCount": 37,
"candidatesTokenCount": 1846,
"totalTokenCount": 1883,
"promptTokensDetails": [
{
"modality": "TEXT",
"tokenCount": 37
}
],
"candidatesTokensDetails": [
{
"modality": "IMAGE",
"tokenCount": 1680
}
]
},
"modelVersion": "gemini-3-pro-image",
"responseId": "response_example"
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "<string>"
}
}curl 'https://api.yingtu.ai/v1beta/models/gemini-3-pro-image:generateContent' \
-H 'Authorization: Bearer YOUR_YINGTU_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"contents": [{"role": "user", "parts": [{"text": "反射细节准确的高端腕表广告图"}]}],
"generationConfig": {
"responseModalities": ["TEXT", "IMAGE"],
"imageConfig": {"aspectRatio": "1:1", "imageSize": "4K"}
}
}'
{
"candidates": [{
"content": {"role": "model", "parts": [{
"inlineData": {"mimeType": "image/jpeg", "data": "BASE64_IMAGE_DATA"}
}]},
"finishReason": "STOP",
"index": 0
}],
"usageMetadata": {
"promptTokenCount": 35,
"candidatesTokenCount": 2086,
"thoughtsTokenCount": 120,
"totalTokenCount": 2241
},
"modelVersion": "gemini-3-pro-image",
"responseId": "response_example"
}
:asyncGenerateContent。实测 1K 任务
返回 HTTP 202,经过六次查询完成。查询次数只是一次观测,不应写成固定等待时间。
解码后应尽快把图片转存到自有对象存储,不要长期保留任务响应中的 Base64。
在线测试
本页交互面板固定调用gemini-3-pro-image:generateContent。建议先保留预填的 1K
请求,输入开发凭证后直接点击 试一试;成品需要更高分辨率时再改为 4K。
Pro 请求会真实计费。Mintlify 会在生成的 cURL 中显示已输入的 Key,请勿分享带凭证的截图。
授权
YingTu API key.
请求体
application/json
响应
Complete Gemini response
Show child attributes
Show child attributes
Show child attributes
Show child attributes
The model version that produced the response.
示例:
"gemini-3-pro-image"
Provider response identifier.
示例:
"response_example"
Creation time when supplied by the selected model channel.