Codex CLI
Add GreenTokens as a model provider in Codex CLI.
Quick setup
Run the setup script in a terminal and choose Codex CLI from its list. It finds Codex CLI's settings, checks your API key, and makes the changes described below for you, backing up each file first. It can set up your other agents in the same run.
curl -fsSL https://www.greentokens.io/setup.sh | bashThe script saves your key as the GREENTOKENS_API_KEY environment variable, which Codex CLI reads. Open a new terminal window afterwards so it picks it up.
To undo, run the same command again and choose Remove.
Add GreenTokens as a provider
Codex CLI supports custom model providers in its config file. Add GreenTokens and make it the default:
~/.codex/config.toml
model = "gpt-6-sol"
model_provider = "greentokens"
[model_providers.greentokens]
name = "GreenTokens"
base_url = "https://api.greentokens.io/v1"
env_key = "GREENTOKENS_API_KEY"
wire_api = "responses"base_urlincludes/v1.env_keynames the environment variable Codex reads your key from, so the key never sits in the file.wire_api = "responses"uses the OpenAI Responses API, which GreenTokens serves.
Run it
export GREENTOKENS_API_KEY="sk-gt-…"
codexChoosing models
Set model in the config to any model ID from the models page, or override it for one session:
Shell
codex --model gpt-6-astraGive Codex its own API key with a daily spend limit, so a long autonomous run can't exceed the budget you set.