~/.codex/config.toml, point it at https://api.tokios.com/v1, and Codex runs against your own local model — on Ollama, LM Studio, or any OpenAI-compatible backend — from anywhere, down your private tunnel.
Prerequisites
- A running Tokios Connector paired with your local model — see Connector Install
- A registered model deployment name — see Register a Model
- A Tokios API key — see API Keys
- OpenAI Codex installed
Configure Codex
Set your Tokios key in the environment, then add a Tokios provider and profile to~/.codex/config.toml:
~/.codex/config.toml
wire_api = "responses" and disable_response_storage = true are both required. Tokios serves the Responses surface statelessly, so Codex must not rely on server-side response storage.gemma-tunnel with the public model name you registered in the console.
Using the OpenAI Python SDK
To call your local model programmatically with the OpenAI SDK, point the client at the Tokios base URL:openai_tokios.py
The OpenAI SDK’s base URL must end with
/v1. The Tokios endpoint is https://api.tokios.com/v1.