Skip to main content
Gemini Native (Image)
Generate and edit images with Gemini using native Content parts and generationConfig settings. POST https://api.mixroute.ai/v1/models/{model}:generateContent

Models

Request Parameters

Model Constraints

1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9 Gemini 3.1 Flash Image additionally supports 1:4, 4:1, 1:8, and 8:1. Only use sizes/aspect ratios supported by the selected model. Gemini 3 image models support up to 14 reference images with model-specific subject limits; Lite is optimized for lightweight workflows. The image API is not controlled by an OpenAI n or size field.

Examples

Use your MixRoute key in the MIXROUTE_API_KEY environment variable. Requests use Authorization: Bearer .... Replace source-image placeholders with accessible images or local files before editing.

Python

Image Editing and Conversation

For editing, add an inlineData image part to the user turn alongside the text instruction. For a subsequent edit, append the complete prior candidate.content object to contents and then add the next user turn; this retains native image data and thought signatures. Do not replace the model history with text alone.

Response

Read text and image parts from candidates[].content.parts[]. Images normally use inlineData with mimeType and Base64 data; preserve thoughtSignature when reusing model turns. Check promptFeedback and finishReason when an image is absent. usageMetadata contains token usage, not image-generation settings. Gemini image streaming