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. flux-1-schnell) |
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" |
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": "flux-1-schnell",
"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.
Errors
See Errors. Common: 401, 402, 404, 429.