Grok Imagine - Text to Image
Endpoint
POST /images/generations
Full URL: https://modelfold.ai/v1/images/generations
Authentication: every request must include the
Authorization: Bearer <API_KEY>header.
Send model parameters directly in the JSON body. Do not wrap them in input. This request waits for generation to finish and returns data[].url; supported media models also offer async jobs, polling and callbacks. Replace example media URLs with your own publicly accessible files. See API gateway for billing and errors.
Input parameters for the image generation task
Request Parameters
Body (application/json)
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | The model name to use for generation. Required field. - Must be grok-imagine/text-to-image for this endpoint Default:"grok-imagine/text-to-image"。 Allowed values:grok-imagine/text-to-image。 Example:grok-imagine/text-to-image。 |
prompt | string | Yes | Prompt required by the ModelFold gateway; at most 2000 characters. Text prompt describing the desired image. Required field. - Should be detailed and specific about the desired visual elements - Describe composition, style, lighting, mood, and other visual details - Maximum length: 5000 characters - Supports English language prompts maxLength: 2000. Example:Cinematic portrait of a woman sitting by a vinyl record player, retro living room background, soft ambient lighting, warm earthy tones, nostalgic 1970s wardrobe, reflective mood, gentle film grain texture, shallow depth of field, vintage editorial photography style.。 |
aspect_ratio | string | Yes | Required. Aspect ratio of the output image: 2:3, 3:2, 1:1, 16:9, 9:16. Allowed values:2:3 / 3:2 / 1:1 / 16:9 / 9:16。 Example:3:2。 |
nsfw_checker | boolean | No | Defaults to false. When false, no additional content filtering is applied and results are returned directly by the model. |
enable_pro | boolean | No | Controls the request processing strategy. - false: Corresponds to speed mode. The system prioritizes response time and throughput, suitable for latency-sensitive scenarios. - true: Corresponds to quality mode. The system prioritizes processing quality and precision, suitable for scenarios requiring higher accuracy. |
Request Example
bash
curl -X POST "https://modelfold.ai/v1/images/generations" \
-H "Authorization: Bearer $MODELFOLD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine/text-to-image",
"prompt": "Cinematic portrait of a woman sitting by a vinyl record player, retro living room background, soft ambient lighting, warm earthy tones, nostalgic 1970s wardrobe, reflective mood, gentle film grain texture, shallow depth of field, vintage editorial photography style.",
"aspect_ratio": "3:2"
}'json
{
"model": "grok-imagine/text-to-image",
"prompt": "Cinematic portrait of a woman sitting by a vinyl record player, retro living room background, soft ambient lighting, warm earthy tones, nostalgic 1970s wardrobe, reflective mood, gentle film grain texture, shallow depth of field, vintage editorial photography style.",
"aspect_ratio": "3:2"
}Response
200 — Generation completed. usage contains actual billing details; result URLs are illustrative.
json
{
"ok": true,
"created": 1792134000,
"data": [
{
"url": "https://modelfold.ai/uploads/outputs/result.png"
}
],
"usage": {}
}