Codex CLI with a custom model provider

Add this provider to ~/.codex/config.toml and put your key in AIGROW_API_KEY, and Codex CLI runs on GPT models through your AIGROW key.

Already have a code? Redeem it on API access, then create a key.

~/.codex/config.toml

model = "gpt-6.2-sol"
model_provider = "aigrow"
web_search = "disabled"

[model_providers.aigrow]
name = "AIGROW"
base_url = "https://aigrow.gg/v1"
env_key = "AIGROW_API_KEY"
wire_api = "responses"
supports_websockets = false
What the film says
  1. Paying list price for Claude?
  2. Claude Opus 5.5, Claude Fable 5.2, GPT-6 Astra, Gemini 4 Argon and Grok 4.7, +4 more models
  3. $1.60 instead of $4.00. Per million input tokens on Claude Opus 5.5.
  4. 9 of 9 models on sale pass the check against the same model at its maker. The results and the script are public: aigrow.gg/ai-api/genuine-models
  5. API credit$100 of API credit for $25. Start today.

Where the setting lives

macOS and Linux
~/.codex/config.toml
Windows
%USERPROFILE%\.codex\config.toml
Another folder, named in CODEX_HOME
$CODEX_HOME/config.toml
The key, in the environment
AIGROW_API_KEY

Set the key and start Codex

Codex reads the key from the variable env_key names. Export it in the shell you start codex from, or in your shell profile so every new terminal has it.

export AIGROW_API_KEY="ag_your_key_here"
codex

Test the endpoint with curl

One request to /v1/responses, the path Codex calls, with the model from the block and store set to false.

curl https://aigrow.gg/v1/responses \
  -H "Authorization: Bearer ag_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-6.2-sol",
    "input": "Reply with the word ready",
    "store": false
  }'

Which model to use

Put the id in exactly as it is written here.

GPT-6.2 Solgpt-6.2-sol
The model in the block, the one Codex starts on. Context: 1,050,000 tokens. Through AIGROW credit: $0.50 input, $0.10 cache read and $2.50 output per million tokens. At OpenAI’s list price: $2.00, $0.10 and $10.00.
GPT-6.2 Astragpt-6.2-astra
Costs more per token than GPT-6.2 Sol. Compare the two on the coding leaderboard before you switch. Context: 1,050,000 tokens. Through AIGROW credit: $2.00 input, $0.40 cache read and $10.00 output per million tokens. At OpenAI’s list price: $8.00, $0.40 and $40.00.
GPT-6 Astragpt-6-astra
Costs more per token than GPT-6.2 Sol. Compare the two on the coding leaderboard before you switch. Context: 1,050,000 tokens. Through AIGROW credit: $2.50 input, $0.25 cache read and $12.50 output per million tokens. At OpenAI’s list price: $10.00, $1.00 and $50.00.
GPT-6.1 Solgpt-6.1-sol
The same price per token as GPT-6.2 Sol, sent and received. Context: 1,050,000 tokens. Through AIGROW credit: $0.50 input, $0.10 cache read and $2.50 output per million tokens. At OpenAI’s list price: $2.00, $0.10 and $10.00.
GPT-6.1 Terragpt-6.1-terra
Costs less per token than GPT-6.2 Sol, sent and received. Context: 1,050,000 tokens. Through AIGROW credit: $0.25 input, $0.05 cache read and $1.25 output per million tokens. At OpenAI’s list price: $1.00, $0.05 and $5.00.
GPT-6 Lunagpt-6-luna
Costs less per token than GPT-6.2 Sol, sent and received. Context: 1,050,000 tokens. Through AIGROW credit: $0.025 input, $0.01 cache read and $0.125 output per million tokens. At OpenAI’s list price: $0.10, $0.01 and $0.50.

The price list has every model and its credit rate, and the coding leaderboard compares the models on coding prompts.

Check that it works

First the key on its own, then Codex CLI with it.

