Generate an image with the images endpoint
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.
- $0.06 per request
- $0.07 per request
- $0.04 per request
- $0.06 per request
- $0.07 per request
Troubleshooting
| Symptom | What it usually means | What to do |
|---|---|---|
| 401 Unauthorized | The key is incomplete, revoked, or was pasted with spaces. | Copy the key again and send it as Authorization: Bearer sk-.... |
| 403 Forbidden | The 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 Requests | A rate limit or a daily allowance was reached. | Wait before retrying, lower concurrency, or switch to another available model. |
| The response has no image | The 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.