Skip to main content
Generate images from text with the Images API or native Gemini API. Use GPT image models to edit existing images with prompts, masks, or markup.

Generate images

Send JSON to POST https://api.floodgate.dev/v1/images/generations.
Token-priced GPT image models accept n from 1 to 10. Models ending in -c accept one image per request. For gemini-3.1-flash-image in the Standard group, use n: 1, response_format: "b64_json", and omit quality. Other image models have their own settings in Model Square.

Edit images

Send an image and prompt to POST https://api.floodgate.dev/v1/images/edits.
For multiple references, repeat -F "image[]=@input.png". Up to 16 input images are accepted, subject to the selected model’s limits. You can also send JSON with an images array:
Replace the example URL with an accessible image. For targeted edits, add either:
  • -F "mask=@mask.png;type=image/png": transparent regions select areas to change.
  • -F "markup=@markup.png;type=image/png": GPT Image 2.6 accepts a transparent PNG annotation layer aligned with the first input image. Describe the change in your prompt.
Use one mask or markup layer, not both. Generation and editing must each be available for your selected model and group.

GPT image settings

Higher quality can increase cost and generation time. Complexity controls planning separately from image quality.
Token-priced GPT Image 2 and later models accept custom WIDTHxHEIGHT values such as 1536x864. Both dimensions must be multiples of 16, neither edge may exceed 3,840 pixels, the aspect ratio must be between 1:3 and 3:1, and total pixels must be between 655,360 and 8,294,400.Per-request -c models also accept 1K, 2K, or 4K, depending on the group. Check the model’s allowed settings in Model Square.
Streaming, GIF, and SVG output are not included in this update.

Image models

Choose an available model and routing group in your API key settings, or use smart routing. Model Square shows current prices and supported operations.

GPT image models

Earlier models remain available where listed in Model Square: gpt-image-1, gpt-image-1-mini, gpt-image-1.5, gpt-image-2, gpt-image-2.5-flare, and gpt-image-2.5-sunburst. The gpt-image-2-c, gpt-image-2.5-flare-c, and gpt-image-2.5-sunburst-c variants use per-request pricing.

Native Gemini API

Put the model ID in the URL and include IMAGE in responseModalities.
Send one content item with one text part and candidateCount: 1. Choose 1K or 2K for imageSize. Decode inlineData.data using its inlineData.mimeType.

Responses and pricing

Images API results contain data[].b64_json or data[].url. Decode the base64 data or download the returned URL promptly. Do not send your Floodgate API key to an image download host. Token-priced GPT images charge actual text input, image input, and output usage. Cache discounts apply when reported; otherwise normal input rates apply. Batch usage already includes all outputs, so do not multiply the token counts by n again. Models ending in -c use the selected group’s per-request price. See Billing for reserved funds and account discounts, and your usage logs for the charge breakdown. For request errors, see Troubleshooting.