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_KEY environment 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
$imagegen skill.
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.toml without duplicating tables, confirm OMNIAKEY_API_KEY is set, and remind you to restart the app.
image_generation is enabled by default. If codex features list reports it as false, add image_generation = true to 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 use gpt-image-2.5-flare or gpt-image-2.5-sunburst, call POST /v1/images/generations directly.
- Codex saves the image locally, and the same image is stored in your OmniaKey asset library: the response carries
url and asset_id, the asset is retained for 30 days, and the URL can be renewed with GET /v1/assets/:asset_id/url during that window.
- The tool ships with Codex Desktop / app-server only.
codex exec and other CLI paths do not expose image_gen.
- Usage is billed at the normal
gpt-image-2 rate.
API change for developers
/v1/images/generations now derives the response shape from the request's response_format alone:
- omitted: returns both
b64_json and url, so clients that only decode base64 (OpenAI SDK, imagegen CLI) work out of the box;
"response_format": "url": signed URL, asset_id and expires_at only — 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.