TokenReply

Loading…

Reload

Image generation API

Image models in the catalog can be called through the OpenAI images endpoint, and some also through the chat endpoint. Both return the image as base64 data.

Last checked · Sources: Requests to nano-banana through /v1/images/generations and /v1/chat/completions returned HTTP 200 with base64 PNG output

Image models listed
5 in the live catalog
Images endpoint
https://api.tokenreply.com/v1/images/generations
Output
Base64 image data

Generate an image with the images endpoint

Example
curl https://api.tokenreply.com/v1/images/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TOKENREPLY_API_KEY" \
  -d '{
    "model": "gemini-2.5-flash-image",
    "prompt": "A small paper lantern on a desk, flat illustration",
    "n": 1
  }'

The response contains data[0].b64_json. Decode it and save it as a PNG file.

Generate an image through chat

Models that also list the OpenAI chat endpoint return the image inside the message text as a Markdown image with a data:image/png;base64, address. Chat apps that render Markdown show it directly.

Image models in the live catalog

Read from the live catalog when this page opens.

Troubleshooting

SymptomWhat it usually meansWhat to do
401 UnauthorizedThe key is incomplete, revoked, or was pasted with spaces.Copy the key again and send it as Authorization: Bearer sk-....
403 ForbiddenThe model is not included in your account tier or in the key's model list.Pick a Free or Weekly Featured model, or review plans and tiers.
429 Too Many RequestsA rate limit or a daily allowance was reached.Wait before retrying, lower concurrency, or switch to another available model.
The response has no imageThe model does not list the endpoint you called, or the prompt was refused.Use an endpoint listed for that model on its model page and try a different prompt.

Frequently asked questions

Does the API return an image URL?

These models return base64 data. Save it yourself if you need a file or URL.

Resources

Related

Ready to try it?