> For the complete documentation index, see [llms.txt](https://infronai.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://infronai.gitbook.io/docs/frameworks-and-integrations/openai-codex-cli.md).

# OpenAI Codex CLI

Use Codex CLI with Infron AI models

[Codex CLI](https://openai.com/codex/) is a terminal-based coding agent that combines local execution with cloud AI capabilities. Unlike code generation tools that only produce code snippets, Codex CLI can understand your entire project, execute the code it creates, debug issues, and iterate until solutions work correctly.

## How to Access Infron AI <a href="#h-how-to-access-novita-ai-models-in-codex-cli" id="h-how-to-access-novita-ai-models-in-codex-cli"></a>

### **Installation**

**Install via npm (Recommended)**

`npm install -g @openai/codex`

**Install via Homebrew (macOS)**

`brew install codex`

**Verify Installation**

`codex --version`

### Configuring Infron AI AI Models <a href="#h-configuring-novita-ai-models" id="h-configuring-novita-ai-models"></a>

**Setup Configuration File**

Codex CLI uses a TOML configuration file located at:

* **macOS/Linux**: `~/.codex/config.toml`
* **Windows**: `%USERPROFILE%\.codex\config.toml`

**Basic Configuration Template**

{% tabs %}
{% tab title="vim \~/.codex/config.toml" %}

```toml
model = "deepseek/deepseek-v4-pro"
model_provider = "Infron"

[model_providers.Infron]
name = "Infron"
base_url = "https://llm.onerouter.pro/v1"
http_headers = {"Authorization" = "Bearer YOUR_API_KEY"}
wire_api = "responses"
```

{% endtab %}
{% endtabs %}

## Getting Started

**Launch Codex CLI**

{% tabs %}
{% tab title="Bash" %}

```bash
codex
```

{% endtab %}
{% endtabs %}

<figure><img src="https://3822312837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ9C9AjT7j46HAcQrOVWw%2Fuploads%2Fdf6EQUc2rb4CeYK8cDH2%2Fimage.png?alt=media&amp;token=e2e76e52-e68c-4e9b-b52d-c083e0bd4321" alt=""><figcaption></figcaption></figure>

**Basic Usage Examples**

**Code Generation**:

`> Create a Python class for handling REST API responses with error handling`

![](https://3822312837-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ9C9AjT7j46HAcQrOVWw%2Fuploads%2FktufSrhwoWYiAQugvtyM%2Fimage.png?alt=media\&token=8c9fb7a0-0514-4908-90d2-8d880f3c1a6a)

**Project Analysis**:

`> Review this codebase and suggest improvements for performance`

**Bug Fixing**:

`> Fix the authentication error in the login function`

### Conclusion <a href="#h-conclusion" id="h-conclusion"></a>

Codex CLI with Infron‘s models provides a powerful, flexible development environment that combines local control with cloud AI capabilities. By choosing the right model for each task and configuring your environment properly, you can significantly accelerate your development workflow while maintaining code quality and security.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://infronai.gitbook.io/docs/frameworks-and-integrations/openai-codex-cli.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
