OpenAI GPT Image 2 next-generation text-to-image.
Authenticate with the X-API-Key request header.
quality — pass quality in your request. Credit cost per image:| quality | credits / image | vs base |
|---|---|---|
| low | 3 | 0.4× |
| medium | 7 | 1× |
| high | 14 | 2× |
List price. Volume / bulk customers get a discounted rate — contact us for account pricing.
| Name | Type | Required | Description | Default / options |
|---|---|---|---|---|
| prompt | string | required | Text prompt describing the desired output. | — |
| aspect_ratio | string | optional | Output aspect ratio. | default: 1:1 |
| quality | string | optional | Render quality. | default: mediumlowmediumhighauto |
| n | number | optional | Number of images to generate (1-4). | default: 1 |
| background | string | optional | Background transparency. | default: autotransparentopaqueauto |
| output_format | string | optional | Returned image format. | default: pngpngjpegwebp |
| output_compression | number | optional | Compression 0-100 (jpeg/webp only). | — |
| moderation | string | optional | Content moderation level. | default: autolowauto |
| user | string | optional | Stable end-user identifier for abuse monitoring. | — |
| image_url | string | optional | Input image to edit (switches to the edits endpoint). | — |
curl -X POST https://brahmand-api.bulletshorts.co/v1/image/gpt-image-2 \
-H "X-API-Key: $TRINETRA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt":"A photoreal close-up of dew on a spider web at sunrise","quality":"high","n":1}'{
"prompt": "A photoreal close-up of dew on a spider web at sunrise",
"quality": "high",
"n": 1
}Submitting a job returns 202 Accepted with a job id. Poll GET /v1/jobs/{id} until the job reaches a terminal state, or register a webhook to be notified.
{
"job_id": "job_gptimage2_a1b2c3",
"status": "queued"
}{
"id": "job_gptimage2_a1b2c3",
"model": "gpt-image-2",
"status": "succeeded",
"output": {
"outputs": [
{
"url": "https://cdn.trinetra.ai/out/gpt-image-2/a1b2c3.png",
"type": "image"
}
]
},
"credits_charged": 10
}Webhook: set a webhook_url on your API key to receive a POST with the terminal job document instead of polling.