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

# OpenAI (Codex)

> Configure OpenAI with API key or OpenAI Codex OAuth in Cline.

Cline supports accessing models directly through the official OpenAI API.

## Choose an OpenAI Path

* **[OpenAI API (key-based)](#get-api-credentials):** Use your OpenAI API key.
* **[OpenAI Codex (Subscription OAuth)](#openai-codex-oauth):** Sign in with OpenAI account, using OAI subscriptions (no key management).

**Website:** [https://openai.com/](https://openai.com/)

## OpenAI API (key-based)

### Get API Credentials

1. **Sign Up/Sign In:** Visit the [OpenAI Platform](https://platform.openai.com/). You'll need to create an account or sign in if you already have one.
2. **Navigate to API Keys:** Once logged in, go to the [API keys section](https://platform.openai.com/api-keys) of your account.
3. **Create a Key:** Click on "Create new secret key". It's good practice to give your key a descriptive name (e.g., "Cline API Key").
4. **Copy the Key:** **Crucial:** Copy the generated API key immediately. For security reasons, OpenAI will not show it to you again. Store this key in a safe and secure location.

### Configuration in Cline

> See [Authorization & Model Selection](/getting-started/authorizing-with-cline#menu).

1. **Open Cline Settings:** Click the settings gear icon (⚙️) in the Cline panel.
2. **Select Provider:** Choose "OpenAI" from the "API Provider" dropdown menu.
3. **Enter API Key:** Paste your OpenAI API key into the "OpenAI API Key" field.
4. **Select Provider Model:** Choose your desired model from the "Model" dropdown list.
5. **(Optional) Base URL:** If you need to use a proxy or a custom base URL for the OpenAI API, you can enter it here. Most users will not need to change this from the default.

### Tips and Notes

* **Pricing:** Be sure to review the [OpenAI Pricing page](https://openai.com/pricing) for detailed information on the costs associated with different models.
* **Azure OpenAI Service:** If you are looking to use the Azure OpenAI service, please note that specific documentation for Azure OpenAI with Cline may be found separately, or you might need to configure it as an OpenAI-compatible endpoint if such functionality is supported by Cline for custom configurations.

## OpenAI Codex (OAuth)

1. Open Cline settings.
2. Select **OpenAI Codex** from **API Provider**.
3. Click **Sign in with OpenAI** and complete browser OAuth.
4. Return to Cline and choose a model.

Notes:

* No API key entry required.
* Available models depend on your OpenAI plan.
