Image generation endpoint handler.
POST
/v1/images/generations
const url = 'https://example.com/v1/images/generations';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"height":720,"model":"mistral","n":1,"prompt":"Draw a picture of a majestic, snow-covered mountain.","response_format":"Url","width":1280}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/images/generations \ --header 'Content-Type: application/json' \ --data '{ "height": 720, "model": "mistral", "n": 1, "prompt": "Draw a picture of a majestic, snow-covered mountain.", "response_format": "Url", "width": 1280 }'Request Body required
Section titled “Request Body required ” Media type application/json
Image generation request
object
height
Image height in pixels
integer
Example
720 model
Model ID; “default” targets the only loaded model.
string
Example
mistral n
How many choices to generate.
integer
Example
1 prompt
required
string
Example
Draw a picture of a majestic, snow-covered mountain. response_format
Return generated images as URLs or base64 data.
string
width
Image width in pixels
integer
Example
1280Responses
Section titled “ Responses ”Image generation