Image generation
Generate images from a text prompt, or edit an existing image with a prompt, using any image model on the network. The endpoints mirror OpenAI's image API.
POST /v1/images/generations (JSON)
POST /v1/images/edits (multipart)
Requests are routed only to services a provider declared as type: image. inference.club stores every generated image in object storage and, by default, returns a URL you can drop straight into an <img> tag.
Generations
application/json:
| Field | Required | Description |
|---|---|---|
prompt | yes | The text description of the image. |
model | yes | An image model id from GET /v1/models. |
n | no | How many images to generate (clamped server-side). |
size | no | e.g. 1024x1024. Passed through to the provider. |
response_format | no | url (default) or b64_json. See below. |
curl
curl https://api.inference.club/v1/images/generations \
-H "Authorization: Bearer $INFERENCE_CLUB_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "model": "my-image-model", "prompt": "a watercolor fox", "size": "1024x1024" }'
Python (openai SDK)
from openai import OpenAI
client = OpenAI(base_url="https://api.inference.club/v1", api_key="<your-api-key>")
img = client.images.generate(model="my-image-model", prompt="a watercolor fox")
print(img.data[0].url)
Edits
multipart/form-data — supply a source image (and optional mask) plus a prompt:
| Field | Required | Description |
|---|---|---|
image | yes | The source image to edit (png/jpeg/webp, up to 25 MB). |
prompt | yes | How to change it. |
model | yes | An image model id. |
mask | no | Optional transparency mask. |
n, size, response_format | no | As above. |
curl https://api.inference.club/v1/images/edits \
-H "Authorization: Bearer $INFERENCE_CLUB_API_KEY" \
-F model=my-image-model \
-F image=@photo.png \
-F prompt="make the sky a sunset"
Response
{
"created": 1780266332,
"data": [ { "url": "https://api.inference.club/api/inference/assets/42/" } ]
}
url(default): the image is stored in inference.club object storage and the response returns its URL. Generated images are public by URL (so they embed in<img>tags and can be shared) — request-level privacy controls are coming.b64_json: setresponse_format: b64_jsonto also get the raw base64 bytes inline. The image is still stored.
Every request is recorded as an inference request with the prompt, the source image (for edits), and the output image(s), visible in your dashboard. Generation is metered by image count.
Errors
type | When | HTTP |
|---|---|---|
missing_prompt | No prompt | 400 |
missing_file | /edits with no image | 400 |
file_too_large / request_too_large | Source image or prompt over the limit | 413 |
unsupported_media_type | Source image isn't png/jpeg/webp | 415 |
no_provider | No online image provider serves the model for you | 404 |
upstream_error | The provider's image server failed | 502 |
Not supported (yet)
/v1/images/variations, streaming/progressive previews, and async job polling. Generation is synchronous — the request returns once the image is ready.