Google - imagen4
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 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 google/imagen4 for this endpoint Default:"google/imagen4"。 Allowed values:google/imagen4。 Example:google/imagen4。 |
prompt | string | Yes | Prompt required by the ModelFold gateway; at most 2000 characters. The text prompt describing what you want to see (Max length: 5000 characters) maxLength: 2000. Example:A lively comic scene where two colleagues are in an office. The first person says, 'Have you heard about Google Imagen 4 Ultra?' The second person responds with excitement, 'It’s the best text-to-image tool out there!' The first person asks again, 'Do you know where to get the API?' The second person smiles and says, 'modelfold.ai has it!' In the final panel, the two look at a screen showing modelfold.ai’s interface with an API option, with bright and colorful comic-style illustrations.。 |
negative_prompt | string | No | A description of what to discourage in the generated images (Max length: 5000 characters) maxLength: 5000. Example:``。 |
aspect_ratio | string | Yes | Required. Aspect ratio of the output image: 1:1, 16:9, 9:16, 3:4, 4:3 or auto. Allowed values:1:1 / 16:9 / 9:16 / 3:4 / 4:3 / auto。 Example:1:1。 |
seed | string | No | Random seed for reproducible generation (Max length: 500 characters) maxLength: 500. Example:``。 |
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": "google/imagen4",
"prompt": "A lively comic scene where two colleagues are in an office. The first person says, '\''Have you heard about Google Imagen 4 Ultra?'\'' The second person responds with excitement, '\''It’s the best text-to-image tool out there!'\'' The first person asks again, '\''Do you know where to get the API?'\'' The second person smiles and says, '\''ModelFold has it!'\'' In the final panel, the two look at a screen showing ModelFold’s interface with an API option, with bright and colorful comic-style illustrations.",
"aspect_ratio": "1:1"
}'json
{
"model": "google/imagen4",
"prompt": "A lively comic scene where two colleagues are in an office. The first person says, 'Have you heard about Google Imagen 4 Ultra?' The second person responds with excitement, 'It’s the best text-to-image tool out there!' The first person asks again, 'Do you know where to get the API?' The second person smiles and says, 'ModelFold has it!' In the final panel, the two look at a screen showing ModelFold’s interface with an API option, with bright and colorful comic-style illustrations.",
"aspect_ratio": "1:1"
}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": {}
}