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:

FieldRequiredDescription
promptyesThe text description of the image.
modelyesAn image model id from GET /v1/models.
nnoHow many images to generate (clamped server-side).
sizenoe.g. 1024x1024. Passed through to the provider.
response_formatnourl (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:

FieldRequiredDescription
imageyesThe source image to edit (png/jpeg/webp, up to 25 MB).
promptyesHow to change it.
modelyesAn image model id.
masknoOptional transparency mask.
n, size, response_formatnoAs 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: set response_format: b64_json to 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

typeWhenHTTP
missing_promptNo prompt400
missing_file/edits with no image400
file_too_large / request_too_largeSource image or prompt over the limit413
unsupported_media_typeSource image isn't png/jpeg/webp415
no_providerNo online image provider serves the model for you404
upstream_errorThe provider's image server failed502

Not supported (yet)

/v1/images/variations, streaming/progressive previews, and async job polling. Generation is synchronous — the request returns once the image is ready.