Skip to main content

The Error

In one sentence: this error is returned by OpenAI’s own servers, not by APIYI. Your code is currently calling api.openai.com, so OpenAI rejects the APIYI key. The key is fine. The request address is wrong.

How to Tell the Request Never Reached APIYI

Either of these two signs settles it:
This is especially common when you ask an AI coding assistant to write the integration. Codex, Cursor, Claude Code and friends see the model name gpt-image-2.5, default to the official OpenAI SDK pattern, and leave base_url at the SDK default https://api.openai.com/v1. The key you paste in is APIYI’s. The two do not match.

Three Fixes, Pick by Situation

The lowest-effort path is to let the Agent “learn” APIYI before it writes code. Two levels of skill packs are available:
1

Site-wide skill pack (install this first)

Have your Agent run the command below to install the APIYI skill pack. If that fails, tell it to read https://docs.apiyi.com/skill.md directly:
This file is written for AI: base URLs, authentication, model naming rules and common pitfalls. Once installed, the code it writes will point base_url at https://api.apiyi.com/v1 automatically.
2

Dedicated GPT-Image skill

The GPT-Image-2.5 / 2 Series Agent Skill page ships a ready-to-use Skill: two files and one script covering six models including gpt-image-2.5-flare / gpt-image-2.5-sunburst / gpt-image-2, switched with --model. Text-to-image, multi-image fusion and inpainting are all included.Drop it into Codex, OpenClaw, Claude Code or any coding Agent that can run shell commands, then just say “generate an image of…” You never touch the base URL yourself.
Other image and video models each have an “Agent Skill” page too, filed under that model’s documentation folder. Find the model in the left navigation and look for a sub-page named “Agent Skill”.

Fix It Yourself: One Line

If you already have code generated by Codex, the minimal change is adding base_url to the client. Leave everything else untouched:
Then confirm the request actually reaches APIYI. A model list in the response means you are done:

Follow-up Questions

Check in this order:
  1. Multiple config locations: Codex-generated projects often set the URL in .env, a config file and the client constructor. Changing one leaves the others at the default
  2. Environment variable precedence: if OPENAI_BASE_URL is already set to something else on your system, it overrides whatever the code omits. Run echo $OPENAI_BASE_URL to check
  3. No restart: the running process still holds the old config
  4. Spelling: apiyi, not apiyii or apiyl
The simplest proof is the error text itself. As long as platform.openai.com still appears, the request is still going to OpenAI.
Send it the exact error together with this page. Every docs page has a “Copy page” button in the top-right corner. Paste the page content plus the error into the AI and it can pinpoint which config did not take effect. This is the fastest troubleshooting path.
Only then is it time to check the key itself: open the “Tokens” page in the console and confirm the key is enabled, the balance is sufficient and no model whitelist blocks it. Full checklist in Why is my API Key invalid?.
Default to gpt-image-2.5-flare for text-to-image and gpt-image-2.5-sunburst for editing and inpainting. Both share the same price and parameters. For high-volume, low-cost work use the reverse channel gpt-image-2.5-all. The comparison table on the GPT-Image Series Agent Skill page covers all six.

Why is my API Key invalid?

Why base URL and key must match, with examples in every language.

How to configure Base URL?

/v1 for OpenAI, root domain for Claude, /v1beta for Gemini.

Is there one-click integration?

Hand the docs to your AI coding assistant and let it do the integration.

GPT-Image-2.5 / 2 Overview

Parameters, pricing, integration prompt and common errors.