Codex built-in image_gen now works with OmniaKey
Codex Desktop can now use its built-in image_gen tool to create images through OmniaKey's gpt-image-2. No ChatGPT login and no extra plugin are required. The missing field 'b64_json' error some of you hit has been fixed on the gateway side.
Setup
Make sure ~/.codex/config.toml has this at the top level:
model_provider = "custom"
Then add or replace the provider block:
[model_providers.custom]
name = "OmniaKey"
base_url = "https://api.omniakey.com/v1"
wire_api = "responses"
requires_openai_auth = false
env_key = "OMNIAKEY_API_KEY"
http_headers = { "x-openai-actor-authorization" = "omniakey" }
Then:
- Set the
OMNIAKEY_API_KEYenvironment variable (create a key in the OmniaKey console). - Quit Codex Desktop completely and reopen it. Closing the window is not enough — the background app-server has to restart too.
- Open a new thread and ask for an image ("draw a cat"), or use the
$imagegenskill.
Prefer not to edit TOML by hand? Paste this announcement into Codex (or any coding agent) and ask it to configure your Codex setup for you. It can merge the provider block into
~/.codex/config.tomlwithout duplicating tables, confirmOMNIAKEY_API_KEYis set, and remind you to restart the app.
image_generationis enabled by default. Ifcodex features listreports it as false, addimage_generation = trueto your existing[features]table — do not create a second[features]table.
Good to know
- The built-in tool is pinned to
gpt-image-2; you cannot switch models inside Codex. To usegpt-image-2.5-flareorgpt-image-2.5-sunburst, callPOST /v1/images/generationsdirectly. - Codex saves the image locally, and the same image is stored in your OmniaKey asset library: the response carries
urlandasset_id, the asset is retained for 30 days, and the URL can be renewed withGET /v1/assets/:asset_id/urlduring that window. - The tool ships with Codex Desktop / app-server only.
codex execand other CLI paths do not exposeimage_gen. - Usage is billed at the normal
gpt-image-2rate.
API change for developers
/v1/images/generations now derives the response shape from the request's response_format alone:
- omitted: returns both
b64_jsonandurl, so clients that only decode base64 (OpenAI SDK, imagegen CLI) work out of the box; "response_format": "url": signed URL,asset_idandexpires_atonly — the smallest response;"response_format": "b64_json": always base64; a URL-only upstream answer is downloaded and inlined, and no asset row is created.
Verified on Codex 0.165.