The fields an image model accepts: GET /v1/models/{id} and the size option

All in One AIAI Images·· 5 views· 3 min read

In short: each image model has its own fields, which go inside input in the generation request. The right list comes from GET /v1/models/{id}: the name of each field, its type, whether it is required, the accepted values and the default. The image size is one of those fields, and each model accepts its own sizes.

Asking for the fields of a model

Send the id with its slashes, as it is. It needs a key with ai:read and spends no credits:

curl "https://api.interweb.ao/v1/models/openai/gpt-image-2/text-to-image" \
-H "Authorization: Bearer $INTERWEB_API_KEY"

In Windows PowerShell:

curl.exe "https://api.interweb.ao/v1/models/openai/gpt-image-2/text-to-image" -H "Authorization: Bearer $env:INTERWEB_API_KEY"

The answer has the model, as in the list, plus input: a list with one item per field.

What each field brings

Part What it says
name The field name, to use inside input.
type The type of value: string, integer, number, boolean, or image, video and audio for a field that takes the public URL of a file.
required Whether the field is required.
options The accepted values, when the list is closed.
default The value used when you do not send the field.
min / max The limits, for number fields.
description What the field is for.

The example in our documentation

For openai/gpt-image-2/text-to-image, the documentation shows these fields. Always check them for the model you will use, because each one has its own and they can change:

Field Required Accepted values Default
prompt Yes Text: what the image should show. None
size No 1024x1024, 1024x1536, 1536x1024, 2048x2048 1024x1024
quality No low, medium, high medium
output_format No jpeg, png jpeg

Using the size in the request

The fields go inside input, in POST /v1/media/generations. A field you do not send takes its default value:

{
"model": "openai/gpt-image-2/text-to-image",
"input": {
"prompt": "A bakery shop window with fresh bread, soft morning light",
"size": "1536x1024",
"quality": "medium",
"output_format": "png"
}
}

A value that is not in options, or a required field that is missing, gives 422 validation_failed. The error's details says which field.

Size and price

The price on the Models tab and in pricing is the base price, per image. The real cost can change with the options you choose, such as size or quality. That is why the request reserves credits first (credits_reserved) and settles at the end (credits_charged): if the reservation was larger, the rest goes back to your balance. See what an AI image costs.

Without code: in the Playground, Image tab, when you pick a model these same fields appear, some in view and the rest under «Model options». In the terminal, use aio model <id>. In an agent with the MCP server, the get_model tool shows them to the agent.

Want to try the sizes without code? Open the All in One AI Playground.

See All in One AI

SEE ALSO

Choosing an image model in All in One AI: the Models tab, the price and the options

Creating AI images through the API: the request, the status and saving the file

What an AI image costs in credits: the price per image, the reserve and the refund

Listing the AI models through the API: GET /v1/models with type and q

All in One AI

RECOMMENDED PRODUCT

Web hosting with cPanel

Domain and SSL included, daily backups and the panel you already know. from 5.940,00 Kz/mo (3-year plan, with coupon)

See plans
Was this answer helpful? Your answer helps us improve this article.