Skip to main content
POST
/
v1
/
images
/
generations
Generate an image
curl --request POST \
  --url https://api.deepshi.ai/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "nano-banana-pro",
  "prompt": "a serene canal in Venice at sunset",
  "n": 1,
  "response_format": "b64_json",
  "stream": false,
  "seed": 123,
  "width": 123,
  "height": 123,
  "aspect_ratio": "16:9",
  "resolution": "2K",
  "image_size": "auto_2K"
}
'
{
  "created": 123,
  "model": "<string>",
  "size": "<string>",
  "data": [
    {
      "index": 123,
      "b64_json": "<string>",
      "url": "<string>",
      "revised_prompt": "<string>"
    }
  ],
  "usage": {
    "prompt_tokens": 123,
    "prompt_tokens_details": {
      "cached_tokens": 123,
      "cached_read_tokens": 123,
      "image_tokens": 123
    },
    "completion_tokens": 123,
    "completion_tokens_details": {
      "reasoning_tokens": 123,
      "image_tokens": 123
    },
    "total_tokens": 123,
    "cost": {
      "total_cost": 0.000135
    }
  }
}

Authorizations

Authorization
string
header
required

Your Deepshi API key, sent as Authorization: Bearer <key>.

Body

application/json

Image generation request. model and prompt are required. The remaining fields are optional; a model safely ignores any field it does not support. Model-specific sizing/quality fields (width/height, aspect_ratio, resolution, quality, image_size) apply only to the models that declare them — see GET /v1/models. Additional model-specific parameters not listed here may also be sent and are forwarded to the model.

model
string
required

The image model id to use. See GET /v1/models.

Example:

"nano-banana-pro"

prompt
string
required

Text description of the image to generate.

Example:

"a serene canal in Venice at sunset"

n
integer
default:1

Number of images to generate (1–4).

Required range: 1 <= x <= 4
response_format
enum<string>
default:b64_json

How images are returned. url returns an inline base64 data: URI, not a hosted link.

Available options:
b64_json,
url
output_format
enum<string>

Encoding of the returned image. Not all models honor every format.

Available options:
png,
jpeg,
webp
stream
boolean
default:false

Stream the result as Server-Sent Events. Use it for slow, high-resolution generations that would otherwise time out.

seed
integer

Seed for reproducible output. Omit for a random seed.

width
integer

Model-specific. Output width in pixels, for pixel-dimension models (e.g. flux-2-pro).

height
integer

Model-specific. Output height in pixels, for pixel-dimension models.

aspect_ratio
string

Model-specific. Aspect ratio for aspect-ratio and resolution-tier models.

Example:

"16:9"

resolution
string

Model-specific. Resolution tier for resolution-tier models (e.g. nano-banana-2, nano-banana-pro, grok-imagine-quality). Determines the billed price for those models.

Example:

"2K"

quality
enum<string>

Model-specific. Quality tier for the GPT Image models (gpt-image-1.5, gpt-image-2). Higher tiers cost more, and the price depends on the image size and quality you pick. Omit to use the model's default tier.

Available options:
low,
medium,
high
image_size
string

Model-specific. Named output size for preset-size models (e.g. seedream-4.5).

Example:

"auto_2K"

Response

The generated image(s). When stream: true, the response is a Server-Sent Events stream (text/event-stream): periodic keepalive comments followed by a terminal image_generation.completed event carrying the final image (see the ImageStreamEvent schema).

created
integer<int64>

Unix timestamp when the request was created.

model
string

The image model id you requested.

size
string

The actual output dimensions, as WIDTHxHEIGHT.

data
object[]

The generated image(s).

usage
object

Token usage and the billed cost for the request.