Codex CLI
Codex CLI uses the OpenAI Responses API, which 7API supports natively. You don't need an OpenAI account.
Configure
Save this as:
- macOS / Linux:
~/.codex/config.toml - Windows:
%USERPROFILE%\.codex\config.toml
Replace YOUR_7API_KEY with your key, then run codex.
# GPT-6 Astra: 1.05M context, auto-compacts at 900K (leaves room for 128K output).
# gpt-6.1-sol and gpt-6-luna use the same limits.
model = "gpt-6-astra"
model_provider = "7api"
model_reasoning_effort = "high"
approval_policy = "never"
model_context_window = 1050000
model_auto_compact_token_limit = 900000
[model_providers.7api]
name = "7api"
base_url = "https://7api.st"
wire_api = "responses"
experimental_bearer_token = "YOUR_7API_KEY"
[windows]
sandbox = "elevated"Choosing a model
The default is gpt-6-astra. To use another model, change the model value:
| Model | Rate per 1M tokens (standard / cached) |
|---|---|
gpt-6-astra | $0.65 / $0.06 |
gpt-6.1-sol | $0.15 / $0.04 |
gpt-6-luna | $0.05 / $0.01 |
All four have a 1,050,000-token context window. The config compacts the conversation at 900,000 tokens so there's room left for output.
Notes
model_reasoning_effortacceptslow,medium,high,xhighandmax.approval_policy = "never"lets Codex run commands without asking. Change it to"on-request"if you want to approve each one.- See OpenAI's configuration reference for the other options.
