> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trynito.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Codex

> Route Codex through Nito with a custom provider.

The [Nito Plugin](/plugin/get-started/install-codex) adds `$nito:` commands alongside Codex's own model. Manual routing selects a model through Nito for Codex's ordinary requests.

## Configuration

Codex speaks the Responses API, which Nito serves as a stateless shim at `/v1/responses`. Add a provider to your user-level `~/.codex/config.toml` and select it. Codex does not load provider definitions from a project's `.codex/config.toml`.

```toml lines wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
model = "moonshotai/kimi-k3"     # a Nito catalog ID, from GET /v1/models
model_provider = "nito"

[model_providers.nito]
name = "Nito"
base_url = "https://app.trynito.ai/v1"   # ends in /v1
env_key = "NITO_API_KEY"                  # the env var Codex reads the key from
wire_api = "responses"
```

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
export NITO_API_KEY="z_sk_your_key_here"
codex
```

`wire_api = "responses"` is the protocol Codex uses for custom providers. `base_url` ends in `/v1`, and Codex appends `/responses`. `env_key` names an environment variable; it does not contain the key. Choose a model available to your account from the [catalog](/models/all-models). A listed `:confidential` variant selects Confidential inference. Encrypted inference requires Nito's Chat Completions encryption protocol and is unavailable through this Responses route.

The top-level `model_provider` and `model` lines make Nito your default. For occasional Nito sessions, keep only `[model_providers.nito]` in the user-level file and launch with:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
codex -c model_provider=nito -m moonshotai/kimi-k3
```

Codex's [configuration precedence](https://developers.openai.com/codex/config-basic) lets this command override your usual model and provider for one session.

## Check the route

Start a new Codex session from the shell that exports `NITO_API_KEY`. Ask for a one-sentence reply, then try a small file task that calls a function tool. A 401 points to a missing or invalid Nito key; a 404 points to the base URL or model ID. If a later turn fails after a successful first turn, check whether the client tried stored-response fields: Nito's Responses endpoint is stateless and rejects `previous_response_id` and `store: true`.

OpenAI's [Codex configuration reference](https://developers.openai.com/codex/config-reference) documents user-level provider definitions, `base_url`, `env_key`, and the Responses wire format.

## What This Route Supports

String and message-array input with text, image, and request-local file parts; function tools, Codex function namespaces, and custom tools; the `web_search` tool, which maps to Nito's web search; `reasoning.effort` and `reasoning.summary`; streaming.

Not supported: `store: true`, `previous_response_id`, response retrieve, cancel, and delete, background mode, provider-hosted `file_id` inputs, computer-use, MCP, and file-search built-in tools, and the Chat Completions model feature suffixes.

## Related

<CardGroup cols={3}>
  <Card title="Responses Endpoint" icon="book" href="/api/api-reference/endpoints/responses/createopenairesponse">
    What the shim accepts.
  </Card>

  <Card title="OpenAI SDK Drop-in" icon="code" href="/api/get-started/quickstart-openai-sdk">
    The same key from code.
  </Card>

  <Card title="Claude Code" icon="laptop-code" href="/api/sdks/editor-integrations/claude-code">
    Manual routing through the Messages endpoint.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.