Melious
API Reference

Images

POST /v1/images/generations — generate images from text

Generate images from text prompts. OpenAI-compatible shape, base64 responses only (we don't host public image URLs for privacy reasons).

Endpoint:

POST /v1/images/generations

Auth: Bearer token or x-api-key, or a browser session. Requires scope inference.images on keys. Requires a plan with the studio_access benefit.

Example

import base64
from openai import OpenAI

client = OpenAI(
    api_key="sk-mel-<YOUR_API_KEY>",
    base_url="https://api.melious.ai/v1",
)

response = client.images.generate(
    model="flux-schnell",
    prompt="A Hanseatic trading ship entering Lübeck harbor at dawn, painted in oils",
    n=1,
    size="1024x1024",
)

with open("ship.png", "wb") as f:
    f.write(base64.b64decode(response.data[0].b64_json))
import fs from "node:fs";
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "sk-mel-<YOUR_API_KEY>",
  baseURL: "https://api.melious.ai/v1",
});

const response = await client.images.generate({
  model: "flux-schnell",
  prompt: "A Hanseatic trading ship entering Lübeck harbor at dawn, painted in oils",
  n: 1,
  size: "1024x1024",
});

fs.writeFileSync("ship.png", Buffer.from(response.data[0].b64_json, "base64"));
curl https://api.melious.ai/v1/images/generations \
  -H "Authorization: Bearer sk-mel-<YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "flux-schnell",
    "prompt": "A Hanseatic trading ship entering Lübeck harbor at dawn, painted in oils",
    "n": 1,
    "size": "1024x1024"
  }' | jq -r '.data[0].b64_json' | base64 --decode > ship.png

Request

ParameterTypeDefaultDescription
promptstringText description. Prompt conventions vary by model — see below.
modelstring"dall-e-3" (alias)Image model ID. Browse melious.ai/hub filtered by type.
ninteger1Number of images, [1, 10].
sizestring"1024x1024""1024x1024", "1792x1024", "1024x1792" — varies by model.
qualitystring"standard""standard" or "hd".
stylestring"vivid""vivid" or "natural".
response_formatstring"b64_json""b64_json" only. URL format is not supported — see below.
seedintegerrandomDeterministic generation when the model supports it.
userstringnoneEnd-user identifier.

Model-specific parameters

FLUX and SDXL variants also accept:

  • steps — diffusion steps. Higher = slower but more refined.
  • guidance — classifier-free guidance scale.
  • input_images — array of base64 reference images (for img2img variants).
  • lora_weights, lora_scale — LoRA adapters.
  • negative_prompt — concepts to avoid.
  • width, height — explicit dimensions where the model supports free sizes.
  • output_format, output_quality — post-encoding controls.

Pass these at the top level of the request body — the server routes them to the right model.

Responses are base64 only. We don't host CDN-style URLs for generated images because privacy: a URL means we'd be storing your generation. Instead, decode b64_json client-side and store wherever you need.

Response

{
  "created": 1699999999,
  "data": [
    {
      "b64_json": "<base64 PNG data>",
      "revised_prompt": "A Hanseatic trading ship..."
    }
  ],
  "energy_cost": 0.012,
  "credits_cost": 0.0
}
  • data[].b64_json — base64 PNG (or the format your model returned).
  • data[].revised_prompt — some models revise the prompt before generation; the revised version is returned here. May be absent.
  • energy_cost / credits_cost — images bill slightly differently than token endpoints; numbers are per-request totals.

Prompt notes

FLUX-schnell is fast and forgiving — even short prompts work. FLUX-dev and SDXL reward specificity: subject, medium, composition, light, mood. Avoid ambiguity — "a tree" lands worse than "a gnarled oak tree in a misty meadow, morning light". Start with a base, generate once, iterate.

Errors

  • VALIDATION_4002prompt missing.
  • VALIDATION_4003 — plan doesn't include studio_access.
  • INFERENCE_3001 — unknown image model.
  • INFERENCE_3208 — content rejected by the provider's safety filter.
  • AUTH_1015 — missing inference.images scope.

Routing for flavor suffixes • Environmental impact for per-image energy.

On this page