Openai Gpt Image 2 Text To Image
Playground
Try it on WaveSpeedAI!OpenAI’s GPT Image 2 Text-to-Image generates high-quality images from natural-language prompts. Ready-to-use REST inference API, best performance, no coldstarts, affordable pricing.
Features
OpenAI GPT Image 2 Text-to-Image transforms natural-language prompts into high-quality images. Describe the scene, style, lighting, composition, or typography you want, and the model generates polished visuals with strong prompt fidelity, detailed rendering, and flexible creative control.
- Need to edit an existing image instead? Try OpenAI GPT Image 2 Edit.
Why Choose This?
-
Strong prompt fidelity Generate images that closely follow detailed natural-language instructions, including scene layout, visual style, and composition.
-
High-quality image generation Produce polished visuals suitable for marketing creatives, concept design, product mockups, and branded content.
-
Accurate text rendering Create images that include clearer, more usable in-image text for posters, ads, packaging, and interface mockups.
-
Flexible aspect ratios Support square, portrait, and landscape outputs for common social, editorial, and product use cases.
-
Production-ready API Access the model through a ready-to-use REST inference API for fast integration into applications and workflows.
Parameters
| Parameter | Required | Description |
|---|---|---|
| prompt | Yes | Text description of the desired image. |
| aspect_ratio | No | Aspect ratio: 1:1, 3:2, 2:3, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9. |
| resolution | No | Output resolution: 1k (default), 2k, or 4k. |
| quality | No | Image quality: low, medium (default), or high. |
How to Use
- Write your prompt — describe the image in detail, including subject, style, lighting, composition, and any text you want to appear.
- Choose aspect ratio (optional) — use
1:1for square,2:3or9:16for portrait,3:2or16:9for landscape, etc. - Submit — run the model and download your generated image.
Example Prompt
A cinematic product photo of a luxury perfume bottle on a marble surface, soft golden-hour lighting, shallow depth of field, elegant reflections, premium editorial photography style
Pricing
Pricing varies by quality and resolution.
| Quality | 1k | 2k | 4k |
|---|---|---|---|
| low | $0.01 | $0.02 | $0.03 |
| medium | $0.06 | $0.10 | $0.18 |
| high | $0.22 | $0.40 | $0.72 |
Best Use Cases
- Marketing creatives — Generate hero images, ad visuals, banners, and campaign assets from text prompts.
- E-commerce content — Create product shots, lifestyle scenes, and promotional visuals without a full studio workflow.
- Landing pages & web design — Produce branded illustrations, hero sections, and visual mockups for websites.
- Social media content — Quickly generate eye-catching visuals tailored to different content formats.
- Concept art & ideation — Explore visual directions for products, scenes, characters, and campaigns.
- Typography-driven visuals — Create posters, ads, and packaging concepts that require readable in-image text.
Pro Tips
- Be specific in your prompt — include subject, environment, camera angle, lighting, mood, and style.
- Use natural sentence structure rather than keyword stuffing for better prompt understanding.
- For text inside the image, put the exact wording in quotes.
- Mention visual style clearly, such as photorealistic, cinematic, vector illustration, oil painting, or isometric 3D.
- Test multiple aspect ratios when creating assets for different placements like social posts, banners, or landing pages.
- Iterate on prompt details like composition and lighting to get more consistent results.
Notes
promptis the only required field.- Supported aspect ratios are
1:1,3:2,2:3,3:4,4:3,4:5,5:4,9:16,16:9, and21:9. - This model is intended for text-to-image generation from natural-language instructions.
Related Models
- OpenAI GPT Image 2 Edit — Edit one or more reference images using natural-language instructions.
Authentication
For authentication details, please refer to the Authentication Guide.
API Endpoints
Submit Task & Query Result
set -euo pipefail
export WAVESPEED_API_KEY="your-api-key"
REQUEST_BODY=$(cat <<'JSON'
{
"prompt": "A cinematic ocean wave at sunrise, highly detailed",
"aspect_ratio": "1:1",
"resolution": "1k",
"quality": "medium",
"output_format": "png"
}
JSON
)
# 1. Submit the prediction.
SUBMIT_RESPONSE=$(curl --silent --show-error --fail-with-body \
-X POST "https://api.wavespeed.ai/api/v3/openai/gpt-image-2/text-to-image" \
-H "Authorization: Bearer ${WAVESPEED_API_KEY}" \
-H "Content-Type: application/json" \
-d "${REQUEST_BODY}")
TASK=$(printf '%s' "${SUBMIT_RESPONSE}" | jq 'if type == "object" and has("data") then .data else . end')
PREDICTION_ID=$(printf '%s' "${TASK}" | jq -r '.id // empty')
if [ -z "${PREDICTION_ID}" ]; then
printf 'Submission response did not contain a prediction id
' >&2
exit 1
fi
RESULT_URL=$(printf '%s' "${TASK}" | jq -r '.urls.get // empty')
if [ -z "${RESULT_URL}" ]; then RESULT_URL="https://api.wavespeed.ai/api/v3/predictions/${PREDICTION_ID}/result"; fi
# 2. Poll until the prediction finishes.
while true; do
RESPONSE=$(curl --silent --show-error --fail-with-body \
"${RESULT_URL}" \
-H "Authorization: Bearer ${WAVESPEED_API_KEY}")
RESULT=$(printf '%s' "${RESPONSE}" | jq 'if type == "object" and has("data") then .data else . end')
STATUS=$(printf '%s' "${RESULT}" | jq -r '.status // empty')
case "${STATUS}" in
completed) printf '%s\n' "${RESULT}" | jq '.outputs'; break ;;
failed|cancelled|timeout) printf '%s\n' "${RESULT}" | jq . >&2; exit 1 ;;
created|processing) sleep 2 ;;
*) printf 'Unexpected status: %s
' "${STATUS}" >&2; exit 1 ;;
esac
doneParameters
Task Submission Parameters
Request Parameters
| Parameter | Type | Required | Default | Range | Description |
|---|---|---|---|---|---|
| prompt | string | Yes | - | The positive prompt for the generation. | |
| aspect_ratio | string | No | - | 1:1, 1:2, 2:1, 1:3, 3:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 9:21, 21:9 | The aspect ratio of the generated image. |
| resolution | string | No | 1k | 1k, 2k, 4k | The resolution of the output image. |
| quality | string | No | medium | low, medium, high | The quality of the generated image. Higher quality costs more. |
| output_format | string | No | png | png, jpeg, webp | The format of the output image. |
| enable_sync_mode | boolean | No | false | - | If set to `true`, the request attempts to wait for the generated result and return outputs in the same response. If the result is not ready within the sync wait window, the API can return a timeout body while the task continues processing. This option is only available via the API and is supported only by some models. |
| enable_base64_output | boolean | No | false | - | If set to `true`, the prediction's `output` strings are returned as **naked base64** (no `data:<mime>;base64,` prefix). When `false` (default), outputs are returned as URLs pointing to our CDN. |
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| code | integer | HTTP status code (e.g., 200 for success) |
| message | string | Status message (e.g., “success”) |
| data.id | string | Unique identifier for the prediction, Task Id |
| data.model | string | Model ID used for the prediction |
| data.outputs | array | Output values, usually URL strings; some models return text strings or structured result objects (empty when status is not completed) |
| data.urls | object | Object containing related API endpoints |
| data.urls.get | string | URL to retrieve the prediction result |
| data.status | string | Status of the task: created, processing, completed, or failed |
| data.created_at | string | ISO timestamp of when the request was created (e.g., “2023-04-01T12:34:56.789Z”) |
| data.error | string | Error message (empty if no error occurred) |
| data.timings | object | Object containing timing details |
| data.timings.inference | integer | Inference time in milliseconds |
Result Request Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| id | string | Yes | - | Task ID |
Result Response Parameters
| Parameter | Type | Description |
|---|---|---|
| code | integer | HTTP status code (e.g., 200 for success) |
| message | string | Status message (e.g., “success”) |
| data | object | The prediction data object containing all details |
| data.id | string | Unique identifier for the prediction |
| data.model | string | Model ID used for the prediction |
| data.outputs | array<string | object> | Array of generated outputs (empty when status is not completed). Items are usually URL strings, but may be text strings or structured result objects, depending on the model. |
| data.urls | object | Object containing related API endpoints |
| data.urls.get | string | URL to poll for the prediction result |
| data.status | string | Status: created, processing, completed, or failed |
| data.created_at | string | ISO timestamp of when the request was created |
| data.error | string | Error message (empty if no error occurred) |
| data.timings | object | Object containing timing details |
| data.timings.inference | integer | Inference time in milliseconds |