Setup Codex
Configure Codex to call OneKeyLLM through the Responses API.
OneKeyLLM exposes POST /v1/responses, the endpoint Codex should use through a
dedicated provider in ~/.codex/config.toml.
1. Export the key
Keep the key out of the repository.
export ONEKEYLLM_API_KEY="sk-lazytech-..."2. Add the provider
# ~/.codex/config.toml
model = "gpt-5.4"
model_provider = "onekeyllm"
[model_providers.onekeyllm]
name = "OneKeyLLM"
base_url = "https://api.tokapi.ai/v1"
env_key = "ONEKEYLLM_API_KEY"
wire_api = "responses"env_key tells Codex which local environment variable should sign requests.
wire_api = "responses" selects the format expected by /v1/responses.
3. Run Codex
codexFor a one-off test without changing the persistent config:
codex \
--config model='"gpt-5.4"' \
--config model_provider='"onekeyllm"' \
--config 'model_providers.onekeyllm={ name="OneKeyLLM", base_url="https://api.tokapi.ai/v1", env_key="ONEKEYLLM_API_KEY", wire_api="responses" }'Alternative: override the OpenAI provider
Codex also documents openai_base_url for pointing the built-in OpenAI provider
at a custom base URL. Use it in the user config, not a project
.codex/config.toml, since Codex does not redirect credentials from project
configuration.
# ~/.codex/config.toml
openai_base_url = "https://api.tokapi.ai/v1"Quick verification
curl https://api.tokapi.ai/v1/responses \
-H "Authorization: Bearer $ONEKEYLLM_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-5.4","input":"Reply with ok"}'Sources: Codex advanced configuration and Codex environment variables.