Image Endpoints
The image tools make images, change them and describe them. They are part of All tools:
images.generatemakes 1 to 4 images from a prompt, as PNG, WebP or JPEG files.images.editchanges an image as a prompt says, with up to three reference images and an optional mask. It can also remove the background and return a PNG with a transparent background.images.describereturns what an image shows, the text in it and alt text, as JSON.
A start needs the scope and enough credits, and the tool must be available in
/v1/health. Free credits also follow the
free limits. Accepted starts return
202 Accepted; poll their status. The images are artifacts: download them
with the download_url of each artifact.
All image endpoints are preview. Preview means the contract may still evolve before stable release.
Shared Access
- Access: Paid plans that include this family, or free credits (guest trial or verified account) within the free limits.
- Operation family: Images
- Scope:
api:convert:write, the same scope as file conversion - Idempotency:
Idempotency-Keyheader required
Sources
images.edit (its image, references and mask) and images.describe
(its image) read images in the same three ways as the
document tools:
{ "image": { "type": "url", "url": "https://upload.wikimedia.org/wikipedia/commons/4/45/A_small_cup_of_coffee.JPG" } }
{"type": "file_id", "id": "fil_..."}: a file you uploaded withPOST /v1/filesor the hosted MCP upload link. Wait until the file isavailable.{"type": "artifact_id", "id": "art_..."}: an artifact of an earlier operation, such as an image fromimages.generateor a screenshot fromscreenshots.url.{"type": "url", "url": "https://..."}: a publichttpsURL. Chab downloads the image when the operation runs, with the same address checks as the scrape tools, and checks it for viruses like an upload. The download may be as large as your plan's upload size (2 MiB on free credits, 25 MiB on paid plans). The URL is stored encrypted; results show it without its query.
They read PNG, JPEG, WebP and HEIC images. Chab reads the type from the file
itself and turns phone photos upright. A URL that returns a web page fails
with unsupported_file_type and costs nothing.
Pricing
| What | Price |
|---|---|
| A generated or edited image | 15 credits |
Background removal (remove_background) |
15 credits |
High quality, a transparent background, or an edit with a mask |
By the tokens used: 4.1 credits per 1,000 text tokens, 6.5 per 1,000 input image tokens, 24.1 per 1,000 image tokens made. About 35 credits for a standard image, 43 at high quality, 66 for a large one. |
images.describe |
By the tokens used: 0.1 credit per 1,000 tokens read and 0.4 per 1,000 written. About 1 credit an image. |
Every image is charged, so count: 4 costs four times as much. Chab reserves
credits for the images you ask for (for the token-priced images a generous
number of tokens per image) and charges what was made. A request that fails
before an image is made costs nothing, and so does a request the model
refuses (content_refused).
See Credits and Billing.
POST/v1/images/generate
Makes 1 to 4 images from a prompt. Text that should appear on the image, like a headline on a poster, goes in quotes in the prompt; it is drawn as written.
Required Access
- Credits: 15 an image, reserved for
countimages. High quality and transparent images are reserved by tokens and charged on the tokens used. - Scope:
api:convert:write
Request
{
"prompt": "A studio product photo of a matte black ceramic coffee mug with a small white mountain logo, on a light wooden table, soft daylight from the left, shallow depth of field.",
"aspect_ratio": "1:1"
}
Curl example:
curl -X POST https://www.chab.ai/v1/images/generate \
-H "Authorization: Bearer CHAB_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: mug-photo-001" \
-d '{"prompt":"A studio product photo of a matte black ceramic coffee mug with a small white mountain logo, on a light wooden table, soft daylight from the left, shallow depth of field.","aspect_ratio":"1:1"}'
Fields:
prompt: required, 3 to 4,000 characters. Describe the subject, the setting, the style and the light.aspect_ratio: optional, default1:1. One of1:1,16:9,9:16,4:3,3:4,3:2and2:3.size: optional,standard(default, about 1 megapixel: 1024 x 1024 for a square) orlarge(about 2K: a square is 1920 or 2048 pixels a side).count: optional, 1 to 4, default 1.quality: optional,standard(default) orhigh. High quality uses a stronger model for fine detail and small text and is priced by the tokens used.background: optional,opaque(default) ortransparent. A transparent background, such as for a logo or a sticker, needspngorwebpand is priced by the tokens used.format: optional,png(default),webporjpeg.callback_url,callback_secret,callback_events, andcallback_notify_on_expiration: optional one-off operation callback fields.
Generate Result
{
"data": {
"result": {
"count": 1,
"aspect_ratio": "1:1",
"size": "standard",
"quality": "standard",
"background": "opaque",
"format": "png",
"images": [
{ "filename": "image.png", "format": "png", "mime_type": "image/png", "width": 1024, "height": 1024, "byte_size": 1248946 }
],
"usage": { "images": 1, "input_tokens": 0, "image_input_tokens": 0, "output_tokens": 0 }
},
"artifacts": [
{
"id": "art_...",
"type": "image",
"role": "generated_image",
"mime_type": "image/png",
"byte_size": 1248946,
"filename": "image.png",
"download_url": "/v1/operations/op_.../artifacts/art_.../download"
}
],
"warnings": [],
"result_expires_at": "2026-11-19T14:31:10+00:00"
},
"meta": {
"request_id": "req_123"
}
}
This request took 12 seconds and cost 15 credits. The image shows a black mug with a small white mountain on it, on a light wooden table, with a plant and a few books out of focus behind it.
More results from the same day:
- A poster for a bakery with the headline "Fresh Bread Daily" and the line
"Open 7 to 6, Mill Street 12", with
aspect_ratio3:4,count2 andformatwebp: two posters of 768 x 1024 pixels, both with the text spelled right, for 30 credits. - A flat fox head logo in orange and dark gray with
backgroundtransparent: a 1024 x 1024 PNG whose background is fully transparent, for 35 credits (29 text tokens and 1,449 image tokens).
When the model makes fewer images than asked, you get the ones it made, a
partial_results warning, and you pay only for those.
POST/v1/images/edit
Changes an image as the prompt says and keeps the rest. The image to change
is the first image; references are the second, third and fourth, so the
prompt can say "the logo from the second image".
Required Access
- Credits: 15 an image. With a
mask, high quality or a transparent background, reserved by tokens and charged on the tokens used. - Scope:
api:convert:write
Request
{
"image": {
"type": "url",
"url": "https://upload.wikimedia.org/wikipedia/commons/4/45/A_small_cup_of_coffee.JPG"
},
"remove_background": true
}
Curl example:
curl -X POST https://www.chab.ai/v1/images/edit \
-H "Authorization: Bearer CHAB_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: coffee-cutout-001" \
-d '{"image":{"type":"url","url":"https://upload.wikimedia.org/wikipedia/commons/4/45/A_small_cup_of_coffee.JPG"},"remove_background":true}'
Fields:
image: required, the image to change, see Sources.prompt: what to change, 3 to 4,000 characters, such as "Make the mug red instead of black". Required unlessremove_backgroundis true.references: optional, up to 3 more images in the same form asimage, such as a logo to put on the image.mask: optional, a PNG in the same form asimagethat marks the part to change: its transparent parts, or in a mask without transparency its white parts. It is scaled to the size of the image. An edit with a mask is priced by the tokens used.remove_background: optional, defaultfalse. Returns a PNG of the main subject on a transparent background. The prompt is optional then, andcountmust be 1.aspect_ratio: optional. Default: the shape closest to the image's own.size,count,quality,backgroundandformat: as forimages.generate.callback_url,callback_secret,callback_events, andcallback_notify_on_expiration: optional one-off operation callback fields.
Edit Result
{
"data": {
"result": {
"source": {
"type": "url",
"url": "https://upload.wikimedia.org/wikipedia/commons/4/45/A_small_cup_of_coffee.JPG",
"filename": "A_small_cup_of_coffee.JPG",
"format": "jpeg",
"byte_size": 401623
},
"references": 0,
"mask": false,
"remove_background": true,
"count": 1,
"aspect_ratio": "4:3",
"size": "standard",
"quality": "standard",
"background": "transparent",
"format": "png",
"images": [
{ "filename": "A_small_cup_of_coffee-no-background.png", "format": "png", "mime_type": "image/png", "width": 1110, "height": 832, "byte_size": 2387051 }
],
"usage": { "images": 1, "input_tokens": 0, "image_input_tokens": 0, "output_tokens": 0 }
},
"artifacts": [
{
"id": "art_...",
"type": "image",
"role": "generated_image",
"mime_type": "image/png",
"byte_size": 2387051,
"filename": "A_small_cup_of_coffee-no-background.png",
"download_url": "/v1/operations/op_.../artifacts/art_.../download"
}
],
"warnings": [],
"result_expires_at": "2026-11-19T14:42:27+00:00"
},
"meta": {
"request_id": "req_123"
}
}
This cost 15 credits. The PNG shows the white cup of coffee with its saucer and spoon; the dark table behind it is gone and about 60% of the image is transparent.
More edits of the generated mug photo above, given as its artifact_id:
- "Make the mug red instead of black. Keep everything else the same.": the same photo with a red mug, 15 credits.
- The fox logo as a
referencesimage and "Replace the small mountain logo on the mug with the fox logo from the second image": the mug now has the orange fox head on it, 15 credits. - An uploaded PNG
mask, transparent in the lower right, and "Put a small glass of orange juice on the table to the right of the mug": a glass of juice appears in that part and the rest stays the same, 42 credits (33 text tokens, 1,024 input image tokens and 1,449 image tokens made).
POST/v1/images/describe
Returns what an image shows as JSON: a short description, alt text for a web
page, every word of text in the image and its main objects. Ask a question in
prompt to get an answer too.
Required Access
- Credits: about 1, reserved for a short answer and charged on the tokens used.
- Scope:
api:convert:write
Request
{
"image": {
"type": "url",
"url": "https://upload.wikimedia.org/wikipedia/commons/4/45/A_small_cup_of_coffee.JPG"
}
}
Curl example:
curl -X POST https://www.chab.ai/v1/images/describe \
-H "Authorization: Bearer CHAB_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: coffee-alt-text-001" \
-d '{"image":{"type":"url","url":"https://upload.wikimedia.org/wikipedia/commons/4/45/A_small_cup_of_coffee.JPG"}}'
Fields:
image: required, see Sources.prompt: optional, up to 2,000 characters: a question about the image or what to look at, such as "When is the shop open?". The answer is inanswer.language: optional ISO 639-1 code, defaulten. The description, the alt text and the answer are written in this language. Text in the image is always given as written.callback_url,callback_secret,callback_events, andcallback_notify_on_expiration: optional one-off operation callback fields.
Description Result
{
"data": {
"result": {
"source": {
"type": "url",
"url": "https://upload.wikimedia.org/wikipedia/commons/4/45/A_small_cup_of_coffee.JPG",
"filename": "A_small_cup_of_coffee.JPG",
"format": "jpeg",
"byte_size": 401623
},
"width": 1600,
"height": 1200,
"language": "en",
"description": "A white ceramic cup filled with dark coffee sits on a matching saucer. A silver spoon rests on the saucer to the left of the cup. The setting appears to be a dark, possibly wooden table. The overall image is simple and focuses on the coffee and its accompaniments.",
"alt_text": "A white cup of black coffee with a spoon on a saucer, set on a dark surface.",
"text": "",
"objects": ["cup", "coffee", "saucer", "spoon", "table"],
"answer": null,
"usage": { "input_tokens": 452, "output_tokens": 138 }
},
"artifacts": [],
"warnings": [],
"result_expires_at": "2026-11-19T14:39:32+00:00"
},
"meta": {
"request_id": "req_123"
}
}
This cost 1 credit. Described with the prompt "When is the bakery open?", the
generated bakery poster came back with text "Fresh\nBREAD\nDaily\nOpen 7 to
6,\nMill Street 12" and answer "The bakery is open from 7 AM to 6 PM.", also
for 1 credit.
Image Errors
| Code | When | Charge |
|---|---|---|
validation_failed |
A field is missing or wrong, the URL is not public https, or a transparent image is asked for as jpeg |
None |
not_found, file_expired, source_scan_pending, source_scan_failed |
The file or artifact cannot be read | None |
unsupported_file_type |
Not a PNG, JPEG, WebP or HEIC image | None |
unsupported_file_content |
The image cannot be opened, or the model could not use it | None |
source_too_large |
Larger than your plan's upload size, or more than 50 megapixels | None |
source_quarantined |
The image did not pass the virus check | None |
target_fetch_blocked, target_timeout |
The URL could not be downloaded | None |
content_refused |
The image model refused the request because of its content rules. Chab adds no filters of its own. Change the prompt or the image and try again | None |
provider_temporarily_rate_limited, provider_unavailable |
The image model is busy or cannot be reached right now; try again later | None |
extraction_failed |
images.describe got an answer it could not read |
The tokens used |