We use cookies. Cookies and browser storage keep you signed in and remember your preferences. With your permission we also measure how the site is used. You can any time. See our cookie policy.

Images

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 playground

Generate 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

ParameterTypeRequiredDescription
modelstringyesAn image model id, e.g. openai/gpt-5.4-image-2.
promptstringyesWhat to draw.
nintegernoNumber of images. Each image is billed.
sizestringnoe.g. 1024x1024, 1536x1024. Supported sizes vary per model.
aspect_ratiostringnoe.g. 16:9, 1:1, for models that take ratios instead of sizes.
qualitystringnoe.g. low, medium, high where supported.
response_formatstringnob64_json or url where supported.
imagestring or string[]noReference 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

StatusCodeWhen
400model_required / invalid_jsonMissing model or malformed body.
402insufficient_balanceYour USD balance is $0.
403model_not_allowed / plan_requiredKey allowlist or plan excludes the model.
404model_not_foundUnknown or disabled model id.
413payload_too_largeBody (e.g. inline reference images) exceeds the size limit.

Upstream validation errors (unsupported size, content policy) are passed through with their status. See Errors.