Available models
For exact prices, see the pricing page. The Gemini models are billed per call (one flat price per image);
gpt-image-2 is billed per token (bigger and higher-quality images cost more).
Endpoint & auth
- Base URL:
https://www.ruapi.ai/v1 - Auth: header
Authorization: Bearer sk-YOUR_KEY(create one in the console under “Tokens”)
Method 1: Gemini Image — via chat
The Gemini image models live on the chat endpoint. You send a request exactly as you would to a text model, and an image comes back.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 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 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”.
Supported input image formats
image/png, image/jpeg, image/webp, image/heic, image/heif. Anything else is rejected with mime type is not supported by Gemini.
Native Gemini endpoint
If you already write against the Google GenAI SDK, the same key works with the native format:candidates[0].content.parts[].inlineData.data (base64), with no Markdown to parse. If you do not need OpenAI SDK compatibility, this path is simpler.
Method 2: GPT Image — via /v1/images/generations
gpt-image-2 is the classic OpenAI image generation endpoint. No messages, just a prompt.
Parameters
Response
FAQ
Why doesn't gemini-2.5-flash-image work on /v1/images/generations?
Why doesn't gemini-2.5-flash-image work on /v1/images/generations?
Because in OpenAI’s terms it is not an image-generation model — it is a multimodal chat model that happens to emit images. Call it through
/v1/chat/completions; see “Method 1”.What is that huge base64 blob in content?
What is that huge base64 blob in content?
That is the image. When served through the OpenAI-compatible chat endpoint, the picture is inlined into the reply as
. Extract it with the regex above, or switch to the native Gemini endpoint where the image is a separate field.Which model should I use to edit photos?
Which model should I use to edit photos?
gemini-2.5-flash-image gives the best price-to-quality ratio for edits. For maximum detail, use gemini-3-pro-image-preview. gpt-image-2 can edit too, but through a different endpoint, /v1/images/edits.How long are results kept?
How long are results kept?
The Gemini models store nothing — the base64 comes straight back in the response.
gpt-image-2 includes a url field, but do not rely on it; save the b64_json.Gemini responses include usage with token counts — am I billed on those?
Gemini responses include usage with token counts — am I billed on those?
No. Gemini image models are billed per call: one flat price per image. The
usage field is informational and does not affect what you are charged. Only gpt-image-2 is billed per token.