Images and video
Image models (GPT Image, Nano Banana) are billed per image, and the price depends on the parameters. See the price and parameters of each model on its page in the catalog.
Generating an image
A request to POST /v1/images/generations:
curl https://api.claudexia.tech/v1/images/generations \
-H "Authorization: Bearer sk_cdx_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "gpt-image-2", "prompt": "a red apple on a white table", "resolution": "1K", "size": "1024x1024"}'The link to the finished image arrives in data[].url. The link is temporary, so save the file.
Parameters
| Parameter | What it sets |
|---|---|
model | Image model ID, for example gpt-image-2. |
prompt | The image description. |
resolution | Resolution, for example 1K, 2K or 4K. The price depends on it. Available values are listed on the model page. |
size | Image size, for example 1024x1024. |
tier | Nano Banana 2 only: the value lite turns on the lightweight mode. |
Editing from a reference
To edit an image from a reference, use POST /v1/images/edits.
Nano Banana 2 lightweight mode
Nano Banana 2 has a lightweight mode, tier: "lite". It does not need the resolution parameter:
curl https://api.claudexia.tech/v1/images/generations \
-H "Authorization: Bearer sk_cdx_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "nano-banana-2", "prompt": "a red apple on a white table", "tier": "lite"}'Cheap and Premium
GPT Image 2 (1K, 2K), GPT Image 2.5 and Nano Banana Pro are also sold in the Cheap channel: noticeably cheaper, but generation fails more often. The key's routing mode picks the channel (see Premium and Cheap channels).
| Key mode | Image |
|---|---|
premium | Premium. |
cheap | Cheap. If it cannot be generated right now, the error is 503 model_unavailable and nothing is charged. |
auto_cheap, max | Cheap first, Premium on failure. |
auto_premium | Premium first, Cheap on failure. |
Billing follows the channel that produced the image: it arrives in the channel field of the response (premium or cheap). Variants that are not in Cheap (for example GPT Image 2 at 4K) and models without Cheap (video, Nano Banana 2) always go through Premium, including for keys in cheap mode.
See Cheap prices in the Cheap catalog.
Video
Video is created as a task, and the format is compatible with the OpenAI Videos API.
| Method | Path | What it does |
|---|---|---|
| POST | /v1/videos | Creates a task. |
| GET | /v1/videos/{id} | Shows the task status. |
| GET | /v1/videos/{id}/content | Returns the finished file. |
Create a task, check its status by the identifier from the id field of the response, and download the file when the video is ready:
curl https://api.claudexia.tech/v1/videos \
-H "Authorization: Bearer sk_cdx_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "veo-3.1", "prompt": "a paper boat on a rainy street"}'
curl https://api.claudexia.tech/v1/videos/VIDEO_ID \
-H "Authorization: Bearer sk_cdx_YOUR_KEY"
curl https://api.claudexia.tech/v1/videos/VIDEO_ID/content \
-H "Authorization: Bearer sk_cdx_YOUR_KEY" \
-o video.mp4Billing
Money is charged only for a successful result. Error codes: error reference.