Codex (Image Generation)
Install the GetRun image skill in Codex App or CLI, generate and edit images, and configure a direct image connection when using CCSwitch.
This guide takes you from installing the image skill to generating a lighthouse illustration and changing its sky to sunset. Set up Codex, Python, and a GetRun Key once, then describe your images directly in Codex.
First, install and connect Codex App or CLI and check that you can send a message. Prepare a GetRun API Key with image model access and available credit. The steps below focus on Codex App; CLI uses the same skill and configuration. Select any screenshot to view it at full size in a new tab.
1. Download and install the skill
Download the GetRun image skill (ZIP)
Choose your operating system. Run these commands in PowerShell or Terminal, not in a Codex conversation. Copy one command at a time, press Enter, and wait for it to finish.
Install Python and open PowerShell
- Visit the Python download page and install Python 3.11 or later. If you use the Python install manager from the website, complete its installation first.
- Press the Windows key, search for
PowerShell, and open Windows PowerShell. You do not need an administrator window. - Paste this command into PowerShell and press Enter:
py -3 --versionContinue when it shows Python 3.11.x or later, such as Python 3.14.x. If py is not found, finish installing Python, then close and reopen PowerShell.
Extract the skill and copy it into place
- Use the ZIP download link above. Find
getrun-imagegen.zipin your browser's downloads and open its containing folder. - Right-click the ZIP and choose Extract All → Extract. Open the extracted directory and locate the
getrun-imagegenfolder. - Run this command in PowerShell to create the skills directory. It also works if the directory already exists:
New-Item -ItemType Directory -Force "$env:USERPROFILE\.agents\skills"- Open File Explorer, click its address bar, enter
%USERPROFILE%\.agents\skills, and press Enter. - Copy the extracted
getrun-imagegenfolder here. Open it: you should seeSKILL.md,scripts, and other files directly, without another nested folder of the same name.
The final path is %USERPROFILE%\.agents\skills\getrun-imagegen\SKILL.md. Copy the whole folder; you do not need to open or edit its files.
Install the skill's dependencies
Return to PowerShell and run these commands in order:
py -3 -m venv "$env:USERPROFILE\.agents\skills\getrun-imagegen\.venv"& "$env:USERPROFILE\.agents\skills\getrun-imagegen\.venv\Scripts\python.exe" -m pip install "openai>=2,<3" pillowThe first command may produce no text; wait for the command prompt to return. The second downloads the dependencies. Continue after Successfully installed, or a message that they are already installed, with no errors.

Extracted folder on macOS, with Chinese labels. Windows contains the same files; copy the whole folder.
Start a new Codex conversation after installation. If the skill list has not updated, fully quit and reopen Codex. On macOS, use Command + Q to quit.
2. Configure the image connection (optional)
If Codex already connects directly to the GetRun API, the skill reuses its address and Key. No additional configuration is needed. This also applies to normal CCSwitch provider switching to GetRun. Continue to step 3: generate an image.
If you use another provider, sign in through ChatGPT, or enable local proxy takeover in CCSwitch, select “Independent Key setup”.
Use the steps below when conversations use another provider, you sign in through ChatGPT, or CCSwitch uses local proxy takeover with an address such as 127.0.0.1 or localhost.
Create getrun-imagegen.json in your Codex user directory:
| System | File location |
|---|---|
| Windows | %USERPROFILE%\.codex\getrun-imagegen.json |
| macOS / Linux | ~/.codex/getrun-imagegen.json |
If you configured CODEX_HOME, place the file in that directory.
{
"base_url": "https://api.get-apikey.com/v1",
"api_key": "your-api-key"
}- Open Notepad, create a document, and copy the JSON above.
- Replace
your-api-keywith your GetRun Key, keeping the straight double quotes around it. - Choose File → Save As, enter
%USERPROFILE%\.codexin the address bar, and press Enter. - Name the file
getrun-imagegen.json, select All files and UTF-8, then save. Check that the filename does not end in.txt.
If .codex does not exist, complete the initial Codex setup first.
A proxy placeholder Key cannot be used for image generation. This file contains credentials; keep it out of your project repository and conversations.
Generation and editing now connect directly to GetRun while conversations keep their existing connection. You do not need to disable the CCSwitch proxy. Switching conversation providers in CCSwitch does not change this image configuration.
Check the configuration
Return to the PowerShell or Terminal window you opened earlier. Paste the command for your system and press Enter; do not run it in the Codex message box:
& "$env:USERPROFILE\.agents\skills\getrun-imagegen\.venv\Scripts\python.exe" "$env:USERPROFILE\.agents\skills\getrun-imagegen\scripts\image_gen.py" check-configA successful check shows the address, configuration source, and default model without revealing the Key. This checks local configuration only: it does not access the network or incur charges. Live model availability is confirmed when you generate an image.
The source field tells you which configuration was read: codex-provider means the current Codex configuration, getrun-imagegen.json means the independent file, and environment means dedicated environment variables. The address should be a GetRun gateway and the default model should be gpt-image-2. Resolve any error using the troubleshooting section before generating.
If you are unsure which case applies, open Settings → Configuration → Open config.toml in Codex App and check the active Provider's base_url. https://api.get-apikey.com/v1 connects directly to GetRun; 127.0.0.1 or localhost indicates a local proxy. You only need to read the address here.

