Skip to main content
RuAPI gives you access to two families of image generation models: Gemini Image (a.k.a. Nano Banana) and GPT Image. They’re called differently, and that’s the main thing to understand before you start. Pay in USDT, no foreign card needed.
Gemini Image models don’t work via /v1/images/generations. The most reliable way to call them is Google’s native format — POST https://www.ruapi.ai/v1beta/models/MODEL_ID:generateContent: the image comes back in its own field, with no Markdown to parse. Through the OpenAI-compatible /v1/chat/completions, only gemini-nano-banana-2.1 and gemini-3.1-flash-image reliably return images.

Available models

For current prices, see the pricing page. Models billed per token cost more for bigger, higher-quality images; for 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 — only gemini-nano-banana-2.1 and gemini-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 the x-goog-api-key: sk-YOUR_KEY header (that’s what the Google GenAI SDK does) or as Authorization: Bearer sk-YOUR_KEY; everywhere else, use Authorization: Bearer sk-YOUR_KEY
The curl examples below save the image straight to a file in the current folder — just put in your key. They work on macOS, Linux and on Windows via Git Bash or WSL; in the regular Windows command line (cmd, PowerShell), use the Python example. If there’s no image in the response, the command prints the whole API response so you can see why.

Requests go to https://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

In the Google GenAI SDK, you only change the address: http_options={"base_url": "https://www.ruapi.ai"}, without /v1beta — the SDK adds it itself. The SDK sends the key in the x-goog-api-key header, which RuAPI accepts. RuAPI has no Interactions API (client.interactions) — use generate_content.

Image parameters

Set them in generationConfig.imageConfig (in the Python SDK, types.ImageConfig):

Image to image (editing)

Pass the source image as an inlineData 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 is client.chats: the SDK sends the model’s previous replies, images included, back to it for you.
Every step is a separate paid call, and a history full of images bloats the request fast: for long chains of edits, start a new conversation from the latest image.

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.
The image arrives as a Markdown data URI inlined in choices[0].message.content — there is no separate image field. The response looks like this:
The base64 has to be pulled out of the text. The examples below do that for you and save the picture to a file.

Text to image

Sometimes the model replies with text only and no picture. That call is billed too — for the tokens it used. To avoid it, say it outright in the prompt: “Generate an image: …”. If there is still no picture, rephrase and try again.
A single response may contain several images, which is why the Python example uses findall rather than search; the curl command saves the first one. The model almost always adds a short caption alongside the picture.

Image to image (editing)

To edit an existing image, pass it the same way you would to a vision model: a content 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.
The aspect ratio of the input image is preserved — the result is not cropped to a square.

Multi-turn editing

You can feed the model’s reply straight back into messages 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”.
Every turn is a separate billable call. Also, a history full of base64 images inflates the request body fast — do not carry more than the last two or three frames in context.

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

The picture comes back only in b64_json — it is the PNG file itself, base64-encoded. There is no image link in the response, and we do not store generated images: save the file right away, because you cannot fetch it again.
usage.output_tokens counts image tokens, and that is what you pay for. Dropping quality to low cuts it several-fold — handy for drafts and tests.

FAQ

Because they aren’t image generation models in OpenAI’s sense — they’re multimodal models that can return images. Send requests in Google’s native format to 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.
In the OpenAI-compatible format, only 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: …”.
Yes. Use your RuAPI key and 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.
Your client sends tools (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.
That’s the image. When the response comes via /v1/chat/completions, the picture is embedded in the text as ![image](data:image/png;base64,...). 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.
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.
They aren’t. We don’t store generated images: the picture arrives once — in the response to your request. Save it right away; you can’t get it again.
It depends on the model. 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.
That’s OpenAI’s moderation: it decided the 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.