Skip to main content

OpenAI Codex CLI

OpenAI Codex CLI is a command-line coding agent from OpenAI. This guide walks you through configuring it to work with KiosAPI.

System Requirements

Get the right API key

Codex models on KiosAPI (gpt-5.5, gpt-5.6, gpt-6 series) are served through the Codex-Pro and Codex-Plus groups:
  1. Log in to the KiosAPI Dashboard.
  2. Go to Console → Tokens → Add Token.
  3. Select group Codex-Pro (0.04×) or Codex-Plus (0.02×) — check which group covers the exact model you want on the pricing page.
  4. Save and copy the key (starts with sk-).
A token in the wrong group cannot call the Codex models. Codex-Pro and Codex-Plus cover slightly different model sets — verify your target model’s group on the pricing page before creating the key. See Choosing a Token Group.

Installation

Install Codex CLI globally via npm:
Or via Homebrew (macOS/Linux):
Verify the installation:

Current Codex models on KiosAPI

Configuration

1. Create the config file

Create ~/.codex/config.toml:
The wire_api = "responses" setting tells Codex to use OpenAI’s Responses API format, which KiosAPI supports at /v1/responses.

2. Set the environment variable

Set your KiosAPI key as the KIOSAPI_KEY environment variable. Windows (PowerShell):
macOS / Linux: Add to ~/.bashrc or ~/.zshrc:
Then reload:

Usage

Interactive mode

Direct question

Using the KiosAPI profile

VSCode Plugin

Codex is also available as a VSCode extension. After installing the extension, configure it to use KiosAPI by setting the same environment variables in your VSCode settings or terminal.
The VSCode extension reads environment variables from your shell. Make sure KIOSAPI_KEY is exported in the shell that launches VSCode, or set it in the integrated terminal.

Advanced Configuration

Non-Interactive CI Mode

For CI/CD pipelines, run Codex in non-interactive mode:

MCP Servers

Codex supports Model Context Protocol (MCP) servers for extended tool access. Add MCP servers in ~/.codex/config.toml:

Troubleshooting

Authentication Error (401)

  • Verify KIOSAPI_KEY is set correctly: echo $KIOSAPI_KEY
  • Ensure the key starts with sk-
  • Check the env_key in your config matches the environment variable name

Model Not Found / No Available Channel

  • Verify the model name in your profile is a current model ID (old names like o4-mini no longer exist)
  • Verify your token’s group (Codex-Pro or Codex-Plus) covers that model on the pricing page

Connection Error

  • Ensure base_url is https://kiosapi.com/v1 (with /v1)
  • Check your network connection and firewall settings

Verify Your Setup

Need Help?