Image generations
OpenAI-compatible image generation endpoint.
POST https://api.ecohash.com/v1/images/generations
Headers
| Header | Value |
|---|---|
Authorization | Bearer eco_YOUR_KEY |
Content-Type | application/json |
Request body
| Field | Type | Required | Notes |
|---|---|---|---|
model | string | yes | Image model ID (e.g. flux2-klein, qwen-image, z-image-turbo) |
prompt | string | yes | Text prompt — up to ~1000 characters |
n | integer | no | Number of images. Currently only 1 is supported |
size | string | no | 512x512, 768x768, 1024x1024, 1024x768, 768x1024. Default 1024x1024 |
response_format | string | no | "b64_json" (default) or "url" |
steps | integer | no | Denoising steps. Omit to use the model's default (turbo models use a low count automatically) |
seed | integer | no | Deterministic generation (non-OpenAI extension) |
Example request
curl https://api.ecohash.com/v1/images/generations \
-H "Authorization: Bearer eco_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "flux2-klein",
"prompt": "a watercolor painting of a fox in a misty forest",
"size": "1024x1024",
"response_format": "b64_json"
}'
Response body
{
"created": 1776391234,
"data": [{
"b64_json": "iVBORw0KGgo...",
"revised_prompt": null
}]
}
With response_format: "url", the response has url: "https://..." instead of b64_json — URL is valid for 24 hours.
Image edits
POST https://api.ecohash.com/v1/images/edits
Edit an existing image with a prompt. Send as multipart/form-data with an edit-capable model (for example flux2-klein, qwen-image).
| Field | Type | Required | Notes |
|---|---|---|---|
model | text | yes | An edit-capable image model |
image | file | yes | The source image |
prompt | text | yes | The change to apply |
size | text | no | Output size |
curl https://api.ecohash.com/v1/images/edits \
-H "Authorization: Bearer eco_YOUR_KEY" \
-F model=flux2-klein \
-F image=@input.png \
-F prompt="make the sky a dramatic sunset" \
-F size=1024x1024
The response shape matches /v1/images/generations. A text-to-image-only model returns an error here.
Errors
See Errors. Common: 401, 402, 404, 429.