Image Generation
Transform text into high-quality imagery with our unified Image Generation API. Use OpenAI's image models and many others (FLUX, Seedream, Nano Banana and more) through one endpoint.
Endpoint: POST /v1/images/generations
OpenAI-compatible: Yes
Request
- Content-Type:
application/json - Body: Same as OpenAI (see Request/response bodies).
Usage Examples
Python (OpenAI SDK)
from openai import OpenAI
client = OpenAI(
api_key="YOUR_FUNAI_API_KEY",
base_url="https://api.funai.art/v1"
)
response = client.images.generate(
model="gpt-image-1",
prompt="A futuristic city with flying cars",
size="1024x1024",
quality="standard",
n=1,
)
print(response.data[0].url)
Node.js (OpenAI SDK)
import OpenAI from 'openai';
const openai = new OpenAI({
apiKey: 'YOUR_FUNAI_API_KEY',
baseURL: 'https://api.funai.art/v1'
});
async function main() {
const image = await openai.images.generate({
model: 'gpt-image-1',
prompt: 'A sunset over a mountain range',
});
console.log(image.data[0].url);
}
main();
Response
Same shape as OpenAI: created, data array with url or b64_json, and optional revised_prompt. See Request/response bodies.
Notes
- Use a FunAI model ID such as
gpt-image-1orflux-schnell. See Models. - Most images come back in the response. If a model takes longer than the request
window, you get
202 Acceptedwith a job object and apoll_urlinstead of a timeout: poll it until the job isCOMPLETED. - Send an
Idempotency-Keyheader to make retries safe. See Idempotency. - For image editing, multiple outputs, video and audio, use the platform-native API.