The key

Ask for the model list. It needs a valid key and costs nothing.

curl https://aigrow.gg/v1/models -H "Authorization: Bearer ag_your_key_here"

A working key gets the list back:

{
  "object": "list",
  "data": [
    { "id": "claude-opus-5.5", "object": "model", ... },
    { "id": "claude-fable-5.2", "object": "model", ... },
    { "id": "claude-fable-5.1", "object": "model", ... },
    { "id": "gpt-6.2-astra", "object": "model", ... },
    { "id": "gpt-6-astra", "object": "model", ... },
    { "id": "claude-sonnet-5.5", "object": "model", ... },
    { "id": "claude-haiku-5.5", "object": "model", ... },
    { "id": "gpt-6.2-sol", "object": "model", ... },
    { "id": "gpt-6.1-sol", "object": "model", ... },
    { "id": "gpt-6.1-terra", "object": "model", ... },
    { "id": "gpt-6-luna", "object": "model", ... },
    { "id": "grok-4.7", "object": "model", ... },
    { "id": "gemini-4-argon", "object": "model", ... },
    { "id": "qwen3.8-max", "object": "model", ... },
    { "id": "kimi-k3.1-pro", "object": "model", ... },
    { "id": "gemini-4-hydrogen", "object": "model", ... },
    { "id": "gemini-4-neon", "object": "model", ... },
    { "id": "gemini-3.8-flash", "object": "model", ... },
    ...
  ],
  "has_more": false
}

Codex CLI

Run one task from the shell. codex exec prints its answer and exits; outside a git repository it needs --skip-git-repo-check.

codex exec --skip-git-repo-check "Reply with the word ready"

A working setup ends with the reply:

ready

When it fails

The Codex CLI errors first, then the answers the endpoint gives any tool.

Missing environment variable: `AIGROW_API_KEY`
Codex did not find the key. Export AIGROW_API_KEY in the shell you start codex from, as in the block above, and start codex again.
400: the model is not available on /v1/responses
The model is not a GPT model. Set model in config.toml to one of gpt-6.2-sol, gpt-6.2-astra, gpt-6-astra, gpt-6.1-sol, gpt-6.1-terra, gpt-6-luna, or pass one to codex with -m.
Not inside a trusted directory and --skip-git-repo-check was not specified.
codex exec runs in a git repository unless you add --skip-git-repo-check, as in the check above.
404 on every request
base_url is missing /v1. Codex adds /responses to it, so base_url is https://aigrow.gg/v1.
My tool says 401 or authentication error
The key is missing or mistyped. Copy it again from API access on the dashboard, and make sure it is sent as the key, not as a model name. A revoked key fails the same way: create a new one and swap it in.
I get 402 or a message about credit
Your balance is empty. Open API access on the dashboard, redeem a code or buy another pack, and the next request goes through. Nothing else needs to change.
It says 404 or Unknown model
The model has to be one the endpoint serves, for example claude-opus-5.5. The provider’s own spellings work too (claude-opus-5-5, anthropic/claude-opus-5.5), but a dated id or any model outside the catalogue is rejected before the request is forwarded, and nothing is billed. Request GET /v1/models with your key for the live list, or read the ids on the price list.
Requests are rejected with 429
The endpoint asked you to slow down. Each 429 carries a retry-after header, and the OpenAI and Anthropic SDKs wait that long and retry on their own. In a loop of your own, wait the seconds it names or send fewer requests at once. A refused request is not billed.
The model is unavailable right now
A 404 that says the model is not available right now means that model is briefly unavailable. Your key and balance are fine. Retry in a moment or send the request to another model.
I get a 503
A temporary error, and it is never charged to your balance. Retry the request; if it keeps failing, reach us through the store and we will look into it. When the error says the answer took too long to complete, the whole answer ran past the time limit: for long answers, send the request with "stream": true. On Claude in the Anthropic format, an answer still unfinished 240 seconds after the request ends with this error.

