OpenAI Images API Configuration
Image generation is not the regular chat interface. Even if an AI provider supports the text model, it does not necessarily mean it supports the OpenAI image interface. Check with the provider whether it explicitly mentions 'Images API', 'image generation', or the corresponding model before configuring.
Official information Downloads and documentation are subject to the official site.
First confirm whether the provider supports the image interface
| What to check | How to view | Why |
|---|---|---|
| Interface type | Whether the backend or documentation explicitly mentions Images API, image generation, image editing | Only writing OpenAI-compatible chat interface does not mean the image interface is also available |
| Model permissions | Whether the model list includes image models, and whether the account or Key has permission | Image models are often billed separately and activated separately from text models |
| Request path | Whether the provider has given examples for the image interface | Some providers only proxy the chat interface; directly requesting the image path will result in 404 |
| Price | Images are billed per piece, size, or quality | Test with a small amount before batch generation to avoid high consumption at once |
Differences from chat interface
| Type | Common interfaces | Preparation needed |
|---|---|---|
| Text chat | /v1/chat/completions Or Responses | Key, Base URL, model name, message content |
| Image generation | /v1/images/generations | Key, image model, prompt, size, output format |
| Image editing | Image editing interface | In addition to the prompt, you also need to upload the original image or mask |
How to fill in the fields
| Configuration item | Filling Method |
|---|---|
| Endpoint | https://api.openai.com/v1/images/generations |
| Model | Official example available: <code>gpt-image-2</code>; for provider services, fill in according to the provider list |
| Prompt | What image do you want to generate |
| Size | Image Size |
| Format | URL or base64 |
If using a provider, replace the official domain part with the image API address provided by the provider; if the provider did not specify support for image interface, do not assume it is available. Whether the Base URL includes /v1 Still follow the backend example, do not guess by yourself.
Request example
OpenAI image generation example
curl https://api.openai.com/v1/images/generations \ -H "Authorization: Bearer YOUR_OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-image-2", "prompt": "A clean product photo of a white ceramic mug on a solid-color background", "size": "1024x1024" }' The cost of image interface is usually different from the text interface. Check the price before batch generation.
| Error | Common Causes | Solutions |
|---|---|---|
| 404 / endpoint not found | The provider does not have an image proxy interface, or the path has too many/few slashes /v1 | Go to the backend to find a dedicated image interface example; do not directly use the chat interface |
| model not found | The image model name is not in the current provider list | Copy the original model ID/model name of the image model, not the text model |
| unsupported content type | The image editing interface requires uploading files; you cannot just send JSON | First confirm whether you are calling the generation interface or the editing interface |
