Setting Up Codex¶
Configuration Example¶
Create a separate ~/.codex/nexus.config.toml profile:
model = "MODEL_FROM_V1_MODELS"
model_provider = "nexus"
[model_providers.nexus]
name = "Nexus"
base_url = "https://api.nexus-hub.tech/v1"
env_key = "NEXUS_API_KEY"
wire_api = "responses"
Set the key:
export NEXUS_API_KEY="your_nexus_key"
Set model only to a value returned by GET /v1/models for your key.
Run codex --profile nexus. Codex sends requests to
POST /v1/responses.
Working with Extended Context (1M Tokens)¶
For models supporting long context (such as gpt-5.6-sol), you can configure the expanded context window and auto-compaction threshold in your ~/.codex/nexus.config.toml profile:
model = "gpt-5.6-sol"
model_provider = "nexus"
model_context_window = 1000000
model_auto_compact_token_limit = 900000
[model_providers.nexus]
name = "Nexus"
base_url = "https://api.nexus-hub.tech/v1"
env_key = "NEXUS_API_KEY"
wire_api = "responses"
model_context_window = 1000000 sets the context budget to 1,000,000 tokens, while model_auto_compact_token_limit = 900000 prevents Codex from prematurely summarizing/compacting history before reaching ~900,000 tokens.
To run a single session without updating the config file:
codex --profile nexus -m gpt-5.6-sol \
-c model_context_window=1000000 \
-c model_auto_compact_token_limit=900000
Troubleshooting¶
401orinvalid_key: checkNEXUS_API_KEY; do not store it inconfig.toml.model_not_foundormodel_not_allowed: requestGET /v1/modelsagain.- Protocol errors: do not change
responsesto Chat Completions; that is a different route. - For support, keep the response
x-request-id, but do not send the key or a full prompt.
Official reference: Codex config reference.