Connecting Codex to AICodeWith: Dedicated Endpoint, Auth Setup, and Call Verification

Configure Codex with the dedicated AICodeWith Responses endpoint from the current docs, including config backup, auth.json, model selection, call verification, and recovery steps.

7 min read
Connecting Codex to AICodeWith: Dedicated Endpoint, Auth Setup, and Call Verification

To connect Codex to AICodeWith, the current docs use https://api.aicodewith.ai/chatgpt/v1 with the Responses protocol. You can't swap this address for a generic /v1. Beyond the address, you also need to set up authentication, the provider, and the model together, then verify requests against the platform's call logs. This article was checked on October 12, 2026.

If you can't reach the service from mainland China or don't have an overseas credit card, start with "Using Codex in China: How to Solve Network and Payment Problems". If you only want to know how to configure the different kinds of Codex keys, read "How to Configure a Codex API Key".

What to Prepare Before You Start

You need a working Codex CLI, a test project, and an AICodeWith API Key. The model should be currently supported by the platform, within the scope of your Key, and available on the corresponding channel. This article uses gpt-5.6-sol, the current example in the platform docs, purely to illustrate the configuration. If the platform changes, follow the latest docs and model page, and don't treat the example model as valid forever.

View the current Codex terminal integration docs

If you only use the official ChatGPT login and it meets your needs, no extra configuration is required. Switching to a third-party provider changes where model requests go, but it does not replace Codex's file permissions, approvals, or workspace settings.

Step 1: Find and Back Up Your Existing Config

The default directory is ~/.codex on macOS/Linux and the .codex folder in your user directory on Windows. If you've set a custom CODEX_HOME, use that actual directory. Back up config.toml and any existing auth.json, using timestamped copy names so you don't overwrite older backups. Credential backups also need to be kept secret, so don't put them in a synced public folder or in Git.

On macOS/Linux, confirm the directory in a terminal:

bash
mkdir -p "$HOME/.codex"

The Windows PowerShell equivalent:

powershell
New-Item -ItemType Directory -Path (Join-Path $env:USERPROFILE ".codex") -Force | Out-Null

Then use a file manager or editor to copy the existing files as separate backups. Don't run a one-click script that overwrites the whole directory, because your current config may also contain MCP servers, project rules, and other providers.

If files already exist in the default directory, you can use the commands below to create timestamped copies. They copy only files that exist, and credential backups should be treated like passwords. On macOS/Linux:

bash
aicw_stamp=$(date +%Y%m%d-%H%M%S)
for aicw_file in config.toml auth.json; do
  if [ -f "$HOME/.codex/$aicw_file" ]; then
    cp "$HOME/.codex/$aicw_file" "$HOME/.codex/$aicw_file.before-aicw-$aicw_stamp"
  fi
done

On Windows PowerShell:

powershell
$aicwStamp = Get-Date -Format 'yyyyMMdd-HHmmss'
$aicwDir = Join-Path $env:USERPROFILE '.codex'
foreach ($aicwFile in @('config.toml', 'auth.json')) {
  $aicwPath = Join-Path $aicwDir $aicwFile
  if (Test-Path $aicwPath) { Copy-Item $aicwPath "$aicwPath.before-aicw-$aicwStamp" }
}

If you've set CODEX_HOME, change the directories above to your actual Codex home. System credential storage isn't kept in auth.json, so file copies can't back up the login state stored there.

Step 2: Configure the Dedicated Provider

Open the user-level config.toml in a text editor. Put model and model_provider at the top level of the file, before any [table]. If keys with the same names already exist, change the existing values instead of adding duplicates. Then add or update the matching provider table. Each line below forms part of one TOML block, in order:

toml
model_provider = "codex"
model = "gpt-5.6-sol"
[model_providers.codex]
name = "codex"
base_url = "https://api.aicodewith.ai/chatgpt/v1"
wire_api = "responses"
requires_openai_auth = true
supports_websockets = false

The value of model_provider must match codex in the table name. requires_openai_auth = true is the authentication method used in this platform's docs. According to the official documentation, env_key is ignored when it's enabled. Don't add env_key to the same config and expect a dedicated variable to override the credentials.

supports_websockets = false comes from the current platform example. Don't treat this channel-specific setting as a default requirement for every provider. The project-level .codex/config.toml can't override these machine-level provider fields, so edit the user config instead.

Step 3: Set Credentials for This Integration Route

The platform docs store the platform Key in the OPENAI_API_KEY field of .codex/auth.json. That field name is just Codex's local credential structure and doesn't mean the Key comes from the OpenAI Platform. Finish the backups above first, then edit the file locally. This applies only to the third-party route in this article, so don't use the platform Key to log in on the OpenAI website.

json
{"OPENAI_API_KEY":"REPLACE_WITH_YOUR_AICODEWITH_KEY"}

