Docs

Create Image

POST/v1/images/generations

Creates an image given a prompt

On this page
  1. Request Body
  2. Response
  3. Inline Response
  4. Request Example
  5. Response Example
  6. Available Models

For coding agents, choose a model from GET /v1/models, then send the selected model explicitly to this endpoint.

Request Body

Parameter model

Type: string

Location: body

Model to use (e.g., dall-e-3, gpt-image-1.5, flux-1.1-pro).

Parameter prompt

Type: string

Location: body

Required: yes

Text description of the desired image.

Parameter n

Type: integer

Location: body

Number of images to generate (1-4, model dependent).

Parameter size

Type: string

Location: body

Image size. Options vary by model:

  • DALL-E 3: 1024x1024, 1792x1024, 1024x1792
  • Other models: 512x512, 1024x1024, etc.

Parameter quality

Type: string

Location: body

Image quality (standard or hd). DALL-E 3 only.

Parameter response_format

Type: string

Location: body

Response format: url or b64_json.

Parameter style

Type: string

Location: body

Style for DALL-E 3: vivid or natural.

Parameter user

Type: string

Location: body

A unique identifier for the end-user.

Response

Inline Response

Response Field created

Type: integer

Unix timestamp of creation.

Response Field data

Type: array

Array of generated images.

Each object contains:

  • url (string): URL of the generated image
  • b64_json (string): Base64-encoded image (if requested)
  • revised_prompt (string): The prompt used (DALL-E 3)

Request Example

curl -X POST "https://api.anypath.dev/v1/images/generations" \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "dall-e-3",
    "prompt": "A white cat sitting on a windowsill watching rain",
    "size": "1024x1024",
    "quality": "standard",
    "n": 1
  }'
from openai import OpenAI

client = OpenAI(
    api_key="sk-your-api-key",
    base_url="https://api.anypath.dev/v1"
)

response = client.images.generate(
    model="dall-e-3",
    prompt="A white cat sitting on a windowsill watching rain",
    size="1024x1024",
    quality="standard",
    n=1
)

print(response.data[0].url)
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: 'sk-your-api-key',
  baseURL: 'https://api.anypath.dev/v1'
});

const response = await client.images.generate({
  model: 'dall-e-3',
  prompt: 'A white cat sitting on a windowsill watching rain',
  size: '1024x1024',
  quality: 'standard',
  n: 1
});

console.log(response.data[0].url);
<?php
$ch = curl_init('https://api.anypath.dev/v1/images/generations');

curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
        'Authorization: Bearer sk-your-api-key'
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'model' => 'dall-e-3',
        'prompt' => 'A white cat sitting on a windowsill watching rain',
        'size' => '1024x1024',
        'quality' => 'standard',
        'n' => 1
    ])
]);

$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
echo $data['data'][0]['url'];

Response Example

{
  "created": 1706000000,
  "data": [
    {
      "url": "https://...",
      "revised_prompt": "A fluffy white cat with bright eyes sitting peacefully on a wooden windowsill, watching raindrops stream down the glass window..."
    }
  ]
}

Available Models

The image-capable models available to your key change with route supply. Current examples:

ModelProvider familyNotes
dall-e-3OpenAIPrompt revision; supports quality and style
gpt-image-1.5OpenAICurrent OpenAI image generation and edits
gemini-2.5-flash-imageGeminiGemini image generation
grok-4-imagexAIxAI image generation
flux-1.1-proAggregate gatewaysProvider-qualified mapping

Call GET /v1/models with your API key for the exact models currently available to you.