Skip to main content
Most image models can be called through the two OpenAI-compatible endpoints: text-to-image POST /v1/images/generations and image editing POST /v1/images/edits. Use the official OpenAI SDK and point base_url to https://api.ephone.ai/v1.
Supported parameters (sizes, quality tiers, transparent backgrounds, …) vary by model; the model detail page is authoritative. For asynchronous jobs that return image URLs, see Task API.

Text to image

Example response (b64_json truncated):

Edit images

Send one or more images with a prompt to restyle, replace elements or composite several inputs; add a mask to repaint only its transparent area. Images are uploaded as a multipart form; use the field name image[] for multiple images (the official SDK handles this when you pass a list).

Streaming partial images

The gpt-image family (gpt-image-2.5-sunburst, gpt-image-2.5-flare, gpt-image-2, gpt-image-1.5, gpt-image-1, …) supports streaming: pass stream: true to receive 0–3 partial images while the image is being generated, followed by the final image. Useful for showing users a rough preview early. The response is a stream of server-sent events; each event’s type matches its event: line:
  • image_generation.partial_image: a partial image (image_edit.partial_image on the edit endpoint); partial_image_index starts at 0
  • image_generation.completed: the final image (image_edit.completed on the edit endpoint), carrying the request’s usage
  • error: something failed mid-stream, see below
The edit endpoint works the same way: add stream=True, partial_images=2 to client.images.edit(...) in Python, or -F stream=true -F partial_images=2 with cURL; the event names become image_edit.*. Raw event stream (b64_json truncated):

Billing

  • Each partial image consumes some extra image output tokens (the amount depends on size and quality). They are already included in the usage of the completed event and billed at actual usage, with no separate fee. Set partial_images to 0 if you don’t need previews.
  • Requests that fail before the final image is delivered are not billed.
  • If the client disconnects mid-stream, the image is still generated and billed as usual.

Errors

  • Before streaming starts (invalid parameters, insufficient balance, content moderation, …): you get an HTTP error status and a JSON error body, exactly as without streaming.
  • During streaming (after partial images have been sent): the stream ends with an error event; the HTTP status is already 200 at that point. The official SDK raises APIError while iterating, so wrap the whole loop in try:

Notes

  • Partial images are only produced for single-image requests. With n greater than 1, each final image arrives as its own completed event and usage (the total for all images) is attached to the last one.
  • Other models accept stream: true too: there are no partial images, and a single completed event arrives once the image is ready, so your code doesn’t need to special-case models.
  • When streaming, images are returned as base64 (b64_json) by default; with response_format: "url" the final image is returned as a URL, while partial images stay base64.
  • Without partial images the connection may be silent for a long time before the final image arrives, so set your client’s read timeout to a few minutes.

Common parameters

Notes

  1. Set OPENAI_BASE_URL to https://api.ephone.ai/v1
  2. Set OPENAI_API_KEY to your API key
  3. Most models support the OpenAI image endpoints; for the few that don’t, see the model documentation
  4. Image URLs (from response_format: "url" or the task API) expire, so download and keep them promptly

OpenAI image generation guide

Official usage guide, including streaming and editing

OpenAI Images API reference

Full parameters and event fields