Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 27 additions & 5 deletions src/content/docs-es/codex.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,19 @@ Edita `~/.codex/config.toml`:
```toml
model_provider = "nan"
model = "glm5.3-flash"
model_context_window = 1048576

[model_providers.nan]
name = "NaN"
base_url = "https://api.nan.builders/v1"
env_key = "NAN_API_KEY"
wire_api = "chat"
wire_api = "responses"
```

Tres detalles que importan:
Cuatro detalles que importan:

- **`wire_api = "chat"`** hace que Codex use `/chat/completions`. Es lo que quieres: el endpoint `/responses` del clúster contesta de una sola vez en lugar de ir emitiendo la respuesta, así que con `"responses"` verías la respuesta aparecer de golpe al final.
- **`wire_api = "responses"`** es el único valor que Codex sigue aceptando: desde la 0.154 `"chat"` no es que vaya peor, es que el fichero no carga y Codex no abre. Esta página recomendaba `"chat"` cuando `/responses` contestaba de una sola vez; ahora ese endpoint emite la respuesta por partes y la razón ya no existe.
- **`model_context_window`** hace falta porque Codex no tiene metadatos de los modelos del clúster: sin él supone una ventana y compacta la conversación mucho antes de tiempo. Pon la del modelo que uses; están en [Modelos](/docs/models).
- **El identificador del proveedor no puede ser `openai`, `ollama` ni `lmstudio`**, que están reservados. Por eso se llama `nan`.
- **`base_url` termina en `/v1`** y nada más. No añadas la ruta del endpoint.

Expand All @@ -64,7 +66,24 @@ Puedes cambiarlo sin tocar el fichero:
codex --model deepseek-v4-flash
```

O dejar varios proveedores declarados y elegir con `--profile` si prefieres perfiles separados por tarea.
Con una pega: la `model_context_window` del fichero no cambia con el modelo, así que un modelo de 262.144 se queda con la ventana del que tengas declarado y Codex compacta cuando no toca.

Para tener los modelos del clúster a mano, cada uno con su ventana, escribe un fichero por modelo en `~/.codex/`. Codex 0.155 lo llama perfil, y es tu `config.toml` con ese fichero encima:

```toml
# ~/.codex/nan-qwen36.config.toml
model = "qwen3.6"
model_provider = "nan"
model_context_window = 262144
```

```bash
codex --profile nan-qwen36
```

Ojo con el nombre: Codex quiere "un nombre simple" y **rechaza los puntos**, así que `qwen3.6` no vale como perfil aunque sí como modelo.

El resto del `config.toml` (tu proveedor, tus MCP, tus permisos) sigue aplicando; el perfil solo pisa lo que nombra. La [CLI de NaN](/docs/nan-cli) los escribe por ti, uno por cada modelo de chat del clúster, con el prefijo `nan-` y sin los puntos: `nan-glm53-flash`, `nan-deepseek-v4-flash`, `nan-qwen36`… Al desconectar Codex se los lleva.

## Modelo recomendado

Expand All @@ -74,7 +93,10 @@ O dejar varios proveedores declarados y elegir con `--profile` si prefieres perf

- **Las funciones en la nube de Codex no aplican.** Al declarar un proveedor propio, todo va contra NaN desde tu máquina.
- **El razonamiento se ve distinto según el modelo.** Los modelos del clúster emiten su traza de razonamiento a su manera, y Codex no siempre la presenta como con los modelos de OpenAI.
- **Si cambias `wire_api` a `"responses"`**, la respuesta deja de aparecer poco a poco. No es un cuelgue: es que ese endpoint todavía no emite la respuesta por partes.
- **`wire_api = "chat"` en un fichero antiguo.** Codex 0.154 lo retiró: si lo tienes, ni la CLI ni la app de escritorio abren. Cámbialo a `"responses"`, o pasa por el Setup de la CLI de NaN, que lo corrige solo.
- **`model_context_window` repetida.** Las versiones de la CLI de NaN anteriores a la 0.1.20 la añadían al final del fichero una vez por cada pasada del setup. Dos son una clave duplicada y Codex no carga el fichero: la CLI dice `duplicate key` y la app abre un diálogo de error y nada más. La 0.1.20 deja una sola y la pone donde se lee.
- **`401 This API key does not have access to the requested model`.** El `model_provider` apunta al clúster pero el `model` sigue siendo uno de OpenAI. Cambia también el modelo.
- **`failed to refresh available models: missing field `models``** al arrancar. Es ruido y puedes ignorarlo: la sesión sigue y responde igual. El clúster contesta a `/v1/models` en el formato de la API de OpenAI (`{"object":"list","data":[…]}`) y Codex lo lee como si fuera su catálogo interno. Le pasa igual con LM Studio, OpenRouter y los proveedores de Azure ([openai/codex#22205](https://github.com/openai/codex/issues/22205)), y en la 0.155 `features.remote_models=false` tampoco lo calla. Como efecto, los modelos del clúster no salen en el selector de Codex: para eso están los perfiles de arriba.

</Details>

32 changes: 27 additions & 5 deletions src/content/docs/codex.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,19 @@ Edit `~/.codex/config.toml`:
```toml
model_provider = "nan"
model = "glm5.3-flash"
model_context_window = 1048576