What does not work through AIGROW

  • Every model but GPT. Codex speaks the Responses API, which the endpoint serves for gpt-6.2-sol, gpt-6.2-astra, gpt-6-astra, gpt-6.1-sol, gpt-6.1-terra, gpt-6-luna only; Claude, Gemini, Grok and the other models answer 400 there.

  • Web search in Codex. The endpoint answers a request that carries the web search tool with a 400, so keep web_search = "disabled" as in the block.

  • previous_response_id, conversation, background mode and stored prompts, which need a conversation kept on the endpoint. They answer 400; Codex sends the whole conversation with each request instead.

  • OpenAI’s hosted tools, such as file search, code interpreter, image generation and remote MCP. The tools Codex runs on your machine, such as its shell, work.

  • Live web search inside the model. On /v1/chat/completions and /v1/messages, a web search tool sent with a request is answered from what the model already knows, with no live results, and /v1/responses refuses it. A tool that fetches pages on your own machine still works.

  • Any endpoint past /v1/messages, /v1/chat/completions, /v1/responses, /v1/images, /v1/videos and /v1/models: embeddings, audio and token counting answer 404. The Responses API at /v1/responses serves the GPT models only, without hosted tools or stored conversations.

  • Images: /v1/images/generations and /v1/images/edits take gpt-image-2.6-flare only, one image per request, at 1024x1024, 1024x1536, 1536x1024 or auto, and answer with base64 in b64_json. response_format, n above 1, another size, streaming, or any field beyond model, prompt, n, size, quality, background, output_format, output_compression, moderation and user (and input_fidelity on an edit) answers 400. A client’s own image feature is untested here.

  • Router fields such as models, route, provider and plugins. They are dropped, so a request always goes to the one model it names.

What a month of Codex CLI costs

Codex CLI is billed per token at the credit rates in the price list. An agent sends the whole conversation again with each step, so a long task costs more than its last message suggests; the activity log on API access shows what each request cost.

Cap what Codex CLI can spend

Give Codex CLI its own keyOn API access, under API keys, create a key named Codex CLI, so the cap applies to this tool alone.
Set a monthly capEnter an amount in dollars in the monthly cap field as you create the key, or set it later on the key’s row. An empty field means no cap.
What happens at the capOnce the key has spent its cap in the calendar month (UTC), the endpoint answers its requests with a 402 error that names the cap, and Codex CLI shows it. A request already running finishes, so a month can end a little above the cap. Raise the cap or wait for the 1st; your other keys keep working.

Questions about Codex CLI and a custom API

Does Codex CLI work with a custom base URL?
Yes. Add a provider under model_providers in ~/.codex/config.toml with base_url https://aigrow.gg/v1, env_key set to the variable your key is in and wire_api "responses", then set model_provider to its id. Codex then sends every request there instead of to OpenAI.
Why does the block set supports_websockets = false?
It keeps Codex on HTTPS: the endpoint does not serve WebSocket connections, and a Codex that tries one first waits several seconds before it falls back to HTTPS.
Can Codex use chat completions instead?
No. Codex CLI 0.171 refuses wire_api = "chat" as no longer supported, so it needs an endpoint that serves the Responses API. This one serves it for the GPT models.
Which models can Codex use through AIGROW?
The GPT models: gpt-6.2-sol, gpt-6.2-astra, gpt-6-astra, gpt-6.1-sol, gpt-6.1-terra, gpt-6-luna. The other models in the catalogue answer on chat completions and messages, which Codex does not speak; the other tools in this guide run them.
Are these the genuine GPT models?
Yes. Each GPT model on sale is verified: it is sent the same prompts as the same model reached through another provider, and the scores, the prompt tokens and a tool call are compared. Every run is on aigrow.gg/ai-api/genuine-models.
Is a conversation stored on the endpoint?
No. Responses are never stored on our side, and store: true has no effect. Each request carries the whole conversation, which is how Codex sends it.
Did OpenAI review this setup?
No. OpenAI did not review or endorse AIGROW. Codex CLI lets you add your own model provider in config.toml, and this page shows the one we ran with Codex CLI 0.171.
Can I limit what Codex CLI spends?
Yes. Give Codex CLI its own key on API access and set a monthly cap on it. Once the key has spent its cap in a calendar month (UTC), its requests get a 402 error until the 1st of the next month, and your other keys keep working.

