GPT Image setup
Choose a model
Section titled “Choose a model”The catalog includes gpt-image-2, gpt-image-2.5-flare and gpt-image-2.5-sunburst. These are IDs used by this platform’s routes. They do not establish identical capabilities, parameters or prices across every similarly named service. Check the catalog and your key’s available model list.
Python example
Section titled “Python example”Install requests and configure WUDI_API_KEY. This example requests a single image:
import os, base64from pathlib import Pathimport requests
r = requests.post( "https://wudiapi.com/v1/images/generations", headers={"Authorization": "Bearer " + os.environ["WUDI_API_KEY"]}, json={"model":"gpt-image-2", "prompt":"A blue ceramic cup, white background, soft light", "n":1}, timeout=180,)r.raise_for_status()item = r.json()["data"][0]if item.get("b64_json"): Path("cup.png").write_bytes(base64.b64decode(item["b64_json"]))else: print(item.get("url", "Check the response structure"))Write a specific prompt
Section titled “Write a specific prompt”Describe the subject, background, composition, proportions and any exact text. For a product image, specify object count, material and lighting. For an edit, say which elements should remain and which should change. Confirm the basic result before attempting complex layouts.
Parameters and charges
Section titled “Parameters and charges”Image models can use per-image, quality-tier or image-token billing. Do not estimate the cost with ordinary chat input/output prices. Available dimensions and quality settings depend on the model details and actual response; this guide does not promise a particular resolution.
Common problems
Section titled “Common problems”For apparently empty results, inspect the complete JSON for Base64 content. For rejected parameters, return to the minimal request. After a timeout, check the usage log before retrying. See image editing when supplying an existing image; a local file path in JSON is not a file upload.
