body: '{"model":"gpt-image-1","prompt":"a red cat","size":"1024x1024"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
curl--requestPOST\
--urlhttps://example.com/images/generations\
--header'Authorization: Bearer <token>'\
--header'Content-Type: application/json'\
--data'{ "model": "gpt-image-1", "prompt": "a red cat", "size": "1024x1024" }'
OpenAI-compatible text-to-image. Returns base64 images (b64_json); url is not supported. Models: see GET /models (image), or dall-e-3/gpt-image-1. Charged per image.