Endpoints
Images
Generate and edit images with POST /images/generations on api14, with prompts, sizes, quality settings and response formats for each model.
Try it in the playgroundGenerate and edit images with every image model in the catalog, GPT image, Gemini image, FLUX, Seedream, Recraft and more. The endpoint uses the OpenAI SDK's path, so client.images.generate(...) works unchanged.
POST https://api14.com/api/v1/images/generations
POST /api/v1/images is accepted as an alias. Both forward the body unchanged.
Request
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | yes | An image model id, e.g. openai/gpt-5.4-image-2. |
prompt | string | yes | What to draw. |
n | integer | no | Number of images. Each image is billed. |
size | string | no | e.g. 1024x1024, 1536x1024. Supported sizes vary per model. |
aspect_ratio | string | no | e.g. 16:9, 1:1, for models that take ratios instead of sizes. |
quality | string | no | e.g. low, medium, high where supported. |
response_format | string | no | b64_json or url where supported. |
image | string or string[] | no | Reference image(s) as URLs or data: URIs for editing / image-to-image. |
Model-specific options (resolutions, aspect ratios) are listed per model in GET /images/models and on each model page.
Example
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api14.com/api/v1",
apiKey: process.env.API14_API_KEY,
});
const result = await client.images.generate({
"model": "openai/gpt-5.4-image-2",
"prompt": "A minimalist product photo of a ceramic mug on a wooden table",
"n": 1,
"aspect_ratio": "1:1"
});
import { writeFile } from "node:fs/promises";
await writeFile("image.png", Buffer.from(result.data[0].b64_json, "base64"));
Response
{
"created": 1791100000,
"data": [
{ "b64_json": "iVBORw0KGgoAAAANSUhEUgAA..." }
],
"usage": { "cost": 0.04 }
}
Some models return url instead of b64_json. Download hosted URLs promptly; they can expire.
Images through chat
Image models that also output text can be called through Chat completions with modalities:
{
"model": "google/gemini-2.5-flash-image",
"modalities": ["image", "text"],
"messages": [{ "role": "user", "content": "A watercolor fox, square" }]
}
Generated images come back in choices[0].message.images[] as data URLs.
Listing image models
# Public, no API key needed
curl https://api14.com/api/v1/images/models
curl "https://api14.com/api/v1/models?category=image"
Pricing
Image models are billed at their listed price, per image or per 1M image tokens, depending on the model. The exact cost is taken from the upstream response and debited from your USD balance.
Errors
| Status | Code | When |
|---|---|---|
| 400 | model_required / invalid_json | Missing model or malformed body. |
| 402 | insufficient_balance | Your USD balance is $0. |
| 403 | model_not_allowed / plan_required | Key allowlist or plan excludes the model. |
| 404 | model_not_found | Unknown or disabled model id. |
| 413 | payload_too_large | Body (e.g. inline reference images) exceeds the size limit. |
Upstream validation errors (unsupported size, content policy) are passed through with their status. See Errors.