Default Parameters for GPT-Image-2 Generation: Complete API Reference
The GPT-Image-2 generation API in the freestylefly/awesome-gpt-image-2 repository automatically applies built-in defaults—model gpt-image-2, 10,000-character prompt limit, single image output (n=1), 1:1 aspect ratio at 1k resolution (1024×1024), English language (en), and $0.010625 pricing—unless explicitly overridden in the request body.
When integrating the /api/generate-image endpoint, developers should understand these hardcoded defaults defined in the source code. The repository automatically applies these parameters through the buildApimartGenerationPayload function, ensuring consistent behavior while allowing selective customization via the POST request payload.
Core Model and Configuration Defaults
The foundational constants governing GPT-Image-2 generation are defined in shared/apimart.js:
- Model:
gpt-image-2— specified by theAPIMART_MODELconstant (line 1) - Maximum Prompt Length:
10,000characters — enforced byAPIMART_MAX_PROMPT_LENGTH(line 5) - Default Price:
$0.010625per 1k-resolution image — set byAPIMART_DEFAULT_PRICE_USD(line 3)
These constants act as the system-wide baseline for all generation requests.
Image Generation Defaults in buildApimartGenerationPayload
The buildApimartGenerationPayload function in shared/apimart.js initializes image-specific parameters with the following defaults:
- Number of Images (
n):1(line 11) - Aspect Ratio (
size):1:1(square format) (line 12) - Resolution (
resolution):1k(approximately 1024×1024 pixels) (line 13)
These values are applied to the payload object before merging with client-supplied options.
Localization and Webhook Defaults
Additional defaults handle internationalization and callbacks:
- Language: English (
en) — the function checks for alanguagefield and defaults to"en"unless the caller explicitly supplieszh(lines 17-18 ofbuildApimartGenerationPayload) - Webhook URL: Empty string — in
api/generate-image.js, thesubmitApimartGenerationfunction only adds awebhookfield to the payload ifappUrlis present (lines 48-49), effectively defaulting to no callback
Practical Usage Examples
Minimal Request (Using All Defaults)
Send a request with only the required prompt and caseId to accept all default parameters:
await fetch('/api/generate-image', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
prompt: 'a futuristic city skyline at sunset',
caseId: 12345 // required, but other fields optional
})
});
This triggers the default configuration: single 1k square image in English using gpt-image-2.
Overriding Select Defaults
Override specific parameters while retaining others:
await fetch('/api/generate-image', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
prompt: '一只在雪山上的狐狸',
caseId: 12346,
language: 'zh',
// The API will still use n=1, size=1:1, but resolution changes to 4k internally
// because the client can request a different resolution via a webhook or later request.
})
});
Here, the language defaults are overridden to Chinese (zh), while image count and aspect ratio remain at their standard values.
Summary
- The system defaults to the
gpt-image-2model viaAPIMART_MODELinshared/apimart.js. - Generation produces 1 image at 1:1 aspect ratio with 1k resolution (1024×1024) unless specified otherwise.
- Prompts are limited to 10,000 characters as defined by
APIMART_MAX_PROMPT_LENGTH. - Standard generation costs $0.010625 per image at default resolution.
- The API defaults to English (
en) language settings and no webhook callback unless the request includes alternative values.
Frequently Asked Questions
What is the maximum prompt length allowed for GPT-Image-2 generation?
The API enforces a hard limit of 10,000 characters defined by the APIMART_MAX_PROMPT_LENGTH constant in shared/apimart.js (line 5). Requests exceeding this threshold are rejected before processing begins.
How many images does the API generate by default?
By default, the API generates one image (n=1) with a 1:1 square aspect ratio. These values are hardcoded in the buildApimartGenerationPayload function at lines 11-12 of shared/apimart.js.
What is the default resolution and pricing for generated images?
The default resolution is 1k (approximately 1024×1024 pixels), with each image costing $0.010625 as specified by APIMART_DEFAULT_PRICE_USD in shared/apimart.js (line 3). The system supports alternative resolutions, but 1k serves as the baseline.
Does the API default to English, and can I change the language?
Yes, the default language is English (en). The buildApimartGenerationPayload function (lines 17-18 of shared/apimart.js) checks for a language field in the request and falls back to en if not provided. To generate Chinese prompts, explicitly set language: "zh" in the request body.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →