Skip to main content
The images API turns a text prompt into an image. It works with the official OpenAI image SDKs, so you can keep your existing setup and just point it at the Deepshi base URL. New here? Follow the three steps below. You’ll have an image saved to disk in a couple of minutes.

Step 1: Send a request

A request needs just two things: a model and a prompt. Browse the available ids on the image models page. deepshi-banana-pro is a fast, low-cost default.
curl
You get back a JSON body. The image is base64-encoded in data[0].b64_json:

Step 2: Save the image

Decode b64_json and write it to a file. With the OpenAI SDK that’s just a few lines:

Step 3: Set the image size

Models size their output in different ways. Send the field or fields your chosen model supports:
  • Pixel dimensions: exact width and height. Examples: deepshi-banana-pro, flux-2-pro.
  • Resolution tier: an aspect_ratio plus a resolution like 1K, 2K, or 4K. Examples: nano-banana-2, nano-banana-pro.
  • Aspect ratio: just an aspect_ratio like 16:9. Example: grok-imagine.
  • Preset size: a named image_size like auto_2K or 1024x1024. Examples: seedream-4.5, gpt-image-2.
Pixel-dimension model
Resolution-tier model
Not sure which fields a model takes? See Choosing a model below. Every model lists its sizing fields in GET /v1/models. A model ignores fields it doesn’t support, so don’t carry one model’s sizing style over to another.
That’s the full loop: send a prompt, read the response, save the file. The rest of this page covers picking a model and pricing. To edit an existing image, see Image editing.

Choosing a model

Each image model supports different parameters, sizing styles, and limits. There are two ways to see them:
  • The image models page, with a card per model showing its sizing style, prompt limit, and editing support.
  • GET /v1/models, the same facts as JSON, scoped to your key (you only see models your key can call).
Each image entry lists the parameters it accepts (with type, allowed values, and default), plus an edit block, prompt_max_length, and its modalities:
Example image model entry

Common parameters

These apply across image models. Anything else you send is passed straight to the model and only takes effect if that model supports it.
string
required
The image model id. Take it from GET /v1/models.
string
required
What to generate. Each model caps the length (2,500 to 50,000 characters); over the limit returns 400 PROMPT_TOO_LONG.
integer
default:"1"
Number of images (1 to 4). deepshi-banana-pro and deepshi-image-1 support only n: 1. Cannot be combined with stream: true.
string
default:"b64_json"
b64_json or url (an inline data: URI).
string
png, jpeg, or webp (per model; some accept only png and jpeg, and the Kling image models accept only png).
string
For the GPT Image models: low, medium, or high. Higher tiers cost more. Other models ignore it.
integer
Seed for reproducible output. Omit for a random seed. Supported by some models.
boolean
Stream the result as Server-Sent Events. A streamed response carries a single image, so n must be 1. See Long-running generations.

Pricing

Image pricing is per image for most models, and per megapixel for a few. For many models it depends on what you request, such as the resolution, quality, or output size. You never calculate this yourself. Every response includes usage.cost.total_cost in USD, the exact amount deducted from your balance. Per-model prices are listed on deepshi.ai.

Long-running generations

High-resolution generations can take a while. For a slow generation, set stream: true to receive the result as Server-Sent Events instead of one buffered response. Streamed generations bill exactly the same. See Streaming.

Next steps

Image editing

Edit an existing image with a prompt.

Image models

Browse image models and their sizing options.