Home / Learn / Using Claude in Codex
Using Claude in Codex — Codex Guide

Using Claude in Codex

Codex talks to any OpenAI-compatible endpoint, so the moment you have a Claude API key you can point it at Claude — no Anthropic account, no waitlist. Buy a key, drop it into config.toml, and Codex's agent loop runs on Claude.

Get a key, then add the provider

Buy a key on ClaudeAPIKey.dev — register, add credit with card or crypto, and generate it instantly. Then edit ~/.codex/config.toml and add a [model_providers.<name>] table with the base_url, the env_key for your key, and wire_api.

The CLI, SDK, and VS Code extension share this config, so one setup works everywhere.

Base URL and wire_api

Use the base URL with /v1; Codex appends the route. Set wire_api = "chat" for the OpenAI-compatible surface. Reserved provider ids are openai, ollama, lmstudio — name yours differently.

Export your purchased key into the variable named by env_key, and set model to a Claude id like claude-sonnet-4-5.

Why buy a key for Codex

You don't need an Anthropic account or its approval flow — a purchased gateway key works immediately with Codex's agent loop. Pay only for what you use, and top up with card or crypto whenever.

New accounts get a small free credit to test the setup before committing.

Run your first task

Once the provider is set, run Codex as usual and it drives Claude. Pick a Sonnet-class model for everyday agentic work or an Opus-class one for hard problems.

Verify wire_api against your Codex version — "chat" for OpenAI-compatible; some builds expect "responses".

# ~/.codex/config.toml
model = "claude-sonnet-4-5"
model_provider = "aiprime"

[model_providers.aiprime]
name = "AI Prime Gateway"
base_url = "https://claudeapikey.dev/v1"
env_key = "AIPRIME_API_KEY"
wire_api = "chat"
# export AIPRIME_API_KEY=<your key>

Frequently asked questions

Do I need an Anthropic account to use Claude in Codex?
No — buy a key on ClaudeAPIKey.dev, add it as a custom provider in config.toml, and Codex drives Claude immediately.
How do I buy a key?
Register, add credit with card or crypto, and generate a key instantly — no waitlist.
Does the base URL need /v1?
Yes — {SITE}/v1; Codex appends /chat/completions.
Is there a free trial?
New accounts get a small free credit (WELCOME5) to test before topping up.
Start using Claude in minutes

Get an API key — no Anthropic account or waitlist required.

Get your API key

AI Prime Tech is an independent API gateway. It is not affiliated with, endorsed by, or a reseller of Anthropic. Claude and related model names are trademarks of their respective owners.

More Claude API guides

How to Get a Claude API KeyClaude API Pricing, ExplainedThe Cheapest Way to Use the Claude APIUnlimited Cursor with the Claude APIUnlimited Claude Code AccessClaude API Gateway vs. Anthropic DirectUsing Claude Through an OpenAI-Compatible APIClaude Models ComparedWhat 'Unlimited' Claude API Access MeansPaying for the Claude API with CryptoClaude API Access Without a WaitlistHow to Reduce Claude Token UsageUnlimited Cline with the Claude APIUnlimited Roo Code with the Claude APIUnlimited Claude in JetBrains IDEsUnlimited Aider with the Claude APIUnlimited Claude in VS CodeUnlimited OpenCode with the Claude APIRunning an Unlimited Hermes Agent on ClaudeRunning Unlimited OpenClaw on ClaudeWhat an Anthropic-Compatible API MeansClaude Code API Key — How to Get and Set UpClaude Code API Costs — Pricing and How to Cut ThemClaude API Errors — Rate Limits, 400, 500, 529 FixesHow to Buy Claude API CreditsUnlimited Claude Usage — Plans and PricingUnlimited Claude Opus 4.8 AccessClaude API Free Trial — Get $5 Free CreditClaude API vs Claude Pro/Max Subscription — Which to ChooseUnlimited Claude Code Usage — No Token LimitsHow to Get Unlimited Claude UsageHow to Get an Unlimited Claude API KeyConnecting Claude to n8nUsing LiteLLM with a Claude KeyUsing Claude in Kilo CodeClaude in GitHub Copilot — No Anthropic Account NeededClaude in Zed — Instant Key, No WaitlistClaude in Cherry Studio — Buy a Key, Start ChattingClaude in LangChain — Just Add a KeyFactory Droid on Claude — No Anthropic Account