Appearance
Image Generation
Generate images from text prompts using the OpenAI-compatible images API.
Endpoint
POST /v1/images/generationsRequest Body
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | Model ID to use. See Models. |
prompt | string | Yes | — | Text description of the image to generate. |
n | integer | No | 1 | Number of images to generate (1–10). |
size | string | No | model default | Output dimensions, e.g. "1024x1024", "1792x1024". |
quality | string | No | "standard" | "standard" or "hd". |
response_format | string | No | "url" | "url" or "b64_json". |
style | string | No | "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..."
}
]
}| Field | Description |
|---|---|
created | Unix timestamp of when the request was processed. |
data[].url | URL of the generated image (valid for 24 hours). |
data[].b64_json | Base64-encoded image data (when response_format="b64_json"). |
data[].revised_prompt | The 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_jsonformat, theurlfield is omitted andb64_jsoncontains the full image data. - The
revised_promptfield 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.