Skip to content

Image Generation ​

Generate images from text prompts using the OpenAI-compatible images API.

Endpoint ​

POST /v1/images/generations

Request Body ​

ParameterTypeRequiredDefaultDescription
modelstringYes—Model ID to use. See Models.
promptstringYes—Text description of the image to generate.
nintegerNo1Number of images to generate (1–10).
sizestringNomodel defaultOutput dimensions, e.g. "1024x1024", "1792x1024".
qualitystringNo"standard""standard" or "hd".
response_formatstringNo"url""url" or "b64_json".
stylestringNo"vivid""vivid" or "natural".

Response ​

json
{
  "created": 1716000000,
  "data": [
    {
      "url": "https://cdn.artapi.ai/images/abc123.webp",
      "revised_prompt": "A serene mountain lake at golden hour, photorealistic..."
    }
  ]
}
FieldDescription
createdUnix timestamp of when the request was processed.
data[].urlURL of the generated image (valid for 24 hours).
data[].b64_jsonBase64-encoded image data (when response_format="b64_json").
data[].revised_promptThe prompt as interpreted/expanded by the model (when applicable).

Examples ​

curl ​

bash
curl https://app.artapi.ai/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "flux-dev",
    "prompt": "A minimalist logo for a tech startup, flat design, blue tones",
    "n": 1,
    "size": "1024x1024",
    "quality": "hd"
  }'

Python (openai SDK) ​

OpenAI SDK compatible

ArtAPI is a drop-in replacement. Set base_url to https://app.artapi.ai/v1 and use the SDK as-is.

python
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://app.artapi.ai/v1",
)

response = client.images.generate(
    model="flux-dev",
    prompt="A minimalist logo for a tech startup, flat design, blue tones",
    n=1,
    size="1024x1024",
    quality="hd",
)

print(response.data[0].url)

Node.js (openai SDK) ​

javascript
import OpenAI from 'openai'

const client = new OpenAI({
  apiKey: process.env.ARTAPI_KEY,
  baseURL: 'https://app.artapi.ai/v1',
})

const response = await client.images.generate({
  model: 'flux-dev',
  prompt: 'A minimalist logo for a tech startup, flat design, blue tones',
  n: 1,
  size: '1024x1024',
  quality: 'hd',
})

console.log(response.data[0].url)

Notes ​

  • Image URLs expire after 24 hours. Download and store images you need to keep.
  • For b64_json format, the url field is omitted and b64_json contains the full image data.
  • The revised_prompt field may differ from your input — some models expand or refine the prompt for better results.
  • Generation time varies by model. FLUX models typically return in 5–15 seconds.

ArtAPI — Enterprise Image Generation