POST
/api/v1/images/generations
Generate images from text prompts using any supported image model.
Request Body
| Parameter | Type | Description |
|---|---|---|
modelrequired | string | Image model slug, e.g. "flux-schnell", "dall-e-3" |
promptrequired | string | Text description of the image to generate. |
n | number | Number of images (1-4).Default: 1 |
size | string | "256x256", "512x512", "1024x1024", "1024x1792", "1792x1024"Default: "1024x1024" |
quality | string | "standard" or "hd". |
style | string | "vivid" or "natural". |
negative_prompt | string | Things to exclude from the image. |
Examples
javascript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "rw_live_xxxxx",
baseURL: "https://railwail.com/api/v1",
});
const response = await client.images.generate({
model: "flux-schnell",
prompt: "A beautiful sunset over Tokyo",
size: "1024x1024",
});
console.log(response.data[0].url);Response
JSON
{
"created": 1700000000,
"data": [
{
"url": "https://cdn.railwail.com/images/abc123.png",
"revised_prompt": "A stunning sunset casting warm orange..."
}
]
}Compatible Models
flux-schnell
flux-1.1-pro
flux-dev
dall-e-3
dall-e-2
stable-diffusion-3.5-large
ideogram-v2
recraft-v3
+ more