gpt-image (Azure) CODE-COMPLETE
Two proprietary image models - gpt-image-1.5 (transparent) and gpt-image-2 (top-quality opaque) - fulfilled inline via Azure OpenAI. The code is complete and lint-clean; it needs Azure credentials + deployment names to go live.
Azure only. Image generation goes through Azure OpenAI, never OpenAI direct. This is a hard platform rule. Azure uses the
api-key header, not a Bearer token.
Call shape
| Item | Value |
|---|---|
| URL | <endpoint>/openai/v1/images/generations?api-version=preview |
| Auth header | api-key: <key> (Azure style, NOT Bearer) |
| Content type | Content-Type: application/json |
| Body | { model, prompt, n, size, quality [, background=transparent] } |
| Response | data[0].b64_json -> base64-decode -> PNG |
POST https://<resource>.openai.azure.com/openai/v1/images/generations?api-version=preview
api-key: <AZURE_KEY>
Content-Type: application/json
{
"model": "gpt-image-1.5",
"prompt": "a neon fox mascot",
"n": 1,
"size": "1024x1024",
"quality": "medium",
"background": "transparent"
}
Model settings
| Model | Background | Default quality | Notes |
|---|---|---|---|
gpt-image-1.5 | transparent | medium | The transparent-RGBA proprietary option. background=transparent is sent. |
gpt-image-2 | opaque | high | Top quality, opaque. No background field sent. |
These jobs are claimed on a dedicated inline path (like text), never POSTed to the async RunPod /run endpoint. On success the PNG is saved to /uploads/gen/gen_<id>.png and that URL becomes the job result.
Configuration (to go live)
Set these in lib/faucet_config.php (gitignored):
| Key | Required | Description |
|---|---|---|
gen_azure_endpoint | yes | Azure OpenAI resource endpoint. |
gen_azure_api_key | yes | Azure API key. |
gen_azure_deployments | recommended | Map of model id -> Azure deployment name (defaults to the model name). |
gen_azure_api_version | no | Defaults to preview. |
gen_azure_size | no | Defaults to 1024x1024. |
gen_azure_timeout | no | Defaults to 120 s. |
With the endpoint or key unset, these jobs simply stay queued and nothing errors. Error handling maps Azure failures to the standard codes (429 insufficient_quota -> out_of_credits, 401/403 -> auth); see Error codes.
Official documentation
- Azure OpenAI images: learn.microsoft.com/azure/ai-services/openai/reference
- Azure OpenAI overview: learn.microsoft.com/azure/ai-services/openai
- OpenAI Images API (model reference): platform.openai.com/docs/api-reference/images