CODEX CONFIGURATION

Codex setup guide: quickstart

Register, fund the account, create an API key, check the local environment, configure Codex, verify Usage, and troubleshoot the getaitoken.com OpenAI-compatible Responses API.

This public guide only shows placeholders; real API keys are only visible on the signed-in API Keys page. Log out of any old Codex account, fully quit the app, then restart after setup.

Register and fundAPI keyEnvironment checkCodex setup/v1 ResponsesUsage verification

Quickstart: account to first call

Follow the real setup path: prepare account credit, create a key, then use import or manual Codex configuration.

  1. 01

    Register and sign in

    Create a getaitoken.com account and open the console.

  2. 02

    Add or redeem credit

    Make sure the account or subscription has usable balance; insufficient balance will make Codex calls fail.

  3. 03

    Create an API key

    Create a key on API Keys and confirm it belongs to an available OpenAI group.

  4. 04

    Configure Codex

    Prefer the one-click import on API Keys; for audited setup, write config.toml, auth.json, and the Windows user-level environment variable manually.

  5. 05

    Restart and verify

    Fully quit Codex, restart it, then verify with /v1/models, a test prompt, and Usage records.

Environment check and setup paths

Check the local runtime first, then choose one-click import, manual setup, or file-level review, all through the OpenAI-compatible API.

Node/npm and Codex CLI

Run node -v and npm -v. If missing, install Node.js first, then run npm install -g @openai/codex@latest to update Codex CLI.

First run creates files

Run codex once in a terminal. If ~/.codex or %USERPROFILE%\.codex does not exist, let the client create it before writing config.

Manual files

Back up existing config, then write config.toml and auth.json under the user-level .codex directory. On Windows, also set user-level OPENAI_API_KEY.

Codex configuration center

The snippets below use the current getaitoken public API Base URL and normalize it with /v1. Real keys are generated only on the signed-in API Keys page.

Manual file setup order

When troubleshooting or auditing, work file by file. Do not confuse a project-level .codex directory with the user-level config directory.

  1. 01

    Open user-level config directory

    Use ~/.codex on macOS/Linux and %USERPROFILE%\.codex on Windows. If it does not exist, run codex once first.

  2. 02

    Back up old files

    Copy config.toml and auth.json to timestamped backup files before editing.

  3. 03

    Write config.toml

    Keep model_provider = "getaitoken", base_url = "https://api.getaitoken.com/v1", wire_api = "responses", and requires_openai_auth = true.

  4. 04

    Write auth.json

    Store only OPENAI_API_KEY, using a real user key generated on getaitoken API Keys. Public guide keys are placeholders.

  5. 05

    Sync Windows environment variable

    Use PowerShell to write user-level OPENAI_API_KEY, then reopen the terminal or fully restart Codex.

Advanced capability entry points

After Codex is configured, continue with Web chat, Responses, and Image APIs.

Web chat

Useful for checking model behavior, prompts, and balance without a local Codex runtime.

Responses API

Codex uses wire_api = "responses"; applications can also call /v1/responses directly.

Images API

Use /v1/images/generations for generation and /v1/images/edits for edits; use /v1/responses for image tools inside text workflows.

Check which models your key supports

A common question is "which models can my account use?" The most accurate answer comes from /v1/models, which only returns models the current key can actually call.

  1. 01

    Call GET /v1/models

    Run curl https://api.getaitoken.com/v1/models -H "Authorization: Bearer $OPENAI_API_KEY". It returns the OpenAI list shape {object:"list", data:[{id, owned_by, ...}]}; the id values are exactly the models this key can call, already filtered by the group and platform whitelist.

  2. 02

    Open the Available Channels page

    After signing in, visit /available-channels to see the models, groups, and pricing multipliers your account supports. It redirects to /login when not signed in.

  3. 03

    Create and scope a key on API Keys

    Use /keys to create or manage a key. A key without an assigned group has no model quota, so confirm the group is set.

  4. 04

    When a model is missing

    If a model id is absent from /v1/models, the key's group does not include it. Check /available-channels or contact support. This platform currently offers OpenAI capabilities only.

OpenAI-compatible endpoint reference

Base URL is https://api.getaitoken.com/v1, authenticated with Authorization: Bearer. The endpoints below are the OpenAI-compatible routes actually served today.

Models & usage

  • GET /v1/models — list the models the current key can access; use it to fetch the model list on client startup.
  • GET /v1/usage — check usage and quota.