After replacing the placeholder, save the file as valid JSON, and choose UTF-8 in your Windows editor. Don't keep old login tokens from an unrelated route and guess at their precedence. If your machine uses system credential storage, an organization-enforced login policy, or an existing login cache, the file may not be the credential source actually in use. Confirm with the official authentication docs before switching, and don't work around the policy by repeatedly rewriting the file.

Don't put the Key in config.toml, AGENTS.md, or Git. During verification, don't run cat auth.json or Get-Content auth.json, so the full key doesn't end up in your logs.

Step 4: Send a Read-Only Task and Check the Call Logs

bash
codex --version
codex

In your test project, enter: "Only read the README, explain the startup steps, and don't modify any files or install dependencies." Check the current model, the reply, and git status --short, then go to AICodeWith and match the call log by time, Key, and model. Only when a normal reply lines up with a platform record can you say the request reached the intended service. A config file merely existing doesn't prove success.

After configuring the desktop app, restart the client and verify its actual requests separately. The platform's desktop docs are also based on local configuration, but the entry points vary by version, so follow the current UI.

AICodeWith desktop integration guide

When checking call logs, distinguish three cases. If there's no record, first check whether the client is still using the old provider and whether the request reached the platform. If there's a failed record, keep troubleshooting based on the error the service returned. If there's a successful record but the answer doesn't match the task, it only shows the model call succeeded, and you still need to check the output and tool behavior. Logs are a troubleshooting lead, but they can't on their own prove that all local permissions and features are correct.

Create and manage the API Key for this integration

Troubleshoot Errors Layer by Layer

401: Confirm the Key hasn't been revoked, was copied in full, and belongs to the right platform, and check the credential source actually in use. 404: Check /chatgpt/v1 and the Responses configuration character by character, and don't substitute addresses for Claude Messages or generic Chat Completions. model not found: Check the model ID, Key restrictions, and channel, and don't guess model fields from display names.

Long wait with no result: Record the time, client version, and error message, and first work out whether the problem is in the network, authentication, or model response stage. Don't turn off all approvals to work around connection problems. Approvals control local actions and can't fix a remote API address.

How to Restore Your Original Official Config

Exit the current test session and restore the backed-up config.toml. The auth file also needs to be restored to match the original route, or you can re-authenticate with your original login method. If you restore only the model name and keep the third-party address, requests will keep going to the wrong service. Restart the client and confirm the original route with a read-only task. When you no longer need the test Key, revoke it on the platform and clean up any temporary backups that contain it.

Conclusion and Related Resources

The acceptance criteria for this setup is that the provider, dedicated endpoint, model, credential, and call log all agree. When something breaks, pin down the layer first. Keeping your original config makes it safe to roll back.

Official provider and authentication docs

Official config fields and precedence

Codex API key setup and troubleshooting

Don't have an account yet?Sign up for AICodeWith →, then follow the Create an API Key guide to generate a key.

Related articles

What is the UI SDK, and how do you use it? Vercel and shadcn's behavior library for agents, installed and tested in Claude Code / Codex / Cursor (0.1.0-beta.1)

What is the UI SDK, and how do you use it? Vercel and shadcn's behavior library for agents, installed and tested in Claude Code / Codex / Cursor (0.1.0-beta.1)

The UI SDK is Vercel's behavior library for agents, released on 12 November 2026 as 0.1.0-beta.1. Behaviors live in the framework-free @ui-sdk/core package and are rendered by adapters for React, Vue, Svelte, Solid, and Web Components. This guide follows the official docs on what it is, how to install it, and how to add the skill for Claude Code, Codex, and Cursor, and it records the commands, timings, and output from our test machine.

What Is AWS Emulator and How Do You Install It? Test AWS Apps Locally with Claude Code and Codex (Tested on 1.0.322)

What Is AWS Emulator and How Do You Install It? Test AWS Apps Locally with Claude Code and Codex (Tested on 1.0.322)

AWS Emulator is AWS's official local emulator of its service APIs, generally available since November 11, 2026 (US time). It has no additional service fee, its source is open, it needs no AWS account, and it covers more than 200 services. We tested version 1.0.322 on Debian 13. This guide covers the install commands, pointing the AWS CLI at the local endpoint to create an S3 bucket and a DynamoDB table, the errors we hit, and how to let Claude Code, Codex and Cursor write and test code against the emulator.

What Is T3 Code and How Do You Install It? Connect Claude Code and Codex, Use a Third-Party API Key, Fix Common Errors (Tested on 0.1.9)

What Is T3 Code and How Do You Install It? Connect Claude Code and Codex, Use a Third-Party API Key, Fix Common Errors (Tested on 0.1.9)

T3 Code is pingdotgg's open-source control surface for coding agents. It ships no model of its own; it drives the Claude Code, Codex, Cursor and other CLIs already on your machine. We tested T3 Code 0.1.9 on Linux. This guide covers the install commands, how to point Claude Code and Codex at an AICodeWith API Key so T3 Code can drive them, a full run of both agents with the t3 thread command, and the errors we hit along the way with their fixes.

    Codex with AICodeWith Tutorial: Endpoint, API Key, Configuration, and Troubleshooting | AI Code With