Configuration and Open config.toml in Codex settings (macOS, Chinese interface).
You can also set GETRUN_IMAGE_API_KEY and optionally GETRUN_IMAGE_BASE_URL. Configuration is read in this order:
- Dedicated environment variables.
- The independent JSON file.
- The Codex Provider.
An independent configuration without an address uses the default GetRun gateway. An address without a Key is an error; credentials are not filled from another source. Use the JSON file if the desktop App cannot read terminal environment variables.
For Codex configuration, the skill supports env_key and experimental_bearer_token in the user config.toml, as well as auth.json for API Key authentication. The process running the script must be able to read the variable named by env_key.
Only the user configuration and its selected default profile are read. CLI overrides and project configuration overrides are not inferred.
Some CCSwitch versions forward Images requests, but may not support the multipart uploads this skill uses for editing. The independent configuration connects both generation and editing directly to GetRun without depending on the proxy version.
3. Generate an image in Codex
Choose a folder for your images
- Create a folder on your computer, such as “Image practice” on your desktop. This is where you will find the generated files.
- Open Codex App, select this folder as your project, and start a conversation. For CLI, enter this folder first, then run
codex. - Type
$getrun-imagegenin the message box. Select getrun-imagegen from the skill list. If it does not appear, check the installation directory in step 1 and restart Codex.
Send your image request
Copy this prompt into the Codex message box and send it:
Use $getrun-imagegen to create a landscape illustration of a seaside lighthouse at dawn, 1536x1024.
Use the Python interpreter in this skill's .venv. Save it to output/imagegen/lighthouse.png and show the result.Allow the necessary execution and network access when Codex requests it. The skill calls the Images API, and generation and editing use the image Key's credit.
Find and save the image
- Wait for Codex to finish and provide an image preview or saved path. A command appearing in the conversation does not mean generation has finished.
- Open your “Image practice” folder, then
output→imagegen. Findlighthouse.png. - Double-click to preview it. To put it on your desktop or share it, copy the PNG file. It is already saved locally; there is no need to take a screenshot of the conversation.
If you cannot find it, ask: “Where did you save the image? Give me its full path.” If the request timed out or its result is unclear, check the outcome before sending another generation request.
| Setting | Value |
|---|---|
| Base URL | https://api.get-apikey.com/v1 |
| Default image model | gpt-image-2 |
| Default size | 1024x1024 |
| Quality | Omitted by default; the service chooses |
Use 1536x1024 for landscapes, 1024x1536 for portraits, or 1024x1024 for squares. Leave quality unset by default and do not use size=auto. These are request parameters; the returned file determines the actual dimensions.
4. Use reference images or continue editing
Edit the image you just generated
Stay in the same conversation and send the following prompt. It saves a separate sunset version so you can compare it with the original:
Use $getrun-imagegen to edit output/imagegen/lighthouse.png.
Change only the sky to sunset. Keep the lighthouse position, shape, and illustration style. Keep the size at 1536x1024.
Save it as output/imagegen/lighthouse-sunset.png without overwriting the original, and show the result.After it finishes, the same output/imagegen folder should contain both lighthouse.png and lighthouse-sunset.png.
Use your own reference image
- Copy the reference into “Image practice”, for example as
reference.png. Keep the original file extension; do not rename a JPG extension to PNG. - Ask Codex: “Use $getrun-imagegen to edit reference.png in this project. Make the background light gray, preserve the subject, and save to output/imagegen/reference-edited.png.”
- If the image is elsewhere, provide its full local path. Put paths containing spaces in straight double quotes.
The skill must be able to read this file before uploading it to the editing endpoint. Describing an image or naming a file that does not exist will not upload it. Support for multiple references and their limits depends on the selected model.
Troubleshooting
If the skill is missing, check the getrun-imagegen/SKILL.md folder layout, then start a new conversation or restart Codex.
For missing tomllib, openai, or PIL, use Python 3.11+ and the .venv interpreter where you installed the dependencies.
For a local proxy address, use the independent image configuration and keep your conversation settings unchanged.
If Provider credentials conflict with auth.json, check whether both use the same Key. You can also use independent configuration without changing other login information.
401 / 403: check the configuration source in use, Key permissions, and available credit.
404 or model unavailable: check the full model ID and access for your Key. The skill does not switch models automatically.
Do not immediately generate again. Keep any request ID from the error and contact support before risking another charge. Individual requests and each batch job submit once by default.
Choose another filename. Use --force only when you intend to overwrite the file.
Related guides: Generate images with Harness App · Image generation and editing API · CCSwitch