Skip to content

Agentsflare Codex Configuration Guide

Codex is OpenAI's official CLI coding tool that supports natural language instructions for code writing, debugging, and refactoring.

Installing Codex

Install globally via npm:

bash
npm install -g @openai/codex

Or run directly with npx (no installation required):

bash
npx @openai/codex

Verify installation:

bash
codex --version

Configuring Codex

Codex reads API settings through environment variables or a configuration file. Below is how to configure it with the Agentsflare proxy.

Set the following environment variables in your terminal before starting Codex:

bash
export OPENAI_API_KEY="Your Agentsflare API Key"
export OPENAI_BASE_URL="https://api.agentsflare.com/v1"

Then run Codex in the same terminal session:

bash
codex

Option 2: Configuration File

Create or modify the Codex configuration file:

  • macOS / Linux: ~/.codex/config.yaml
  • Windows: %USERPROFILE%\.codex\config.yaml

Configuration file content:

yaml
model: gpt-5.2
api_key: "Your Agentsflare API Key"
base_url: "https://api.agentsflare.com/v1"

API Endpoint Reference

Agentsflare provides two OpenAI-compatible API endpoints. Choose based on your needs:

EndpointURLUse Case
Chat Completionshttps://api.agentsflare.com/v1/chat/completionsStandard chat, code generation, general tasks
Responseshttps://api.agentsflare.com/v1/responsesComplex reasoning, tool calling, multi-turn context

Configure Chat Completions Endpoint

bash
export OPENAI_API_KEY="Your Agentsflare API Key"
export OPENAI_BASE_URL="https://api.agentsflare.com/v1/chat/completions"

Configure Responses Endpoint

bash
export OPENAI_API_KEY="Your Agentsflare API Key"
export OPENAI_BASE_URL="https://api.agentsflare.com/v1/responses"

Common Commands

Start an interactive session:

bash
codex

Execute a single instruction directly:

bash
codex "Refactor utils.js into TypeScript"

Launch with a specific model:

bash
codex --model gpt-5.2

View help:

bash
codex --help

Verify Configuration

After configuration, test the connection with:

bash
codex "Hi, please briefly introduce yourself"

If Codex responds normally, the configuration is correct and you have successfully connected to OpenAI models through the Agentsflare proxy.

This documentation is licensed under CC BY-SA 4.0.