Generate Images
November 17, 2025 (December 23, 2025)
Table of contents
Generate images using AI models Imagen 4, Nano Banana / Gemini 2.5 Flash Image, and Nano Banana Pro / Gemini 3 Pro Image from text prompts with optional reference images. Use any Google AI subscription or even free account for image generations.
This endpoint features dynamic concurrency management, allowing anywhere from 3 to 20 parallel generations depending on real-time capacity. If you receive a 429 Too Many Requests or 503 Service Unavailable response, simply wait 5-10 seconds before retrying—both status codes indicate temporary capacity constraints and are safe to retry. If you consistently receive 429 errors, you may need to execute a cool-off period of at least a few hours before trying again. Image generation typically completes within 10-20 seconds.
Important notes:
- Content moderation: If your generation is moderated, retrying with the same prompt often succeeds on subsequent attempts as moderation decisions can vary between requests. Alternatively, switching between
imagen-4,nano-banana, andnano-banana-promodels may help, as they have different content moderation behaviors. - 403 errors: If you receive
403errors often (high volume or percentage), this is most commonly caused by high volume calls from a single IP. See Configure Proxy for High Volume for details.
https://api.useapi.net/v1/google-flow/images
Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
# Alternatively you can use multipart/form-data
# Content-Type: multipart/form-data
API tokenis required, see Setup useapi.net for details.
Request Body
{
"prompt": "A serene mountain landscape at sunset with vibrant colors",
"model": "imagen-4",
"aspectRatio": "landscape",
"count": 4,
"seed": 123456
}
-
emailis optional. The email address of the Google Flow account to use.When only one account is configured, the API will automatically use that account.
With multiple accounts configured, omitting the email parameter triggers automatic load balancing based on image generation job statistics to select the healthiest account.
If reference images (
reference_1to_10) are provided, theemailparameter can be omitted—the API will automatically use the same account where the images were uploaded. promptis required, text description for image generation.modelis optional, the AI model to use for image generation (default:imagen-4).
Supported values:imagen-4,nano-banana,nano-banana-pro(Ultra accounts only).aspectRatiois optional, output image aspect ratio (default:landscape).
Supported values:landscape,portrait.countis optional, number of image variations to generate (1-4, default:4).seedis optional, random seed for reproducible results (integer ≥ 0).reference_1toreference_10are optional, usemediaGenerationIdfrom POST /assets/emailfor reference images.imagen-4andnano-bananasupport max 3 references,nano-banana-prosupports up to 10.replyUrlis optional, webhook URL for job status callbacks. Receives POST requests with job status updates (created,completed,failed). The JSON payload shape matches GET /jobs/jobIdresponse. Callbacks timeout after 5 seconds.replyRefis optional, custom reference string passed back in webhook callbacks. Useful for tracking jobs on your end.captchaRetryis optional, number of captcha retry attempts (1-10, default: 3). Cycles through configured captcha providers starting with EzCaptcha if available.captchaOrderis optional, explicit captcha provider sequence as comma-separated string (e.g.,"EzCaptcha,EzCaptcha,CapSolver"). Maximum 10 entries. Each provider must have an API key configured.
Note: captchaRetry and captchaOrder are mutually exclusive - only one can be specified per request.
Auto-detection: If model is not specified: >3 references selects nano-banana-pro, 1-3 references selects nano-banana, no references defaults to imagen-4.
Responses
-
Images generated successfully. Returns job ID and media array with generated image data.
{ "jobId": "j1731859345678i-u12345-email:jo***@gmail.com-bot:google-flow", "media": [ { "name": "…redacted…", "workflowId": "…redacted…", "image": { "generatedImage": { "seed": 123456, "mediaGenerationId": "user:12345…redacted…", "mediaVisibility": "PRIVATE", "prompt": "A serene mountain landscape at sunset with vibrant colors", "modelNameType": "IMAGEN_3_5", "workflowId": "…redacted…", "fifeUrl": "https://storage.googleapis.com/…redacted…", "aspectRatio": "IMAGE_ASPECT_RATIO_LANDSCAPE", "requestData": { "promptInputs": [ { "textInput": "A serene mountain landscape at sunset with vibrant colors" } ], "imageGenerationRequestData": { "imageGenerationImageInputs": [] } } } } } ], "captcha": { "service": "EzCaptcha", "taskId": "abc123...", "durationMs": 3500, "attempts": [ { "service": "EzCaptcha", "taskId": "abc123...", "durationMs": 3500, "success": true } ] } } -
Invalid request (validation error, reference count exceeded, email mismatch, or content policy violation).
General error:
{ "error": "Invalid request parameters" }Content policy error:
{ "error": { "code": 400, "message": "Request contains an invalid argument.", "status": "INVALID_ARGUMENT", "details": [ { "@type": "type.googleapis.com/google.rpc.ErrorInfo", "reason": "PUBLIC_ERROR_UNSAFE_GENERATION" } ] } } -
Invalid API token.
{ "error": "Unauthorized" } -
Subscription expired or insufficient credits.
{ "error": "Account has no subscription or subscription expired" } -
Request rejected by Google. This is most commonly caused by high volume calls from a single IP address. Google tags and blocks requests that appear automated.
Recommendations:
- Set up a residential proxy with sticky sessions and 15-30 minute IP rotation for high volume usage
- Less commonly, this can be caused by captcha token rejection - ensure you have multiple captcha providers configured
{ "code": 403, "created": "2025-12-23T21:54:26.393Z", "error": "API error: 403", "jobid": "j1223215426393445325i-u12345-email:us***@gmail.com-bot:google-flow", "request": { "aspectRatio": "portrait", "count": 4, "email": "us***@gmail.com", "model": "nano-banana-pro", "prompt": "A serene mountain landscape at sunset", "reference_1": { "email": "us***@gmail.com", "id": "CAMaJDMxZGNl...***...YmUwMmM", "referenceId": "user:12345-email:***-image:CAMaJDMxZGNl...***...YmUwMmM", "type": "image", "user": 12345 } }, "response": { "captcha": { "attempts": [ { "service": "EzCaptcha", "taskId": "14af1dbb-885c-4e25-8121-7a79489dfd0e", "durationMs": 5357, "success": true }, { "service": "EzCaptcha", "taskId": "fd044078-0a4a-4303-a585-26fd5d2acb00", "durationMs": 5376, "success": true }, { "service": "EzCaptcha", "taskId": "ab0251dc-6930-4a82-966a-71fe6ab6aa42", "durationMs": 5789, "success": true } ], "durationMs": 18091, "service": "EzCaptcha", "taskId": "ab0251dc-6930-4a82-966a-71fe6ab6aa42" }, "error": { "code": 403, "details": [ { "@type": "type.googleapis.com/google.rpc.ErrorInfo", "reason": "PUBLIC_ERROR_SOMETHING_WENT_WRONG" } ], "message": "reCAPTCHA evaluation failed", "status": "PERMISSION_DENIED" } }, "status": "failed", "type": "image", "updated": "2025-12-23T21:54:45.319Z" } -
Account not found or not configured.
{ "error": "Google Flow account [email protected] not found" } -
Rate limit or quota exhausted (concurrency limit or account quota reached). Wait 5-10 seconds and retry. If this persists, you may need to cool this account off for a few hours before trying again.
Concurrency/rate limit error:
{ "error": { "code": 429, "message": "Resource has been exhausted (e.g. check quota).", "status": "RESOURCE_EXHAUSTED", "details": [ { "@type": "type.googleapis.com/google.rpc.ErrorInfo", "reason": "PUBLIC_ERROR_USER_REQUESTS_THROTTLED" } ] } }Per-model daily quota reached (e.g., using
nano-banana-proon non-Ultra account):{ "error": { "code": 429, "message": "Resource has been exhausted (e.g. check quota).", "status": "RESOURCE_EXHAUSTED", "details": [ { "@type": "type.googleapis.com/google.rpc.ErrorInfo", "reason": "PUBLIC_ERROR_PER_MODEL_DAILY_QUOTA_REACHED", "metadata": { "canUpgradeForQuota": "true" } } ] } } -
One or more generated images were moderated by Google’s content policy. Try one of the following:
- Switch to
imagen-4model (often successfully processes prompts rejected bynano-banana) - Modify your prompt or remove/change reference images
- Retry the same request (moderation decisions can vary between attempts)
{ "error": { "code": 500, "message": "Internal error encountered.", "status": "INTERNAL" } } - Switch to
-
Service temporarily unavailable. Wait 5-10 seconds and retry.
{ "error": { "code": 503, "message": "Service temporarily unavailable.", "status": "UNAVAILABLE", "details": [ { "@type": "type.googleapis.com/google.rpc.ErrorInfo", "reason": "SERVICE_UNAVAILABLE" } ] } } -
Google session refresh failed. The account cookies needs to be updated following the instructions in Setup Google Flow.
{ "error": "Failed to refresh session." }
Model
jobId- Unique job identifier (for use with GET /jobs/jobId)media- Array of generated images (1-4 images based oncount)media[].image.generatedImage- Generated image data objectgeneratedImage.fifeUrl- Direct signed URL to access the generated image (valid for limited time)generatedImage.seed- Seed used for this generation (for reproducibility)generatedImage.mediaGenerationId- mediaGenerationId for use in subsequent API callsgeneratedImage.prompt- The prompt used for generationgeneratedImage.modelNameType- Model variant used (IMAGEN_3_5,R2I,GEM_PIX)generatedImage.aspectRatio- Generated image aspect ratio (IMAGE_ASPECT_RATIO_LANDSCAPEorIMAGE_ASPECT_RATIO_PORTRAIT)generatedImage.mediaVisibility- Visibility setting (always “PRIVATE”)generatedImage.workflowId- Unique workflow identifiergeneratedImage.requestData- Request data used for this generation including prompt inputs and reference imagesmedia[].name- Internal identifier for the media itemmedia[].workflowId- Unique workflow identifier for this generationcaptcha- Captcha metadata for debugging/researchcaptcha.service- Provider that returned the successful tokencaptcha.taskId- Task ID from the captcha servicecaptcha.durationMs- Total time for all captcha attemptscaptcha.attempts- Array of all captcha attempts (including failures)
{
jobId: string // Job identifier
media: Array<{
name: string // Internal media identifier
workflowId: string // Unique workflow ID
image: {
generatedImage: {
seed: number
mediaGenerationId: string // Format: user:{userid}-email:{hex}-image:{id}
mediaVisibility: string // "PRIVATE"
prompt: string
modelNameType: string // "IMAGEN_3_5" | "R2I" | "GEM_PIX"
workflowId: string
fifeUrl: string // Direct signed URL to generated image
aspectRatio: string // "IMAGE_ASPECT_RATIO_LANDSCAPE" | "IMAGE_ASPECT_RATIO_PORTRAIT"
requestData: {
promptInputs: Array<{
textInput: string
}>
imageGenerationRequestData: {
imageGenerationImageInputs: Array<{
mediaGenerationId: string
imageInputType: string // "IMAGE_INPUT_TYPE_REFERENCE"
}>
}
}
}
}
}>
captcha?: { // Captcha metadata
service: string // "EzCaptcha" | "CapSolver" | "YesCaptcha"
taskId: string
durationMs: number
attempts: Array<{
service: string
taskId?: string
durationMs: number
success: boolean
error?: string
}>
}
error?: string | { // Error: string (useapi.net) or object (Google API)
code: number
message: string
status: string
details: Array<{
'@type': string
reason: string
metadata?: {
canUpgradeForQuota: boolean
}
}>
}
}
Examples
-
curl -X POST \ -H "Authorization: Bearer YOUR_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "prompt": "A serene mountain landscape at sunset with vibrant colors", "model": "imagen-4", "aspectRatio": "landscape", "count": 4, "seed": 123456 }' \ "https://api.useapi.net/v1/google-flow/images" > response.json # Download images using fifeUrl curl -o image_1.jpg "$(cat response.json | jq -r '.media[0].image.generatedImage.fifeUrl')" curl -o image_2.jpg "$(cat response.json | jq -r '.media[1].image.generatedImage.fifeUrl')" # Continue for remaining images... -
const token = 'YOUR_API_TOKEN'; const apiUrl = 'https://api.useapi.net/v1/google-flow/images'; const response = await fetch(apiUrl, { method: 'POST', headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ prompt: 'A serene mountain landscape at sunset with vibrant colors', model: 'imagen-4', aspectRatio: 'landscape', count: 4, seed: 123456 }) }); const result = await response.json(); console.log('Generated images:', result.media.length); // Download and save images for (const [index, item] of result.media.entries()) { const img = item.image.generatedImage; console.log(`Image ${index + 1} seed:`, img.seed); console.log(`mediaGenerationId:`, img.mediaGenerationId); // Download image from fifeUrl const imageResponse = await fetch(img.fifeUrl); const imageBlob = await imageResponse.blob(); // In Node.js with fs: // const buffer = Buffer.from(await imageBlob.arrayBuffer()); // require('fs').writeFileSync(`generated_image_${index + 1}.jpg`, buffer); // In browser: create download link or display in <img> element // const url = URL.createObjectURL(imageBlob); // document.querySelector('img').src = url; } -
import requests token = 'YOUR_API_TOKEN' api_url = 'https://api.useapi.net/v1/google-flow/images' headers = { 'Authorization': f'Bearer {token}', 'Content-Type': 'application/json' } data = { 'prompt': 'A serene mountain landscape at sunset with vibrant colors', 'model': 'imagen-4', 'aspectRatio': 'landscape', 'count': 4, 'seed': 123456 } response = requests.post(api_url, headers=headers, json=data) result = response.json() print(f"Generated {len(result['media'])} images") # Download and save images for index, item in enumerate(result['media']): img = item['image']['generatedImage'] print(f"Image {index + 1} seed:", img['seed']) print(f"mediaGenerationId:", img['mediaGenerationId']) # Download image from fifeUrl image_response = requests.get(img['fifeUrl']) with open(f'generated_image_{index + 1}.jpg', 'wb') as f: f.write(image_response.content)
Examples with Proxy
For high volume usage, route requests through a residential proxy. See Configure Proxy for High Volume for details.
-
# Generate images curl -x "http://user:pass@proxy-host:port" \ -H "Authorization: Bearer YOUR_API_TOKEN" \ -H "Content-Type: application/json" \ -X POST "https://api.useapi.net/v1/google-flow/images" \ -d '{"prompt": "A serene mountain landscape", "model": "imagen-4", "count": 4}' \ -o response.json # Download images (also through proxy) curl -x "http://user:pass@proxy-host:port" \ -o image_1.jpg "$(jq -r '.media[0].image.generatedImage.fifeUrl' response.json)" curl -x "http://user:pass@proxy-host:port" \ -o image_2.jpg "$(jq -r '.media[1].image.generatedImage.fifeUrl' response.json)" # Continue for remaining images... -
// Using axios (npm install axios) import axios from 'axios' import fs from 'fs' const proxy = { host: 'proxy-host', port: 8080, auth: { username: 'user', password: 'pass' } } const response = await axios.post( 'https://api.useapi.net/v1/google-flow/images', { prompt: 'A serene mountain landscape', model: 'imagen-4', count: 4 }, { headers: { 'Authorization': 'Bearer YOUR_API_TOKEN' }, proxy } ) const result = response.data console.log('Generated images:', result.media.length) // Download and save images for (const [index, item] of result.media.entries()) { const img = item.image.generatedImage console.log(`Image ${index + 1} seed:`, img.seed) // Download image (also through proxy) const imageResponse = await axios.get(img.fifeUrl, { responseType: 'arraybuffer', proxy }) fs.writeFileSync(`generated_image_${index + 1}.jpg`, imageResponse.data) } -
import requests proxies = { 'http': 'http://user:pass@proxy-host:port', 'https': 'http://user:pass@proxy-host:port' } response = requests.post( 'https://api.useapi.net/v1/google-flow/images', headers={'Authorization': 'Bearer YOUR_API_TOKEN'}, json={ 'prompt': 'A serene mountain landscape', 'model': 'imagen-4', 'count': 4 }, proxies=proxies ) result = response.json() print(f"Generated {len(result['media'])} images") # Download and save images for index, item in enumerate(result['media']): img = item['image']['generatedImage'] print(f"Image {index + 1} seed:", img['seed']) # Download image (also through proxy) image_response = requests.get(img['fifeUrl'], proxies=proxies) with open(f'generated_image_{index + 1}.jpg', 'wb') as f: f.write(image_response.content)