Skip to content

Image Generation ​

Text-to-image POST /v1/images/generations · Image-to-image POST /v1/images/edits · Token group media / media-gen

Available Models ​

Model nameDescriptionResolutionReference images
gpt-image-2OpenAI image model · Same price for 1K / 2K / 4K1K · 2K · 4K≤6
gpt-image-2.5OpenAI image model (newer generation) · Same price for 1K / 2K / 4K1K · 2K · 4K≤6
gemini-3.0-pro-image-ultraGoogle Gemini 3 Pro Image (Nano Banana Pro) · Same price for 1K / 2K / 4K1K · 2K · 4K≤1
gemini-3.1-flash-image-ultraGoogle Gemini 3.1 Flash Image (Nano Banana 2) · Same price for 1K / 2K / 4K1K · 2K · 4K≤1
gemini-nano-banana-2.1-ultraGoogle Nano Banana 2.1 · Same price for 1K / 2K / 4K1K · 2K · 4K≤1

The three Gemini models use POST /v1beta/models/{model}:generateContent. Put the prompt and reference image in contents[].parts; set generationConfig.imageConfig (aspectRatio / imageSize: "1K" / "2K" / "4K"). Image results are in candidates[].content.parts, as inlineData (base64) or fileData.fileUri (image URL). The playground handles both automatically.

Express resolution / aspect ratio via the size parameter

In the API, pass size (width x height in pixels) to set the aspect ratio. Examples: "1024x1024" = 1:1, "1024x576" = 16:9. In the playground, just click to select. See live pricing in the Generation Playground.

Easiest: Use the Generation Playground ​

  1. Open the Generation Playground and stay on the "🖼 Image" tab
  2. Enter your token (from the media / media-gen group)
  3. Pick a model → write your prompt → choose an aspect ratio / resolution → click "Generate"
  4. Once the image is ready you can download it directly, and your history is kept too

Image-to-Image (Reference Images) ​

Upload reference images and let the model generate or edit based on them (change the style, tweak details, combine multiple images, and more):

  • Playground: click the "Reference image" area to upload — multiple images supported (limits per the table above, each ≤8MB)
  • API: use POST /v1/images/edits (multipart; the image file field can be passed multiple times), see Calling via the API

Supported Aspect Ratios ​

Commonly 1:1 · 16:9 · 9:16 · 4:3 · 3:4; some models also support 21:9, 3:2, 2:3, etc. — go by the options shown for that model in the Generation Playground.

How to Write Prompts ​

  • Be specific: subject + scene + style + lighting. Example: "At dusk, a golden retriever running through a golden wheat field, cinematic, shallow depth of field"
  • If you want a certain quality or style (realistic, illustration, 3D, cyberpunk, etc.), just say so
  • Both Chinese and English work

Integrating Into Your Program ​

For the full API format plus code examples, see Calling via the API. If something goes wrong, check Common Errors.

Got a problem? Contact support or join our group.