Skip to main content
OpenAI Codex talks to Tokios through the Responses API. Add Tokios as a model provider in ~/.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

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.
Then run Codex with the Tokios profile:
Replace 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.