[model_providers.nan]
name = "NaN"
base_url = "https://api.nan.builders/v1"
env_key = "NAN_API_KEY"
wire_api = "chat"
wire_api = "responses"
```

Three details that matter:
Four details that matter:

- **`wire_api = "chat"`** makes Codex use `/chat/completions`. That is what you want: the cluster's `/responses` endpoint answers in one go instead of streaming, so with `"responses"` you would see the answer appear all at once at the end.
- **`wire_api = "responses"`** is the only value Codex still takes: since 0.154 `"chat"` does not degrade anything, it stops the file loading and Codex does not open. This page recommended `"chat"` back when `/responses` answered in one go; that endpoint streams now and the reason is gone.
- **`model_context_window`** is needed because Codex has no metadata for the cluster's models: without it it assumes a window and compacts the conversation long before it has to. Use the one for the model you run; they are in [Models](/docs/models).
- **The provider identifier cannot be `openai`, `ollama` or `lmstudio`**, which are reserved. That is why it is called `nan`.
- **`base_url` ends at `/v1`** and nothing more. Do not add the endpoint path.

Expand All @@ -64,7 +66,24 @@ You can change it without touching the file:
codex --model deepseek-v4-flash
```

Or leave several providers declared and pick with `--profile` if you prefer separate profiles per task.
With one catch: the `model_context_window` in the file does not follow the model, so a 262,144-token model keeps the window of whichever one you declared and Codex compacts when it should not.

To keep the cluster's models at hand, each with its own window, write one file per model in `~/.codex/`. Codex 0.155 calls it a profile, and it is your `config.toml` with that file layered on top:

```toml
# ~/.codex/nan-qwen36.config.toml
model = "qwen3.6"
model_provider = "nan"
model_context_window = 262144
```

```bash
codex --profile nan-qwen36
```

Mind the name: Codex wants "a plain name" and **rejects dots**, so `qwen3.6` is not usable as a profile even though it is fine as a model.

The rest of your `config.toml` - your provider, your MCP servers, your permissions - still applies; the profile only overrides what it names. The [NaN CLI](/docs/nan-cli) writes them for you, one per chat model on the cluster, prefixed `nan-` and with the dots dropped: `nan-glm53-flash`, `nan-deepseek-v4-flash`, `nan-qwen36`… Disconnecting Codex takes them away again.

## Recommended model

Expand All @@ -74,6 +93,9 @@ Or leave several providers declared and pick with `--profile` if you prefer sepa

- **Codex's cloud features do not apply.** Once you declare a provider of your own, everything goes to NaN from your machine.
- **Reasoning looks different depending on the model.** The cluster's models emit their reasoning trace their own way, and Codex does not always present it the way it does with OpenAI's models.
- **If you change `wire_api` to `"responses"`**, the answer stops appearing gradually. It is not a hang: that endpoint does not stream yet.
- **`wire_api = "chat"` in an older file.** Codex 0.154 dropped it: if you have it, neither the CLI nor the desktop app opens. Change it to `"responses"`, or go through the NaN CLI's Setup, which repairs it for you.
- **A repeated `model_context_window`.** NaN CLI versions before 0.1.20 appended one at the end of the file on every setup run. Two of them is a duplicate key and Codex will not load the file: the CLI says `duplicate key` and the desktop app opens an error dialog and nothing else. 0.1.20 leaves one and puts it where it is read from.
- **`401 This API key does not have access to the requested model`.** The `model_provider` points at the cluster but `model` is still an OpenAI one. Change the model too.
- **`failed to refresh available models: missing field `models``** on startup. It is noise and you can ignore it: the session carries on and answers fine. The cluster answers `/v1/models` in the OpenAI API's own format (`{"object":"list","data":[…]}`) and Codex reads it as if it were its internal catalogue. It does the same against LM Studio, OpenRouter and Azure providers ([openai/codex#22205](https://github.com/openai/codex/issues/22205)), and on 0.155 `features.remote_models=false` does not silence it either. The side effect is that the cluster's models do not show up in Codex's model picker - that is what the profiles above are for.

</Details>
Loading