Choose an image API
Generate GPT images
Generate GPT images and read the Base64 image data.
Edit GPT images
Upload source images and request a prompt-driven edit.
Generate Nano Banana images
Generate or edit images with Gemini generateContent.
Generate Grok images
Generate Grok images with URL or Base64 results.
Edit Grok images
Send source image URLs or data URIs in a JSON request.
Retrieve a GPT image task
Poll a GPT image request submitted with async enabled.
Generate an image
The examples below generate one GPT image withgpt-image-2. For Nano Banana or Grok, use the corresponding reference above.
Response example
GPT Image returns Base64 image data indata[].b64_json. Decode that value and save the image bytes. The response uses this shape:
Common errors
Invalid model ID
Invalid model ID
Choose an image-capable model from the Models page.
Unsupported size
Unsupported size
Use a size that the selected image endpoint accepts.
Expired result URL
Expired result URL
Download Grok URL results promptly after generation completes.
Upload too large
Upload too large
Reduce the source image file size before sending the request again.
Missing image data
Missing image data
Read
b64_json for GPT Image, final inlineData for Nano Banana, or the requested URL or Base64 field for Grok.Error codes and retry strategy
400
400
Do not retry until the prompt, size, or image input is fixed.
401
401
Do not retry until the API key is present and valid.
404
404
Check the base URL, path, and model ID before retrying.
413
413
Reduce upload size before retrying.
429
429
Retry with exponential backoff and reduce concurrency.
500 or 503
500 or 503
Retry with backoff for transient service errors.
Pricing and model directory
Models page
Read how RunBridge AI exposes model IDs in the docs.
Model directory
Browse model availability and capabilities.
Pricing
Check pricing before you call a model.