Skip to main content
POST
/
images
/
generations
curl --request POST \
--url https://api.anyapi.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "MODEL_EXAMPLE",
"prompt": "A cute baby sea otter",
"n": 1,
"size": "1024x1024"
}'
{
  "created": 123,
  "data": [
    {
      "url": "<string>",
      "b64_json": "<string>",
      "revised_prompt": "<string>"
    }
  ]
}

Authorizations

Authorization
string
header
required

Bearer token authentication. Get your API key from the dashboard.

Body

application/json
model
string
required

The model to use for image generation

Example:

"gpt-image-1"

prompt
string
required

A text description of the desired image(s)

Maximum length: 1000
Example:

"A cute baby sea otter"

n
integer
default:1

The number of images to generate

Required range: 1 <= x <= 10
size
enum<string>
default:1024x1024

The size of the generated images

Available options:
256x256,
512x512,
1024x1024,
1792x1024,
1024x1792
stream
boolean
default:false

If set, generation progress updates will be sent as server-sent events

response_format
enum<string>
default:url

The format in which the generated images are returned

Available options:
url,
b64_json

Response

Successful response

created
integer
required

The Unix timestamp (in seconds) of when the images were generated

data
object[]
required

Array of generated image objects

I