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 theCodex-Pro and Codex-Plus groups:
- Log in to the KiosAPI Dashboard.
- Go to Console → Tokens → Add Token.
- Select group
Codex-Pro(0.04×) orCodex-Plus(0.02×) — check which group covers the exact model you want on the pricing page. - Save and copy the key (starts with
sk-).
Installation
Install Codex CLI globally via npm: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 theKIOSAPI_KEY environment variable.
Windows (PowerShell):
~/.bashrc or ~/.zshrc:
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.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_KEYis set correctly:echo $KIOSAPI_KEY - Ensure the key starts with
sk- - Check the
env_keyin 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-minino longer exist) - Verify your token’s group (
Codex-ProorCodex-Plus) covers that model on the pricing page
Connection Error
- Ensure
base_urlishttps://kiosapi.com/v1(with/v1) - Check your network connection and firewall settings
