Image generation API
One POST request with the same key as chat: a prompt in, a link to the image out. Parameters, examples and billing rules are here.
Endpoints and authentication
Images live on the OpenAI-compatible entry point and use the same key as text models: only the path changes.
| Method | Path | Purpose |
|---|---|---|
| POST | https://api.tokenator.top/v1/images/generations | Generate an image from a text prompt. |
| POST | /v1/images/edits | Editing and upscaling of an existing image. Accepts multipart and JSON with base64. |
The key goes in Authorization: Bearer sk-your-tokenator-key. There is no separate image key — generations are drawn from the same key as tokens.
Your first request
curl https://api.tokenator.top/v1/images/generations \ -H "Authorization: Bearer sk-your-tokenator-key" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-image-2", "prompt": "a white siamese cat on a windowsill", "n": 1, "size": "1024x1024" }'
{
"created": 1755600000,
"data": [
{ "url": "https://generated-static.tokenator.top/static/8f1c2a9b.png" }
]
}The response carries exactly two fields: created, a unix timestamp, and data, one entry per requested image. An entry has either url or b64_json — the whole file in base64 when the model answered inline. The proxy adds nothing else.
The link points at a separate file host — generated-static.tokenator.top, path /static/. It is neither the API address nor the provider's temporary URL: the file was downloaded and rehosted on our side, is served with Cache-Control: immutable and lives as long as it sits on the service's disk.
Which models draw
| Model | API ID | Billing | Editing |
|---|---|---|---|
| GPT Image 2 | gpt-image-2 | 1× – 2× | yes |
| Nano Banana 2 | nano-banana-2 | 1× – 2× | no |
| Nano Banana Pro | nano-banana-pro | 2× | no |
| Seedream 5.0 Pro | seedream-5.0-pro | 3× | yes |
| Seedream 5.0 Lite | seedream-5.0-lite | 2× | yes |
| Grok Imagine Image 2.0 | grok-imagine-image-2.0 | 3× | yes |
Request parameters
| Field | Type | What it does |
|---|---|---|
model | string | The API ID of a model from the catalog. |
prompt | string, required | What to draw. An empty string is refused with a 400. |
n | integer | How many images per request: 1 to 10. Each one is charged separately. |
size | string | Frame size: 1024x1024, 1024x1536, 1536x1024, 2048x2048. Anything else is refused before the provider is contacted. |
Editing and upscaling
An existing image can be sent to /v1/images/edits — to upscale, retouch or change a fragment. The image field is the source file, prompt describes the edit, and an optional mask limits the area. The result is charged against the same quota as a plain generation.
curl https://api.tokenator.top/v1/images/edits \ -H "Authorization: Bearer sk-your-tokenator-key" \ -F model="gpt-image-2" \ -F image="@input.png" \ -F prompt="upscale to 4k, sharpen the details" \ -F n=1 \ -F size="2048x2048"
SDKs and ready-made examples
The endpoint is compatible with the OpenAI SDKs: only the base URL and the key change.
from openai import OpenAI client = OpenAI( api_key="sk-your-tokenator-key", base_url="https://api.tokenator.top/v1", ) result = client.images.generate( model="gpt-image-2", prompt="a white siamese cat", n=1, size="1024x1024", ) print(result.data[0].url)
import OpenAI from "openai" const client = new OpenAI({ apiKey: "sk-your-tokenator-key", baseURL: "https://api.tokenator.top/v1", }) const result = await client.images.generate({ model: "gpt-image-2", prompt: "a white siamese cat", n: 1, size: "1024x1024", }) console.log(result.data[0].url)
Ready-made snippets with your own key and address are in the key dashboard, on the SDK / API tab.
How images are billed
Images do not spend tokens. A key carries a separate generation counter, and one generation is one image at the ordinary size. On some models 2048x2048 costs more: the multiplier is set by the operator and shown on the model page. The final charge is images × model multiplier, rounded up.
Generations are claimed before the provider is contacted and returned if no image arrives. A key with token_limit: -1 is a generation-only key with no access to text models.
curl https://api.tokenator.top/v1/tokens \ -H "Authorization: Bearer sk-your-tokenator-key"
{
"name": "my-key",
"image_limit": 100,
"image_used": 12,
"image_remaining": 88
}Limits
- Up to 10 images per request (
n). - Sizes: 1024x1024, 1024x1536, 1536x1024, 2048x2048.
- Concurrent generations per key: 1; beyond that a
429with abusy_for_secondsfield. - Finished files are served from our address and do not depend on the provider's temporary links.
Errors
| Symptom | Cause | Fix |
|---|---|---|
400 prompt required | The body carries no prompt, or is not JSON. | Check Content-Type: application/json and a non-empty prompt. |
400 Invalid size | The size is not one of the supported ones. | Use one of: 1024x1024, 1024x1536, 1536x1024, 2048x2048. |
429 with an image_gen_limit | The key has run out of image generations. | Top up a bundle in your account; the balance is visible in /v1/tokens. |
429 with an img_concurrent_limit | A generation is already running on this key: parallel requests are limited. | The busy_for_seconds field shows how long the current one has been running. Queue your requests. |
502 Request error | An error on the provider side. Its text is not passed through. | Retry — Tokenator fails over to the next provider on its own. If it persists, contact support. |
Trying it without code
The key dashboard has a Studio: the prompt, the size and the model are picked in the interface and finished images land in a gallery. It is the same endpoint and the same generation counter.
FAQ
Do I need a separate key for images?
No, the same key as for chat works. What is bought separately is the bundle of generations.
Which sizes are supported?
1024x1024, 1024x1536, 1536x1024, 2048x2048. A value outside the list is refused before the provider is contacted, so a typo costs nothing.
What does a 2048×2048 image cost?
As much as the model page says: on some models the large size carries its own multiplier, on the rest the price is the same.
Are generations charged when no image arrives?
No. The claim is returned to the key — a provider error costs nothing.
How long does the image link live?
The file is rehosted by the service and served from our address. Download it if you need the image for the long run.
Can I edit an existing image?
Yes, through /v1/images/edits — multipart with a file or JSON with base64. The model must support editing; the catalog says which ones do.