Images

Generate images from text prompts using DALL-E through the OpenAI-compatible API with BYOK support.

Availability. Image generation is enabled per organization and is off by default. POST /v1/images/generations answers 503 with Image generation unavailable for this organization until it is turned on for your account. Ask support to enable it before building against this endpoint.

Generate images from text prompts using the image generation API. Requests are proxied to OpenAI's DALL-E API with automatic BYOK key resolution.


Quick start

curl -sS https://api.xantly.com/v1/images/generations \
  -H "Authorization: Bearer $XANTLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "dall-e-3",
    "prompt": "A futuristic city skyline at sunset, digital art style",
    "n": 1,
    "size": "1024x1024"
  }'

Request body

FieldTypeRequiredDescription
promptstringYesText description of the image to generate.
modelstringNo"dall-e-3" (default) or "dall-e-2".
nintegerNoNumber of images to generate (1-10). DALL-E 3 only supports n=1.
sizestringNoImage size: "1024x1024" (default), "1024x1792", "1792x1024" (DALL-E 3), or "256x256", "512x512" (DALL-E 2).
qualitystringNo"standard" (default) or "hd". DALL-E 3 only.
stylestringNo"vivid" (default) or "natural". DALL-E 3 only.
response_formatstringNo"url" (default) or "b64_json".
userstringNoEnd-user identifier.

Response body

{
  "created": 1741400000,
  "data": [
    {
      "url": "https://oaidalleapiprodscus.blob.core.windows.net/...",
      "revised_prompt": "A futuristic city skyline at sunset..."
    }
  ]
}
FieldTypeDescription
createdintegerUnix epoch timestamp.
dataarrayGenerated images.
data[].urlstringURL of the generated image (when response_format is "url"). URLs expire after 1 hour.
data[].b64_jsonstringBase64-encoded image data (when response_format is "b64_json").
data[].revised_promptstringThe prompt after DALL-E 3 revision (may differ from input).

Code examples

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["XANTLY_API_KEY"],
    base_url="https://api.xantly.com/v1",
)

response = client.images.generate(
    model="dall-e-3",
    prompt="A cat wearing a space helmet, oil painting",
    size="1024x1024",
    quality="standard",
    n=1,
)
print(response.data[0].url)
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.XANTLY_API_KEY,
  baseURL: "https://api.xantly.com/v1",
});

const response = await client.images.generate({
  model: "dall-e-3",
  prompt: "A cat wearing a space helmet, oil painting",
  size: "1024x1024",
  quality: "standard",
  n: 1,
});
console.log(response.data[0].url);

BYOK support

The images endpoint automatically resolves your organization's BYOK OpenAI key. If no BYOK key is configured, the platform key is used as a fallback.


Errors

HTTPerror.typeTypical trigger
400invalid_request_errorMissing prompt, invalid size, unsupported parameters.
401authentication_errorMissing or invalid Bearer token.
500provider_errorNo OpenAI API key configured, or upstream error.

Next steps