Skip to main content

What is Codex?

Codex is an agentic coding system that can plan, write, and run code across long-running development tasks. It integrates with OpenAI-compatible APIs, so you can point Codex to Routify to access Codex models through a single gateway.

Setup

The simplest way to configure Codex with Routify is to set the standard OpenAI-compatible environment variables:
export OPENAI_API_KEY="$ROUTIFY_API_KEY"
export OPENAI_BASE_URL="https://api.routify.ru/v1"
This is the recommended approach for new users and keeps Codex configuration minimal.

Quick Start (CLI)

After setting your environment variables, run Codex as usual:
codex
Codex will route requests through Routify using the configured base URL and API key.

Manual Configuration

Advanced users only: Use manual configuration if you need to set model defaults or provider settings explicitly.

Step 1: Get Your Routify API Key

  1. Sign up or log in at routify.ru
  2. Create a new API key
  3. Copy your key (starts with sk-...)

Step 2: Set Your API Key

Set your API key as an environment variable:
export ROUTIFY_API_KEY="sk-..."
Then ensure Codex uses it by exporting OPENAI_API_KEY and OPENAI_BASE_URL:
export OPENAI_API_KEY="$ROUTIFY_API_KEY"
export OPENAI_BASE_URL="https://api.routify.ru/v1"
Routify is OpenAI-compatible. You don’t need a custom SDK—any OpenAI-compatible client should work.

Step 3: Choose Your Model

Pick a model ID from the Routify catalog and set it in Codex. Here are common Codex choices: Codex Mini (fast, cost‑efficient):
openai/gpt-5.1-codex-mini
Codex (balanced):
openai/gpt-5.1-codex
Codex Max (highest capability):
openai/gpt-5.1-codex-max
Browse all available models at routify.ru/models.

Step 4: Start Codex

Run Codex and begin a session:
codex
Your Codex sessions will now use Routify to route requests to your chosen model.

Model Format

Routify model IDs typically use the format <provider>/<model>, for example:
  • openai/gpt-5.1-codex-mini
  • openai/gpt-5.1-codex
  • openai/gpt-5.1-codex-max
You can find exact model IDs in the Routify catalog.

Reliability and Failover

Routify automatically routes requests across available providers when possible. If a provider is unavailable, requests can fail over to another upstream without changes to your Codex configuration.

Common Errors

”No API key found”

Codex can’t find your Routify API key. Fix:
  1. Ensure ROUTIFY_API_KEY and OPENAI_API_KEY are set: echo $ROUTIFY_API_KEY
  2. Verify OPENAI_BASE_URL is set to https://api.routify.ru/v1
  3. Restart your terminal session and re-run codex

Authentication errors (401/403)

If you see authentication errors: Fix:
  1. Verify your API key is valid on routify.ru
  2. Check that you have sufficient balance
  3. Ensure your key hasn’t been revoked

Model not working

If a specific model isn’t working: Fix:
  1. Verify the model ID in the Routify catalog
  2. Use the <provider>/<model> format (e.g., openai/gpt-5.1-codex-mini)
  3. Try a different Codex model

Resources