Sources: Codex CLI Advanced configuration · Codex CLI Configuration reference. Read 21 November 2026.

Set up another tool

  • Claude CodeAnthropic protocol

    Four environment variables, in the shell or in settings.json.

  • ClineOpenAI protocol

    The OpenAI Compatible provider, four fields in the settings screen.

  • Roo CodeOpenAI protocol

    The OpenAI Compatible provider, the same fields as Cline.

  • Kilo CodeOpenAI protocol

    A custom provider in the Providers tab; the model list fills itself.

  • ContinueOpenAI protocol

    A models entry in config.yaml, with provider openai and an apiBase.

  • AiderOpenAI protocol

    OPENAI_API_BASE and OPENAI_API_KEY, then openai/ before the model id.

  • OpenCodeOpenAI protocol

    A providers entry in opencode.jsonc and the key in AIGROW_API_KEY.

  • ZedAnthropic and OpenAI protocols

    An Anthropic compatible provider for Claude, an OpenAI compatible one for GPT and Grok.

  • GooseOpenAI protocol

    The OpenAI provider with OPENAI_HOST, or a custom provider file.

  • OpenClawOpenAI protocol

    A custom provider in openclaw.json with api set to openai-completions.

  • GitHub Copilot in VS CodeAnthropic and OpenAI protocols

    The Custom Endpoint provider in chatLanguageModels.json, for chat and agent mode.

  • Qwen CodeOpenAI protocol

    Three OPENAI_* variables in the shell, or modelProviders in ~/.qwen/settings.json.

  • CrushAnthropic and OpenAI protocols

    provider add and model add in ~/.config/crush/crushrc, on completions or messages.

  • Factory DroidAnthropic and OpenAI protocols

    customModels in ~/.factory/settings.json with generic-chat-completion-api or anthropic.

  • AmpAnthropic and OpenAI protocols

    A Custom URL connection in Model Routing, available on every Amp tier.

  • WarpOpenAI protocol

    A custom inference endpoint in Warp Settings for local Warp Agent runs.

  • TraeAnthropic and OpenAI protocols

    Add Model > Custom Model, on OpenAI Chat Completions or Anthropic Messages.

  • OpenHandsOpenAI protocol

    Advanced mode under Settings > LLM, with openai/<model> and Base URL.

  • Hermes AgentOpenAI protocol

    hermes model or ~/.hermes/config.yaml with provider: custom and key_env.

  • PiOpenAI protocol

    A provider in ~/.pi/agent/models.json with api set to openai-completions.

  • TabbyOpenAI protocol

    [model.chat.http] with kind = "openai/chat" in ~/.tabby/config.toml, for chat.

  • JetBrains AI AssistantOpenAI protocol

    OpenAI-compatible under Third-party AI providers, with URL and API Key.

  • Claude DesktopAnthropic protocol

    Third-party inference Gateway in Developer Mode or managed-settings.json.

  • avante.nvimAnthropic and OpenAI protocols

    providers.claude with endpoint and api_key_name, or an inherited openai provider.

  • gptelAnthropic and OpenAI protocols

    gptel-make-openai or gptel-make-anthropic with :host in init.el.

  • LLMOpenAI protocol

    llm keys set and llm openai endpoint add, or extra-openai-models.yaml.

  • Shell GPTOpenAI protocol

    API_BASE_URL, OPENAI_API_KEY and DEFAULT_MODEL in ~/.config/shell_gpt/.sgptrc.

  • AIChatAnthropic and OpenAI protocols

    type: openai-compatible or type: claude with api_base in config.yaml.

  • gptmeOpenAI protocol

    [[providers]] with name, base_url and api_key_env in config.toml.

  • bolt.diyOpenAI protocol

    OPENAI_LIKE_API_BASE_URL and OPENAI_LIKE_API_KEY in .env.local or OpenAILike settings.

  • Refact.aiAnthropic and OpenAI protocols

    Custom provider with Chat Endpoint and Wire Format in Configure Providers.

  • CodeCompanion.nvimAnthropic and OpenAI protocols

    extend('openai_compatible') with env.url and env.api_key in Neovim.

  • FabricAnthropic and OpenAI protocols

    ANTHROPIC_API_BASE_URL or OPENAI_API_BASE_URL with --disable-responses-api.

  • ModsAnthropic and OpenAI protocols

    apis.<name> with base-url, api-key-env and models in mods.yml.

  • PlandexOpenAI protocol

    plandex models custom with providers[].baseUrl and apiKeyEnvVar.

  • Theia AIAnthropic and OpenAI protocols

    ai-features.openAiCustom.customOpenAiModels or anthropicCustom in settings.json.

  • Kilo CLIOpenAI protocol

    provider.openai-compatible in ~/.config/kilo/kilo.jsonc, then kilo run.

  • AI ShellOpenAI protocol

    OPENAI_KEY, OPENAI_API_ENDPOINT and MODEL in ~/.ai-shell or via ai config set.

  • AI CommitsOpenAI protocol

    provider, OPENAI_API_KEY, OPENAI_BASE_URL and OPENAI_MODEL in ~/.aicommits.

  • ChatbladeOpenAI protocol

    OPENAI_API_KEY, OPENAI_API_MODEL and --openai-base-url for Chatblade on the command line.

  • chatgpt-shellAnthropic and OpenAI protocols

    chatgpt-shell-api-url-base, chatgpt-shell-openai-key and chatgpt-shell-models in Emacs init.el.

  • EllamaOpenAI protocol

    ellama-provider and make-llm-openai-compatible with :url, :key and :chat-model in Emacs.

  • fish-aiOpenAI protocol

    provider = self-hosted, server, model and api_key in ~/.config/fish-ai.ini.

  • ForgeOpenAI protocol

    OPENAI_URL, OPENAI_API_KEY and openai_compatible in .env or ~/.forge/.forge.toml.

  • HolmesGPTAnthropic and OpenAI protocols

    OPENAI_API_BASE, OPENAI_API_KEY, MODEL and TEMPERATURE=none, or api_base in ~/.holmes/config.yaml.

  • IronClawOpenAI protocol

    provider_id, base_url, model and api_key_env under [llm.default] in ~/.ironclaw/reborn/config.toml.

  • iTerm2 AIAnthropic and OpenAI protocols

    URL, API, API key and Supports temperature under Settings > General > AI > Manage AI Models.

  • Jupyter AIAnthropic and OpenAI protocols

    api_base, Model ID (LiteLLM) and OPENAI_API_KEY in Jupyternaut settings, .env or config.json.

  • K8sGPTAnthropic and OpenAI protocols

    baseurl, password and model under ai.providers in k8sgpt.yaml, or --baseurl on k8sgpt auth add.

  • kubectl-aiOpenAI protocol

    OPENAI_ENDPOINT and OPENAI_API_KEY in the shell, plus llmProvider and model in config.yaml.

  • llm.nvimOpenAI protocol

    url, model, api_type and fetch_key in require("llm").setup() for Kurama622/llm.nvim.

All 133 setup guides

The API guide has the SDKs, curl, the endpoints and the error codes.

Paste the block and Codex CLI runs on your credit.

Buy a credit pack, redeem the code from your email on API access, create a key and put it in place of ag_your_key_here.