Available models
gemini-nano-banana-2.1 and gemini-3-pro-image, the pricing page shows the approximate cost of one 1K, 2K and 4K image. Models billed per call cost one flat price per call.
URLs & auth
- Gemini Image models (recommended):
POST https://www.ruapi.ai/v1beta/models/MODEL_ID:generateContent— Google’s native format - Gemini Image models in the OpenAI-compatible format:
POST https://www.ruapi.ai/v1/chat/completions— onlygemini-nano-banana-2.1andgemini-3.1-flash-image - GPT Image:
POST https://www.ruapi.ai/v1/images/generations(generation),POST https://www.ruapi.ai/v1/images/edits(editing) - Base URL for the OpenAI SDK:
https://www.ruapi.ai/v1(for the Google GenAI SDK,https://www.ruapi.ai— see below). The SDK builds the full URLs by itself - Auth: your RuAPI key
sk-...(create one in the console under “API Keys”). In Google’s native format, send it in thex-goog-api-key: sk-YOUR_KEYheader (that’s what the Google GenAI SDK does) or asAuthorization: Bearer sk-YOUR_KEY; everywhere else, useAuthorization: Bearer sk-YOUR_KEY
Method 1: Gemini Image — Google’s native format (recommended)
Requests go tohttps://www.ruapi.ai/v1beta/models/MODEL_ID:generateContent in the same format as Google’s Gemini API. The image comes back as a separate field — in candidates[0].content.parts[].inlineData.data (base64), possibly next to a text part.
Text to image
Image parameters
Set them ingenerationConfig.imageConfig (in the Python SDK, types.ImageConfig):
Image to image (editing)
Pass the source image as aninlineData part (base64) next to the text instruction. The example below runs as is: it downloads a test image into photo.png; for your own picture, use your own file.
Multi-turn editing
With the SDK, the easiest way to keep a conversation going isclient.chats: the SDK sends the model’s previous replies, images included, back to it for you.
Supported input image formats
image/png, image/jpeg, image/webp, image/heic, image/heif. Anything else is rejected with the error mime type is not supported by Gemini.
Method 2: Gemini Image — via the OpenAI-compatible /v1/chat/completions
gemini-nano-banana-2.1 and gemini-3.1-flash-image can also be called via https://www.ruapi.ai/v1/chat/completions — for example, if your code or client only speaks the OpenAI format. You write requests exactly as you would for a text model — the only difference is that the reply contains an image. The other Gemini Image models often reply with text only in this format: use “Method 1” for them.
Text to image
Image to image (editing)
To edit an existing image, pass it the same way you would to a vision model: acontent array with a text part and an image_url part. The url accepts either a public link or a data URI. The example below runs as is; for your own picture, replace the link in url.
Multi-turn editing
You can feed the model’s reply straight back intomessages as an assistant message — the Markdown data URI is recognized and the image becomes input for the next turn. That is how you chain “make it black and white” → “now add a border”.
Method 3: GPT Image — via /v1/images/generations
gpt-image-2 uses OpenAI’s standard image-generation format: requests go to https://www.ruapi.ai/v1/images/generations. There are no messages, just a prompt. gpt-image-2.6-flare, gpt-image-2.6-sunburst, gpt-image-2.5-flare and gpt-image-2.5-sunburst are called the same way — just change model. GPT Image 2.6’s new parameters and per-image cost are in the GPT Image 2.6 overview.
Parameters
Response
FAQ
Why don't Gemini Image models work via /v1/images/generations?
Why don't Gemini Image models work via /v1/images/generations?
https://www.ruapi.ai/v1beta/models/MODEL_ID:generateContent (see “Method 1”); for gemini-nano-banana-2.1 and gemini-3.1-flash-image you can also use https://www.ruapi.ai/v1/chat/completions (see “Method 2”). If you do send a request to /v1/images/generations, you’ll get a 400 error that names the right URL.Through /v1/chat/completions the model replies with text and no image
Through /v1/chat/completions the model replies with text and no image
gemini-nano-banana-2.1 and gemini-3.1-flash-image reliably return images. Call gemini-3-pro-image (nano-banana-pro), gemini-3.1-flash-lite-image and the other Gemini Image models in Google’s native format — see “Method 1”. With the supported models, say it outright in the prompt: “Generate an image: …”.Does the Google GenAI SDK work?
Does the Google GenAI SDK work?
http_options={"base_url": "https://www.ruapi.ai"} (without /v1beta); the rest of the code stays the same — see the example in “Method 1”. RuAPI has no Interactions API: use generate_content and chats.Error “Function calling is not enabled for this model”
Error “Function calling is not enabled for this model”
tools) along with the request — agents and chat clients with MCP or plugins enabled do this. Image models don’t support tools. Turn off tools and MCP in that chat (or set up a separate assistant without them) and retry. These failed requests aren’t billed.What's this huge base64 string in the content field?
What's this huge base64 string in the content field?
/v1/chat/completions, the picture is embedded in the text as . The examples above extract it and save it to a file for you. In Google’s native format (see “Method 1”), the image comes back as a separate field.Which model should I use for photo editing?
Which model should I use for photo editing?
gemini-nano-banana-2.1 or gemini-3.1-flash-image give a good balance of price and quality for edits. For maximum detail, use gemini-3-pro-image in Google’s native format. Google will shut down gemini-2.5-flash-image on March 15, 2027, so it’s best avoided in new projects. gpt-image-2 can edit too, but editing requests go to a separate URL, https://www.ruapi.ai/v1/images/edits.How long are results stored?
How long are results stored?
The Gemini response has usage with tokens — am I charged for them?
The Gemini response has usage with tokens — am I charged for them?
gemini-nano-banana-2.1, gemini-3-pro-image, gemini-3.1-flash-image and gemini-3.1-flash-lite-image are billed per token, based on usage (usageMetadata in the native format). Models billed per call (gemini-3-pro-image-preview, gemini-3.1-flash-image-preview, gemini-2.5-flash-image) cost one flat price per call, and usage is for reference only. A call where the model replied with text only is billed too — so ask for an image explicitly.Error “Your request was rejected by the safety system”
Error “Your request was rejected by the safety system”
gpt-image-2 request breaks the rules. It sometimes gets it wrong — for example, with descriptions of small children or famous people. Rephrase and try again. Rejected requests aren’t billed.