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).
URLs & auth
- Gemini image models:
POST https://www.ruapi.ai/v1/chat/completions - GPT Image:
POST https://www.ruapi.ai/v1/images/generations(generate),POST https://www.ruapi.ai/v1/images/edits(edit) - Base URL:
https://www.ruapi.ai/v1. With an SDK, this is the only address you enter — the SDK builds the full URLs above by itself - Auth: header
Authorization: Bearer sk-YOUR_KEY(create one in the console under “API Keys”)
The curl examples below save the picture straight to a file in the current folder — just paste in your key. They work on macOS, Linux, and on Windows under Git Bash or WSL; in a plain Windows prompt (cmd, PowerShell), use the Python example instead. If the reply contains no image, the command prints the full API response, which says why.
Method 1: Gemini Image — via /v1/chat/completions
Requests for the Gemini image models go to https://www.ruapi.ai/v1/chat/completions. You write them exactly as you would for a text model — the only difference is that the reply contains an image.
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.
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.
Google’s native format
If you already write against the Google GenAI SDK, the same key also works with Google’s own format, athttps://www.ruapi.ai/v1beta/models/MODEL_ID:generateContent:
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 uses OpenAI’s standard image-generation format: requests go to https://www.ruapi.ai/v1/images/generations. There are 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. Send the request to
https://www.ruapi.ai/v1/chat/completions instead; see “Method 1”. If you send it to /v1/images/generations anyway, you get a 400 error that gives the correct address.Error: “Function calling is not enabled for this model”
Error: “Function calling is not enabled for this model”
Your client is sending tools (
tools) along with the request — agents and chat clients with MCP or plugins turned on do this. Image models don’t support tools. Turn off tools and MCP for this chat (or set up a separate assistant without them) and try again. Failed requests like these are not billed.What is that huge base64 blob in content?
What is that huge base64 blob in content?
That is the image. When it comes back through
/v1/chat/completions, the picture is inlined into the reply as . The examples above extract it and save it to a file for you. You can also switch to Google’s native format (see “Google’s native format” above), 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 its requests go to a different address: https://www.ruapi.ai/v1/images/edits.How long are results kept?
How long are results kept?
Not at all. We do not store generated images: the picture is delivered once, in the response to your request. Save it right away — there is no way to fetch it again.
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 call. The
usage field is informational and does not affect what you are charged. Only gpt-image-2 is billed per token. A call where the model answers 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”
That is OpenAI’s moderation: it decided the
gpt-image-2 request breaks its rules. It sometimes gets this wrong — for example, on descriptions of young children or well-known people. Rephrase the prompt and try again. Rejected requests are not billed.