Migrating from OpenAI¶
Most code that calls the OpenAI Images API works after two changes. Then review the behaviour notes below.
1. Change the base URL and key¶
2. Use the model name gpt-image-2¶
Differences to check¶
| Topic | YexAPI behaviour |
|---|---|
| Endpoints | Images only: /v1/images/generations, /v1/images/edits, plus the async endpoints. |
n |
Only 1. Higher values return 400. See n. |
size |
Any WIDTHxHEIGHT, an aspect ratio such as 16:9, or auto, plus optional resolution. See Size. |
| Output pixels | Chosen by the model; may differ from the request. See Size. |
quality, style, moderation, output_format, output_compression |
Accepted but ignored. Output is PNG. |
response_format |
url (default) and b64_json are both supported; b64_json responses also include the URL. |
| Edits | JSON with image URLs only; no multipart upload, no mask. See Image edits. |
| Streaming | Not supported. |
| Image URLs | Hosted on api.yexapi.com, valid for 30 days. |
| Billing | Flat price per image by resolution tier; failed generations are refunded. See Billing. |
Checklist¶
- [ ] Base URL is
https://api.yexapi.com/v1 - [ ] Using a YexAPI key (
sk-...) - [ ]
modelisgpt-image-2 - [ ]
nis 1 or not sent - [ ] Edits use public image URLs instead of file uploads
- [ ] HTTP timeout is at least 120 s, or you use the async endpoint