POST /v1/images/generations
Create an image from a text prompt.
- Method: POST
- Path: /v1/images/generations
- Auth: Bearer token in Authorizationheader
- Content-Type: application/json
Request Parameters
- model(string, required): Image generation model (e.g.,- flux-1-schnell).
- prompt(string, required, 1..8192): The text prompt for image generation.
- quality(string | null, optional): Provider-specific quality preset.
- size(string | null, optional): Target image resolution (e.g.,- 1024x1024).
- n(integer ≥ 1 | null, optional): Number of images to generate.
- response_format(enum:- url|- b64_json, default- url): Output format per image.
Example Request
- Python
- Node.js
- cURL
from openai import OpenAI
client = OpenAI(base_url="https://api.naga.ac/v1", api_key="YOUR_API_KEY")
resp = client.images.generate(
    model="flux-1-schnell",
    prompt="A white siamese cat",
    size="1024x1024",
    n=1,
    response_format="url",  # or "b64_json"
)
print(resp.data)  # array of images with url or b64_json
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.naga.ac/v1", apiKey: "YOUR_API_KEY" });
const resp = await client.images.generate({
  model: "flux-1-schnell",
  prompt: "A white siamese cat",
  size: "1024x1024",
  n: 1,
  response_format: "url", // or "b64_json"
});
console.log(resp.data);
curl https://api.naga.ac/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "flux-1-schnell",
    "prompt": "A white siamese cat",
    "size": "1024x1024",
    "n": 1,
    "response_format": "url"
  }'
Authentication
Provide your key as a Bearer token:
Authorization: Bearer YOUR_API_KEY
Response
Returns a JSON object with a data array of generated images. Each item contains either:
- urlwhen- response_format = "url", or
- b64_jsonwhen- response_format = "b64_json".
Response Fields
- created(integer): Unix timestamp of request creation
- data(array): Array of generated image objects- url(string, optional): Image URL (when- response_format = "url")
- b64_json(string, optional): Base64-encoded image (when- response_format = "b64_json")
- revised_prompt(string, optional): The actual prompt used after any modifications