> 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

[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="/files/9zCYy68HKw5xtCNkSBtM" alt=""><figcaption></figcaption></figure>

**Basic Usage Examples**

**Code Generation**:

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

![](/files/P6VcmpkJ0P3vHmFLXdIf)

**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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
