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

# Codex

> Use Moxus AI's OpenAI-compatible endpoint in Codex CLI or local Codex configuration.

Codex-style tools often select model providers from local configuration. If your Codex version supports custom OpenAI-compatible providers, you can route model requests through Moxus AI.

<Warning>
  Codex configuration differs by version and product surface. This page applies to local Codex CLI or desktop environments that support `config.toml` and custom `model_providers`.
</Warning>

## Values

| Field    | Value                                             |
| -------- | ------------------------------------------------- |
| Base URL | `https://moxus.ai/v1`                             |
| API Key  | `sk-your-key`                                     |
| Model    | Copy the exact model name from Models and pricing |

## Example config

Open your Codex config file, such as `~/.codex/config.toml`, and add or adjust:

```toml theme={null}
model_provider = "moxus"
model = "gpt-4o"

[model_providers.moxus]
name = "Moxus AI"
base_url = "https://moxus.ai/v1"
requires_openai_auth = true
wire_api = "responses"
```

Set the API key in the terminal that starts Codex:

```bash theme={null}
export OPENAI_API_KEY="sk-your-key"
```

If your Codex version uses Chat Completions instead of the Responses API, change `wire_api` to the supported OpenAI-compatible mode, or remove it and follow the tool's error message.

## Usage guidance

* Start with a chat or coding model. Do not use embedding, rerank, or image generation models for coding chat.
* Use project-specific settings when possible so every task does not use a high-cost model.
* Create a separate API key for Codex and set a quota limit.

## Other Codex environments

If you use a Codex-related VS Code extension or a local Codex environment from VS Code, use the same OpenAI-compatible settings:

| Setting  | Value                                    |
| -------- | ---------------------------------------- |
| API Key  | `sk-your-key`                            |
| Base URL | `https://moxus.ai/v1`                    |
| Model    | Exact model name from Models and pricing |

If a Codex environment accepts OpenAI-compatible settings, use the values above. If it does not expose a Base URL setting, it cannot connect directly to Moxus AI.

## Verify

Run a small task:

```bash theme={null}
codex "Summarize this project in one sentence"
```

Then open [Usage](/en/platform/dashboard-and-usage) and confirm the request appears under the expected API key.

## Troubleshooting

<AccordionGroup>
  <Accordion title="Authentication fails">
    Confirm that `OPENAI_API_KEY` is set in the same terminal that starts Codex and that it contains your Moxus AI `sk-` key.
  </Accordion>

  <Accordion title="Model not found">
    Set `model` to the exact model name from Models and pricing. Do not use a client display name or shorthand.
  </Accordion>

  <Accordion title="The interface or wire_api is unsupported">
    Your Codex version may use a different custom provider format. Keep the Base URL and API key values, then adjust `wire_api` or provider type according to your Codex version.
  </Accordion>
</AccordionGroup>

## Next steps

* [Quickstart](/en/overview/quickstart)
* [API keys](/en/platform/account-and-keys)
