Image Generation
TIE provides an OpenAI-compatible image generation endpoint that routes to multiple providers. Any client that works with OpenAI's /v1/images/generations works with TIE by changing the base URL.
All requests require a Bearer token from TIE Auth.
Endpoint
Section titled “Endpoint”POST /v1/images/generationsSupported Models
Section titled “Supported Models”| Model | Provider | Format |
|---|---|---|
openai/gpt-image-1.5 | OpenAI | url or b64_json |
openai/dall-e-3 | OpenAI | url or b64_json |
google/imagen-4.0 | Google Imagen (Vertex AI) | b64_json only |
Use the provider/model format (e.g. openai/gpt-image-1.5). You can also omit the provider prefix for OpenAI models (e.g. dall-e-3).
Parameters
Section titled “Parameters”Send as JSON:
| Parameter | Type | Default | Description |
|---|---|---|---|
model | string | required | Image model to use (e.g. openai/gpt-image-1.5, google/imagen-4.0) |
prompt | string | required | Text description of the desired image |
n | integer | 1 | Number of images to generate. OpenAI: 1–10. Google: 1–4. |
size | string | null | Image size: 1024x1024, 1792x1024, 1024x1792. For Google models, this maps to aspect ratios (1:1, 16:9, 9:16). |
quality | string | null | Image quality (OpenAI only): auto, low, medium, high, hd |
response_format | string | b64_json | url or b64_json. Google models always return b64_json regardless of this setting. |
style | string | null | Image style (dall-e-3 only): natural, vivid |
Examples
Section titled “Examples”OpenAI (gpt-image-1.5)
Section titled “OpenAI (gpt-image-1.5)”curl -X POST https://your-tie-host/v1/images/generations \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $TOKEN" \ -d '{ "model": "openai/gpt-image-1.5", "prompt": "A serene mountain landscape at sunset with a reflective lake", "n": 1, "size": "1024x1024", "quality": "auto" }'Google Imagen
Section titled “Google Imagen”curl -X POST https://your-tie-host/v1/images/generations \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $TOKEN" \ -d '{ "model": "google/imagen-4.0", "prompt": "A serene mountain landscape at sunset with a reflective lake", "n": 1, "size": "1024x1024" }'DALL-E 3
Section titled “DALL-E 3”curl -X POST https://your-tie-host/v1/images/generations \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $TOKEN" \ -d '{ "model": "openai/dall-e-3", "prompt": "A serene mountain landscape at sunset with a reflective lake", "style": "natural" }'Response
Section titled “Response”The response follows OpenAI's image generation format:
{ "created": 1711900000, "data": [ { "b64_json": "iVBORw0KGgo...", "url": null, "revised_prompt": "A tranquil mountain landscape during golden hour..." } ]}| Field | Type | Description |
|---|---|---|
created | integer | Unix timestamp of when the response was generated |
data | array | List of generated images |
data[].b64_json | string or null | Base64-encoded image data (when response_format is b64_json) |
data[].url | string or null | Temporary URL to the generated image (when response_format is url, OpenAI models only) |
data[].revised_prompt | string or null | The prompt that was actually used (OpenAI models may revise your prompt for safety/quality) |
Provider Differences
Section titled “Provider Differences”| Feature | OpenAI | Google Imagen |
|---|---|---|
| Max images per request | 10 | 4 |
response_format: "url" | Temporary URL returned | Not supported — always returns b64_json |
style parameter | Supported (dall-e-3 only) | Ignored |
quality parameter | Supported | Ignored |
revised_prompt | Returned when prompt is modified | Not returned |
| Size handling | Passed as-is (e.g. 1024x1024) | Mapped to aspect ratio (e.g. 1:1) |
SDK Integration
Section titled “SDK Integration”Since the endpoint is OpenAI-compatible, you can use the standard OpenAI SDK:
Python
Section titled “Python”from openai import OpenAI
client = OpenAI( base_url="https://your-tie-host/v1", api_key="your-bearer-token",)
response = client.images.generate( model="openai/gpt-image-1.5", prompt="A serene mountain landscape at sunset", n=1, size="1024x1024",)
print(response.data[0].b64_json[:50]) # base64 image dataTypeScript / Node.js
Section titled “TypeScript / Node.js”import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://your-tie-host/v1", apiKey: "your-bearer-token",});
const response = await client.images.generate({ model: "openai/gpt-image-1.5", prompt: "A serene mountain landscape at sunset", n: 1, size: "1024x1024",});
console.log(response.data[0].b64_json?.slice(0, 50));Error Handling
Section titled “Error Handling”| Status | Code | When |
|---|---|---|
| 400 | VALIDATION_ERROR | Unsupported model, n exceeds provider limit, invalid parameters |
| 401 | AUTH_TOKEN_MISSING | No Bearer token provided |
| 502 | SERVICE_UPSTREAM_ERROR | The upstream provider (OpenAI or Google) returned an error |
| 503 | SERVICE_UNAVAILABLE | Required provider credentials not configured (e.g. OPENAI_API_KEY or GCP_PROJECT_ID) |