Skip to main content
POST
/
v1
/
images
/
generations
curl --request POST \
  --url 'https://api.elkapi.com/v1/images/generations' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "prompt": "A small kitten running through a sunny garden, cinematic, highly detailed",
  "model": "gpt-image-1.5",
  "size": "1024x1024",
  "stream": false
}'
{
  "created": 1,
  "data": [
    {
      "b64_json": "b64_json",
      "url": "https://example.com/image.png"
    }
  ],
  "usage": {
    "total_tokens": 1,
    "input_tokens": 1,
    "output_tokens": 1,
    "input_tokens_details": {
      "text_tokens": 1,
      "image_tokens": 1
    }
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.elkapi.com/llms.txt

Use this file to discover all available pages before exploring further.

curl --request POST \
  --url 'https://api.elkapi.com/v1/images/generations' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "prompt": "A small kitten running through a sunny garden, cinematic, highly detailed",
  "model": "gpt-image-1.5",
  "size": "1024x1024",
  "stream": false
}'
{
  "created": 1,
  "data": [
    {
      "b64_json": "b64_json",
      "url": "https://example.com/image.png"
    }
  ],
  "usage": {
    "total_tokens": 1,
    "input_tokens": 1,
    "output_tokens": 1,
    "input_tokens_details": {
      "text_tokens": 1,
      "image_tokens": 1
    }
  }
}

Authorizations

Authorization
string
required
All endpoints require Bearer Token authentication.Add it to the request headers:
Authorization: Bearer YOUR_API_KEY

Body

model
string
default:"gpt-image-1.5"
Model used for image generation. One of dall-e-2, dall-e-3, or gpt-image-1. Defaults to dall-e-2 unless a gpt-image-1-specific parameter is used.Example: gpt-image-1.5
prompt
string
required
Text description of the desired image. The maximum length is 32,000 characters for gpt-image-1, 1,000 characters for dall-e-2, and 4,000 characters for dall-e-3.
n
integer
Number of images to generate. Must be between 1 and 10. For dall-e-3, only n=1 is supported.
size
string
Size of the generated image. For gpt-image-1, it must be one of 1024x1024, 1536x1024 (landscape), 1024x1536 (portrait), or auto (default). For dall-e-2, it must be one of 256x256, 512x512, or 1024x1024. For dall-e-3, it must be one of 1024x1024, 1792x1024, or 1024x1792.
background
string
Allows setting background transparency for the generated image. This parameter is only supported by gpt-image-1. Must be one of transparent, opaque, or auto (default). When using auto, the model automatically determines the best background for the image.If the background is transparent, the output format must support transparency, so set it to png (default) or webp.
moderation
string
Controls the content moderation level for images generated by gpt-image-1. Use low for less restrictive filtering or auto (default).
quality
string
The quality of the generated image.
stream
string
style
string
user
string

Response

created
integer
data
array<object>
data.b64_json
string
data.url
string
required
usage
object
usage.total_tokens
integer
required
usage.input_tokens
integer
required
usage.output_tokens
integer
required
usage.input_tokens_details
object
required
usage.input_tokens_details.text_tokens
integer
required
usage.input_tokens_details.image_tokens
integer
required