Skip to main content
POST /v1/images/generations creates images from a text prompt. POST /v1/images/edits changes one or more images you upload. Both follow the OpenAI Images API, so the official OpenAI SDKs work with base URL https://api.omnirelay.ai/v1 and an OmniRelay API key. The same key rules apply as for text models: key expiry, IP allowlist, model limits, budgets and rate and concurrency limits. You can also try both endpoints in the console playground before writing code.

Models

Image models appear in your own GET /v1/models list with capabilities.image_generation: true and their per-image prices for your workspace.

Pricing

Images are billed per image returned, not per token. The requested size sets the price tier of every image in the call: quality does not change the price. Your discount applies as for text models. A call reserves n images at its tier before it is sent and settles only the images that come back; the response reports the charge in cost_microusd. See Usage and billing.

Generate an image

Edit an image

Send the source image as multipart/form-data in the field image (or several as image[]), with an optional mask whose transparent areas mark what to change. The whole request may be up to 20 MiB.

Parameters

Response

  • data[].b64_json is the image, base64-encoded in output_format. Images are never returned as links.
  • usage reports the model’s token counts for information only; the charge is cost_microusd, per image.
  • Send X-Gateway-Metadata: enabled to add a gateway_metadata block (also returned as omnirelay_metadata), as for text models.

Long calls

Image calls usually take 15–90 seconds, and high quality or 4K can take longer. If a call has not finished after about 25 seconds, OmniRelay answers 200 immediately and sends spaces until the JSON body is ready, so proxies do not close an idle connection. JSON parsers and the OpenAI SDKs ignore the leading spaces. Because the status is already sent, a failure after that point arrives as an error object in a 200 body. Always check the parsed body for error before reading data:
Set your HTTP client timeout to at least 3 minutes.

Failures and charges

A provider finishes and bills an image even when the answer does not reach you, so OmniRelay does not release image_call_held calls automatically. The reservation stays held until the call is reconciled; contact support with the request_id if it does not clear. Do not resend the same request in a loop: each call is billed separately. See Errors.

Limits

  • At most 4 images per call; at most 20 MiB per request; prompts up to 32,000 characters.
  • Workspace, member and key requests per minute and concurrent calls count image calls like text calls.
  • Images are not stored by OmniRelay; save b64_json on your side.