Comparison
Claude Code and Codex side by side
Claude Code and Codex are both coding agents that work in the terminal. Claude Code is made by Anthropic, and Codex is made by OpenAI. This page puts documented facts about the two tools side by side and gives no verdict.
Claude Code vs Codex at a glance
The table is based on the documentation of Claude Code and Codex as of 27 November 2026. Its last two rows are relay.fast settings. relay.fast is an independent API gateway and is not affiliated with Anthropic or OpenAI.
| Fact | Claude Code | Codex |
|---|---|---|
| Developer | Anthropic | OpenAI |
| Where it runs | terminal, IDE extensions, desktop app, web | terminal, IDE extension, desktop app, Codex cloud |
| Documented sign-in | Claude subscription or Anthropic Console account | ChatGPT account or API key |
| Request format | Anthropic Messages | OpenAI Responses |
| Settings file | ~/.claude/settings.json | ~/.codex/config.toml |
| Where the address goes | ANTHROPIC_BASE_URL | base_url of a provider |
| Project instructions | CLAUDE.md, also reads AGENTS.md | AGENTS.md |
| relay.fast address | https://relay.fast | https://relay.fast/v1 |
| Models with a relay.fast key | Claude | GPT |
What Claude Code and Codex are, according to their documentation
Claude Code is developed by Anthropic. As of 27 November 2026, its documentation describes it as an agentic coding tool that reads a codebase, edits files, runs commands and works together with development tools. It runs in the terminal, in IDE extensions for VS Code and JetBrains, in a desktop app and on the web. Most of these need a Claude subscription or an Anthropic Console account; the terminal version and the VS Code and JetBrains extensions can also work with third-party providers. The settings file is ~/.claude/settings.json (on Windows %USERPROFILE%\.claude\settings.json), and the variables go in its env block. Project instructions go in CLAUDE.md files, and it also reads a repository's AGENTS.md.
Codex is developed by OpenAI. As of 27 November 2026, the README of its repository describes Codex CLI as a coding agent that runs locally on the user's computer, and its documentation says it inspects code, makes changes and runs commands from the terminal. It runs in the terminal (Codex CLI), in an IDE extension, in a desktop app and in Codex cloud. Access is through Sign in with ChatGPT (subscription access) or an API key (usage-based access). The settings file is ~/.codex/config.toml, where a custom provider is a [model_providers.<id>] table. Project instructions go in AGENTS.md files, which the documentation says Codex reads before doing any work.
API format and models: Messages vs Responses
As of 27 November 2026, Claude Code sends requests in the Anthropic Messages format. They go to /v1/messages at the address set in ANTHROPIC_BASE_URL. Codex sends requests in the OpenAI Responses format. In its provider settings the key wire_api names the protocol, and its configuration reference lists responses as the only supported value.
In the Anthropic Messages format relay.fast serves Claude models, so Claude Code with a relay.fast key works with Claude models, for example claude-sonnet-5-5. Codex with a relay.fast key works with GPT models, for example gpt-6.1-sol. Copy model ids exactly from the model catalog.
The Claude Code documentation on gateways says that any gateway exposing a supported API format works. It also says that Anthropic does not endorse, maintain or audit third-party gateway products, and that Anthropic does not support routing Claude Code to non-Claude models through a gateway.
Connect Claude Code to relay.fast
Put the relay.fast address and your API key into the env block of ~/.claude/settings.json.
{
"env": {
"ANTHROPIC_BASE_URL": "https://relay.fast",
"ANTHROPIC_AUTH_TOKEN": "sk-your-api-key",
"ANTHROPIC_MODEL": "claude-sonnet-5-5"
}
}The address is https://relay.fast without /v1, because Claude Code adds /v1/messages itself. The key goes in ANTHROPIC_AUTH_TOKEN and is sent in the Authorization: Bearer header. To choose the model, use the /model command inside a session, the --model flag when you start it, or the ANTHROPIC_MODEL variable.
A 404 with the text Invalid URL means the address ends with /v1. Remove it. The /status command shows which address and which credential are in use.
As of 27 November 2026 the desktop app does not read ANTHROPIC_BASE_URL or settings.json, so this setting is for the terminal version. The Claude Code setup guide has every step and the setup script.
Connect Codex to relay.fast
Add a relay.fast provider to ~/.codex/config.toml.
model = "gpt-6.1-sol"
model_provider = "relayfast"
[model_providers.relayfast]
name = "relay.fast"
base_url = "https://relay.fast/v1"
env_key = "RELAY_FAST_API_KEY"
wire_api = "responses"
requires_openai_auth = falseThen put your API key into the RELAY_FAST_API_KEY environment variable.
# macOS and Linux
export RELAY_FAST_API_KEY=sk-your-api-key
# Windows (PowerShell), then open a new terminal
setx RELAY_FAST_API_KEY sk-your-api-keyThe address is https://relay.fast/v1, and the provider sets wire_api = "responses". env_key names the environment variable that holds the key. The top-level keys model and model_provider choose the model and the provider.
A 404 with the code invalid_endpoint means the address has no /v1. Add it.
The Codex setup guide has every step and the setup script.
Using Claude Code and Codex together
Both tools can be installed on one computer. One relay.fast API key works with both; only the address differs. Each tool keeps its own settings file: ~/.claude/settings.json for Claude Code and ~/.codex/config.toml for Codex. CC Switch is a program that keeps provider settings for both tools. The CC Switch guide covers it. Requests from both tools are charged per token to your relay.fast balance. No subscription is needed to use either tool through relay.fast.
Claude Code or Codex: which to choose
With a relay.fast key the model family follows the tool: Claude models in Claude Code, GPT models in Codex. The model family you want to work with tells you which price table below to look at.
To see the difference on your own work, run the same small task in both tools, then compare the results and the token spend shown in the relay.fast dashboard.
Keep agent costs under control
A coding agent sends the conversation, file contents and tool results with every step, so input tokens make up most of the bill. Use a mid-priced model for routine edits and a frontier model for hard tasks, prefer models with a cache-read price for long sessions, and keep auto-approve limits low until you know what a typical task costs. Current prices are in the live pricing catalog.
Current Claude model prices
Prices checked from the live catalog. "From" is the lowest price among the relay.fast sources that currently serve the model. The price you pay depends on the source your request uses and can change on any day. The pricing page always shows current values.
| Model | Model ID | Official input / output per 1M tokens | relay.fast from, input / output | Cache read from | Context |
|---|---|---|---|---|---|
| Claude Fable 5.2 | claude-fable-5-2 | $8 / $40 | $1.79 / $8.93 (−77%) | $0.0446 | 1M |
| Claude Fable 5.1 | claude-fable-5-1 | $10 / $50 | $2.23 / $11.16 (−77%) | $0.0558 | 1M |
| Claude Opus 5.5 | claude-opus-5-5 | $4 / $20 | $0.476 / $2.38 (−88%) | $0.0238 | 1M |
| Claude Sonnet 5.5 | claude-sonnet-5-5 | $2 / $10 | $0.238 / $1.19 (−88%) | $0.0238 | 1M |
| Claude Haiku 5.5 requests above 100K input tokens cost more | claude-haiku-5-5 | $0.1 / $0.5 | $0.0223 / $0.112 (−77%) | $0.00223 | 1M |
| Claude Opus 4.8 | claude-opus-4-8 | $5 / $25 | $0.595 / $2.98 (−88%) | $0.0595 | 1M |
Current GPT model prices
Prices checked from the live catalog. "From" is the lowest price among the relay.fast sources that currently serve the model. The price you pay depends on the source your request uses and can change on any day. The pricing page always shows current values.
| Model | Model ID | Official input / output per 1M tokens | relay.fast from, input / output | Cache read from | Context |
|---|---|---|---|---|---|
| GPT-6.1 Sol requests above 272K input tokens cost more | gpt-6.1-sol | $2 / $10 | $0.03 / $0.15 (−98%) | $0.0015 | 1.05M |
| GPT-6 Sol requests above 272K input tokens cost more | gpt-6-sol | $2 / $10 | $0.03 / $0.15 (−98%) | $0.003 | 1.05M |
| GPT-6 Astra requests above 272K input tokens cost more | gpt-6-astra | $10 / $50 | $0.1 / $0.5 (−99%) | $0.01 | 1.05M |
| GPT-6 Luna requests above 272K input tokens cost more | gpt-6-luna | $0.1 / $0.5 | $0.008 / $0.04 (−92%) | $0.0008 | 1.05M |
| GPT-5.6 Sol requests above 272K input tokens cost more | gpt-5.6-sol | $5 / $30 | $0.075 / $0.45 (−98%) | $0.0075 | 1M |
| GPT-5.6 Terra requests above 272K input tokens cost more | gpt-5.6-terra | $2 / $12 | $0.03 / $0.18 (−98%) | $0.003 | 1M |
| GPT-5.6 Luna requests above 272K input tokens cost more | gpt-5.6-luna | $0.2 / $1.2 | $0.016 / $0.096 (−92%) | $0.0016 | 1M |
| GPT-5.5 requests above 272K input tokens cost more | gpt-5.5 | $5 / $30 | $0.075 / $0.45 (−98%) | $0.0075 | 272K |
Frequently asked questions
What is the difference between Claude Code and Codex?
As of 27 November 2026, Claude Code is made by Anthropic and sends requests in the Anthropic Messages format. Codex is made by OpenAI and sends requests in the OpenAI Responses format. With a relay.fast key the model family differs too: Claude models in Claude Code, GPT models in Codex.
Which models do Claude Code and Codex work with through relay.fast?
With a relay.fast key, Claude Code works with Claude models, for example claude-sonnet-5-5, and Codex works with GPT models, for example gpt-6.1-sol.
Can I use Claude Code and Codex with one relay.fast key?
Yes. One relay.fast API key works with both tools. Claude Code uses the address https://relay.fast and Codex uses https://relay.fast/v1.
Do I need a subscription to use Claude Code or Codex through relay.fast?
No. Through relay.fast, each request is charged per token to your relay.fast balance, and no subscription is needed.
Should I choose Claude Code or Codex?
There is no verdict here. Decide which model family you want to work with, Claude or GPT, compare the prices of those models, then run the same small task in both tools.
Is relay.fast affiliated with Anthropic or OpenAI?
No. relay.fast is an independent API gateway. Claude Code is a product of Anthropic and Codex is a product of OpenAI.