Chat & Responses

  • POST /v1/chat/completions — standard chat completions.
  • POST /v1/responses (and /v1/responses/*) — the Responses API; Codex uses wire_api = "responses".

Embeddings

  • POST /v1/embeddings — text embeddings.

Images

  • POST /v1/images/generations — image generation.
  • POST /v1/images/edits — image edits (the group must enable image capabilities).

Root-level aliases without /v1 also work, but configure clients with /v1 for consistency.

Go-live checklist

Check in this order to isolate key, endpoint, model, or client-cache issues.

  1. 01

    Key has a group

    A key without an assigned group cannot use model quota.

  2. 02

    Base URL includes /v1

    Codex needs the OpenAI-compatible API root path; import and config generators append it automatically.

  3. 03

    Config directory exists

    If ~/.codex or %USERPROFILE%\.codex does not exist, run codex once so the client creates it.

  4. 04

    Sign out and restart

    If Codex / ChatGPT is still signed in with an old account, sign out first. Fully restart Codex after changing key, model, or Base URL.

  5. 05

    Check Usage records

    Usage is the final verification. A matching request should appear with model, request count, and spend.

Codex setup FAQ

These cover common OpenAI-compatible Codex setup issues.

How do I check which models my key supports?

Call GET /v1/models (curl https://api.getaitoken.com/v1/models -H "Authorization: Bearer $OPENAI_API_KEY"); the returned id values are the models this key can use. You can also sign in and open /available-channels to see supported models and pricing visually.

Can I use the site root as Base URL?

Prefer the /v1 endpoint for Codex OpenAI-compatible config. The guide and modal generator append /v1 automatically.

What should be installed locally first?

Confirm Node.js and npm are available, then install or update Codex CLI with npm install -g @openai/codex@latest. Run codex once before setup so the user-level .codex directory exists.

Where is the config directory on Windows or macOS?

Use ~/.codex on macOS/Linux and %USERPROFILE%\.codex on Windows. On macOS, press Command+Shift+G in Finder and enter ~/.codex. On Windows, press Win+R and enter %userprofile%\.codex. If the directory does not exist, run codex once first, then create config.toml and auth.json if needed.

Why not use openai as the provider id?

Codex has reserved meanings for built-in provider ids. This guide uses getaitoken as a custom provider to avoid confusion with official OpenAI config.

What if balance is insufficient or a model is unavailable?

Check account balance, order status, or redeemed credit first, then confirm the API key group enables the target OpenAI model. Use /v1/models before changing model IDs.

Do I need WebSocket mode?

No. Standard Responses mode is enough. WebSocket is an advanced option, and the Codex Desktop Fast toggle still depends on client capability detection.

What if Codex shows garbled text on Windows?

Check terminal font and encoding first. If it still happens, press Win+R, run intl.cpl, open the Administrative tab, choose Change system locale, enable Unicode UTF-8 for worldwide language support, save, reboot, and open Codex again.

How do I troubleshoot Connection failed or network errors?

Keep base_url ending in /v1, for example https://api.getaitoken.com/v1; do not put /responses in base_url. From the exact machine or container that runs the failing task, curl both /v1/models and /v1/responses. If /v1/models also returns connection refused, check DNS, outbound 443, firewall rules, HTTP(S)_PROXY/NO_PROXY, CLI sandboxing, or container networking. If image workers work but vision/review workers fail, compare proxy, DNS, and API key inheritance between those workers.

Will manual setup overwrite my old config?

The guide asks you to back up config.toml and auth.json first. Do not delete old files; restore from the backup if needed.

How do users adjust their key, Base URL, or model?

Rotate keys by editing auth.json; on Windows, also update the user-level OPENAI_API_KEY environment variable. Change service URLs by updating base_url with /v1, and check /v1/models before updating both model and review_model.

How do I configure global instructions or web search?

Global instructions should live in the AGENTS.md file that Codex reads; restart Codex or the editor after changing it. Web search is a client capability. If your Codex version supports it, enable it using Codex config semantics; getaitoken only handles OpenAI-compatible API forwarding and Usage records.

How do I confirm the config is really active?

Restart Codex, send a test prompt, and confirm Model provider is getaitoken.com - https://api.getaitoken.com/v1, Account is API key configured, and a matching request appears on Usage.

How should I call gpt-image-2?

getaitoken keeps image support on OpenAI-compatible paths: use /v1/images/generations for image generation and /v1/images/edits for edits. When a text workflow calls an image tool, use /v1/responses with an image_generation tool. Images are returned in data[0].b64_json by default; decode the Base64 payload into a PNG. Set n for multiple images, and keep uploaded edit inputs under 50MB. The API key group must enable allow_image_generation, otherwise the API returns Image generation is not enabled for this group. curl https://api.getaitoken.com/v1/images/generations \ -H "Authorization: Bearer <getaitoken user API key>" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-image-2", "prompt": "A clean product rendering of an AI API dashboard", "size": "1024x1024", "quality": "high", "response_format": "b64_json" }' curl https://api.getaitoken.com/v1/images/edits \ -H "Authorization: Bearer <getaitoken user API key>" \ -F "model=gpt-image-2" \ -F "image[][email protected]" \ -F "prompt=Replace the background with a clean office scene" \ -F "size=1024x1024" \ -F "quality=high" \ -F "response_format=b64_json" curl https://api.getaitoken.com/v1/responses \ -H "Authorization: Bearer <getaitoken user API key>" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-5.5", "input": "Generate a product hero image for an AI API gateway.", "tools": [ { "type": "image_generation", "model": "gpt-image-2", "size": "1024x1024", "quality": "high" } ], "tool_choice": { "type": "image_generation" } }' import OpenAI from "openai"; import { writeFileSync } from "fs"; const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY, baseURL: "https://api.getaitoken.com/v1", }); const result = await client.images.generate({ model: "gpt-image-2", prompt: "A clean product rendering of an AI API dashboard", size: "1024x1024", quality: "high", response_format: "b64_json", }); writeFileSync("out.png", Buffer.from(result.data[0].b64_json, "base64"));

Generate your real Codex config

Sign in, open API Keys, copy the real key or use import, then restart Codex.