Image Generation API
gpt-image-2, gpt-image-2.5 and the Nano Banana family (Google Gemini image models) through one OpenAI-compatible endpoint. Billed per image — see model pricing for the current price of each model.
Call the API
Endpoint: POST https://jzstoken.com/api/v1/images/generations. The request and response follow the OpenAI images API, so the OpenAI SDK works unchanged.
curl https://jzstoken.com/api/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-YOUR_KEY_HERE" \
-d '{
"model": "nano-banana-fast",
"prompt": "A red fox reading a book under a tree, watercolor",
"size": "1024x1024"
}'Response:
{
"created": 1790588104,
"data": [{ "url": "https://.../image.png" }]
}The image URL is temporary — download and store the file if you need it later. Pass "response_format": "b64_json" to receive the image as base64 instead.
Python (OpenAI SDK)
from openai import OpenAI
client = OpenAI(
api_key="sk-YOUR_KEY_HERE",
base_url="https://jzstoken.com/api/v1",
)
result = client.images.generate(
model="gpt-image-2",
prompt="A minimalist poster of a mountain at dawn",
size="1024x1536",
)
print(result.data[0].url)Edit an image or use a reference
Pass one or more image URLs (or base64 data URLs) in images. Nano Banana models are especially good at editing.
curl https://jzstoken.com/api/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-YOUR_KEY_HERE" \
-d '{
"model": "nano-banana-2",
"prompt": "Keep the person, change the background to a beach at sunset",
"images": ["https://example.com/your-photo.jpg"],
"aspectRatio": "16:9"
}'Parameters
| Field | Description |
|---|---|
| model | Required. Any image model from the pricing page, e.g. gpt-image-2, nano-banana-fast, nano-banana-pro. |
| prompt | Required. What to draw. |
| size | Optional. Pixel size like 1024x1024 or 1536x1024. Converted to the closest supported aspect ratio. |
| aspectRatio | Optional, instead of size. 1:1, 16:9, 9:16, 4:3, 3:2, 21:9 and more. |
| imageSize | Optional. 1K, 2K or 4K for models that support it. Models whose name ends in -2k-cl / -4k-cl / -4k-vip always output that resolution. |
| images | Optional. Reference images (URLs or base64) for editing and style transfer. |
| quality | Optional, gpt-image-2.5 variants only. low / medium / high. |
Billing
- You pay a fixed price per image generated. Token counts are not used.
- Failed generations and requests blocked by content moderation are not charged.
- Generation usually takes 10–30 seconds. Set your client timeout to at least 120 seconds.
No code? Use Studio
The same image models run in your browser at Studio: pick a model, type a prompt, download the result. No API key needed; it uses your account balance. Studio guide →
About timeouts:
High-resolution or 4K images can take 70–150 seconds. A client with a short fixed timeout may give up and retry while the first image is still being made, and each retry is a new image. Raise the client timeout to at least 180 seconds, or use Studio for large images.
Use it in Cherry Studio or another client
Any client that speaks the OpenAI images API works. In Cherry Studio:
- Open settings and add a provider with the OpenAI-compatible protocol.
- Set the API address to
https://jzstoken.com/api/v1. The client adds/images/generationsitself. - Enter your API key and add the model
gpt-image-2(or any image model from the catalog). - Save, pick the model in the image panel, and generate.
Full walkthrough: Cherry Studio guide.
Use it from an agent (OpenClaw, Hermes, scripts)
Agents can call the endpoint directly. A minimal script that saves the image to disk:
import base64, os
from openai import OpenAI
client = OpenAI(api_key=os.environ["JZS_API_KEY"], base_url="https://jzstoken.com/api/v1")
r = client.images.generate(
model="gpt-image-2",
prompt="A watercolor fox reading a book under a tree",
size="1024x1536",
response_format="b64_json",
)
open("fox.png", "wb").write(base64.b64decode(r.data[0].b64_json))Set JZS_API_KEY to your key first. To wire models into OpenClaw itself, see the OpenClaw guide.