# Create Image

`POST /v1/images/generations`

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.

Base URL: `https://api.spicyapi.com`

## Authorizations

- `Authorization` (string, header, required): 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`.

- `model` (string, required): A model id from `GET /v1/models`, e.g. `spicy-image-1`.
- `prompt` (string, required): What to generate.
- `negative_prompt` (string, optional): What to avoid. Our own safety terms are always appended.
- `size` (string, optional): `width*height`, e.g. `1024*1024`. Defaults to the model's first supported size.
- `n` (integer, optional): How many images to return. Clamped to the model's maximum. Defaults to 1.
- `seed` (integer, optional): Reuse a seed to reproduce a result. Random when omitted.

## Request

```bash
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
  }'
```

## Response: 200 application/json

Successful Response

- `id` (string, required): Request id, useful for support.
- `object` (string, required): Always `image.generation`.
- `model` (string, required): The model that produced the images.
- `created` (integer, required): Unix timestamp.
- `data` (Image · object[], required): One entry per generated image.
  - `url` (string, required): Durable CDN URL. Reusable as an input to edits and video.
- `cost_usd` (number, required): What this request cost, in US dollars, already debited from your balance.

```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
}
```
