---
title: Codex App | RunAPI
description: Use RunAPI as the model provider in Codex App, choose a Responses-compatible
  model, and verify the connection.
url: https://runapi.ai/docs/resources/tool-integrations/codex-app.md
canonical: https://runapi.ai/docs/resources/tool-integrations/codex-app
locale: en
---

> HTML version: https://runapi.ai/docs/resources/tool-integrations/codex-app
> Site index for agents: https://runapi.ai/llms.txt

# Codex App

## Overview

Codex is available in the ChatGPT desktop app for Windows and macOS.
This guide points the local Codex App at RunAPI's OpenAI-compatible
Responses endpoint, selects a RunAPI model, and verifies the connection.

This changes the model provider used to generate responses and code. It
does not add RunAPI tools. [Hosted MCP](https://runapi.ai/docs/resources/mcp/hosted.md) is a
separate integration with its own client and authentication
requirements.

## Before you begin

* Install the current [ChatGPT desktop app][1], sign in, and open Codex
  at least once.
* Create a dedicated standard RunAPI API key by following the
  [Authentication Guide](https://runapi.ai/docs/guides/authentication.md). Do not commit the
  key to a repository.
* From the [Model Catalog](https://runapi.ai/models), copy the exact identifier of a
  model that supports the Responses API.



[1]: https://developers.openai.com/codex/app

These steps configure local Codex clients that read your user-level
configuration. They do not configure hosted Codex cloud tasks.

## Save the API key

Desktop apps may not inherit environment variables from your shell.
Create or edit `~/.codex/.env` and add the key on its own line:

```dotenv
export RUNAPI_API_KEY=YOUR_RUNAPI_API_KEY
```

Keep this file outside your repositories. On macOS and Linux, restrict
it to your user account:

```shell
chmod 600 ~/.codex/.env
```

## Configure RunAPI

Open the user-level `~/.codex/config.toml`. Merge the following values
into the existing file; do not replace unrelated settings or add a
second copy of an existing top-level key:

```toml
model = "YOUR_RUNAPI_MODEL_ID"
model_provider = "runapi"

[model_providers.runapi]
name = "RunAPI"
base_url = "https://runapi.ai/v1"
env_key = "RUNAPI_API_KEY"
wire_api = "responses"
```

Provider and authentication settings must be user-level. Codex ignores
`model_provider` and `model_providers` in a project's
`.codex/config.toml`. The TOML stores only the environment variable
name; the API key remains in `~/.codex/.env`.

The `base_url` is the API root, not an operation URL. With `wire_api =
"responses"`, Codex sends `POST /v1/responses`. See OpenAI's [custom
model provider configuration][1] for the provider contract.



[1]: https://developers.openai.com/codex/config-advanced#custom-model-providers

## Choose a model

Replace `YOUR_RUNAPI_MODEL_ID` with the exact identifier copied from the
[Model Catalog](https://runapi.ai/models). Select a model that exposes the Responses API;
support for Chat Completions alone is not sufficient for this
configuration.

When you change `model`, completely restart the app and start a new
task. An existing task may retain the model and provider with which it
started.

## Restart and verify

1.  Completely quit and reopen the ChatGPT desktop app.
2.  Open Codex and start a new task in a repository.
3.  Send a short prompt such as `Describe this repository in one
    sentence.`
4.  Confirm that Codex returns a normal response and that RunAPI records
    a `POST /v1/responses` request for the selected model.

The first verification should stay short so configuration errors are
easy to separate from task-specific behavior.

## Add RunAPI tools

The model provider above routes Codex inference through RunAPI. MCP is
separate: it can let supported clients call RunAPI tools for model
discovery, account information, and supported task workflows.

The [Hosted MCP guide](https://runapi.ai/docs/resources/mcp/hosted.md) documents the
currently supported client and authentication requirements.
Codex-specific Hosted MCP authentication has not been verified, so this
page does not provide Codex MCP setup steps. Do not replace the
model-provider configuration with an MCP server entry; the two
integrations serve different purposes.

## Troubleshoot

* **Codex still uses the previous provider:** confirm the file is
  `~/.codex/config.toml`, remove duplicate `model` or `model_provider`
  keys, completely restart the app, and start a new task.
* **`RUNAPI_API_KEY` is missing:** confirm the key is in
  `~/.codex/.env`, not only in a terminal profile, then restart the app.
* **Authentication fails:** create or rotate a standard key through the
  [Authentication Guide](https://runapi.ai/docs/guides/authentication.md). Do not paste the
  key into `config.toml` or support logs.
* **The request returns `404`:** set `base_url` to
  `https://runapi.ai/v1`, not `https://runapi.ai/v1/responses`.
* **The model is unavailable or rejects a field:** copy the exact
  identifier again and confirm that the model supports the Responses API
  and the requested capability.
* **Codex selects a different model:** check trusted project
  `.codex/config.toml` files for a `model` override. Project config can
  select a model even though it cannot replace the user-level provider.
* **The CLI works but the app fails:** check `~/.codex/.env`, then fully
  restart the app. GUI applications may not read variables exported only
  by your shell.
* **A cloud task does not use RunAPI:** this local configuration applies
  to local Codex clients; hosted cloud tasks do not read files from your
  computer.

## Remove RunAPI

1.  Remove the RunAPI `model`, `model_provider`, and
    `[model_providers.runapi]` values from `~/.codex/config.toml`, or
    restore the provider values you used previously.
2.  Remove `RUNAPI_API_KEY` from `~/.codex/.env` if no other local tool
    uses it.
3.  Completely restart the app and start a new task.
4.  Revoke the dedicated key in RunAPI when it is no longer needed.

## Next steps

Use the [LLM API Quickstart](https://runapi.ai/docs/guides/llm-api/quickstart.md) for shared
protocol behavior and the [Responses API
Reference](https://runapi.ai/docs/api/openai/responses.md) for exact request and response
fields. Continue with the [Model Catalog](https://runapi.ai/models), [Authentication
Guide](https://runapi.ai/docs/guides/authentication.md), or [Hosted
MCP](https://runapi.ai/docs/resources/mcp/hosted.md) as needed.

---

## More from RunAPI

- [Home](https://runapi.ai/.md)
- [Models](https://runapi.ai/models.md)
- [AI Video API Comparison](https://runapi.ai/ai-video-api-comparison.md)
- [OpenClaw Integration](https://runapi.ai/openclaw.md)
- [Best API for OpenClaw](https://runapi.ai/best-api-for-openclaw.md)
- [OpenClaw Image Generation](https://runapi.ai/openclaw-image-generation.md)
- [Hermes Agent Integration](https://runapi.ai/hermes-agent.md)
- [Pricing](https://runapi.ai/pricing.md)
- [Claude API Pricing](https://runapi.ai/claude-api-pricing.md)
- [ChatGPT API Pricing](https://runapi.ai/chatgpt-api-pricing.md)
- [OpenAI API Pricing](https://runapi.ai/openai-api-pricing.md)
- [Gemini API Pricing](https://runapi.ai/gemini-api-pricing.md)
- [Claude Code Pricing](https://runapi.ai/claude-code-pricing.md)
- [Claude Code API](https://runapi.ai/claude-code-api.md)
- [Claude Code vs Cursor](https://runapi.ai/claude-code-vs-cursor.md)
- [Claude Max vs API](https://runapi.ai/claude-max-vs-api.md)
- [Requesty Alternative](https://runapi.ai/requesty-alternative.md)
- [Docs](https://runapi.ai/docs/guides)
- [SDK](https://runapi.ai/sdk.md)
- [Skills](https://runapi.ai/skills.md)
- [MCP Server](https://runapi.ai/mcp.md)
- [CLI](https://runapi.ai/cli.md)
- [Feedback](https://runapi.ai/)
- [Contact](mailto:support@runapi.ai)
- [Terms](https://runapi.ai/terms.md)
- [Privacy](https://runapi.ai/privacy.md)
- [Site index for agents](https://runapi.ai/llms.txt)

Contact: contact@runapi.ai

## Structured data

```json
[
  {
    "@context": "https://schema.org",
    "inLanguage": "en",
    "@type": "WebSite",
    "name": "RunAPI",
    "url": "https://runapi.ai/",
    "potentialAction": {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://runapi.ai/models?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    }
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "en",
    "@type": "Organization",
    "name": "RunAPI",
    "url": "https://runapi.ai/",
    "logo": {
      "@type": "ImageObject",
      "url": "https://runapi.ai/icon.svg"
    },
    "sameAs": [
      "https://github.com/runapi-ai"
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "en",
    "@type": "TechArticle",
    "headline": "Codex App",
    "description": "Use RunAPI as the model provider in Codex App, choose a Responses-compatible model, and verify the connection.",
    "url": "https://runapi.ai/docs/resources/tool-integrations/codex-app",
    "mainEntityOfPage": "https://runapi.ai/docs/resources/tool-integrations/codex-app"
  }
]
```
