Images

Create Image

Generate one or more images from a text prompt.

Billed per output image. Prompts are screened before anything is charged, and every request is steered to depict adults only.

POST/v1/images/generationsTry it

Authorizations

Authorizationstringheaderrequired

Bearer authentication header of the form Bearer <token>, where <token> is your SpicyAPI key (sk-spicy-…). Create one in the dashboard under API Keys.

Body

application/json

Outputs are persisted to our CDN and returned as durable URLs. Those URLs are the only images accepted as inputs to /v1/images/edits and /v1/videos/generations.

modelstringrequired

A model id from GET /v1/models, e.g. spicy-image-1.

promptstringrequired

What to generate.

negative_promptstring

What to avoid. Our own safety terms are always appended.

sizestring

width*height, e.g. 1024*1024. Defaults to the model's first supported size.

ninteger

How many images to return. Clamped to the model's maximum. Defaults to 1.

seedinteger

Reuse a seed to reproduce a result. Random when omitted.

Response

200application/json

Successful Response

idstringrequired

Request id, useful for support.

objectstringrequired

Always image.generation.

modelstringrequired

The model that produced the images.

createdintegerrequired

Unix timestamp.

dataImage · object[]required

One entry per generated image.

cost_usdnumberrequired

What this request cost, in US dollars, already debited from your balance.

Was this page helpful?

Create Image
cURL
curl --request POST \
  --url https://api.spicyapi.com/v1/images/generations \
  --header 'Authorization: Bearer $SPICYAPI_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "spicy-image-1",
    "prompt": "a woman on a beach at golden hour, photorealistic",
    "size": "1024*1024",
    "n": 1
  }'
200
JSON
{
  "id": "req_8f2a91c4",
  "object": "image.generation",
  "model": "spicy-image-1",
  "created": 1755950400,
  "data": [
    { "url": "https://cdn.spicyapi.com/outputs/a1b2/req_8f2a91c4-0.png" }
  ],
  "cost_usd": 0.06
}