Pricing plans
Codex is included in your ChatGPT Plus, Pro, Business, Edu, or Enterprise plan.
Each plan offers different usage limits for local and cloud tasks, which you can find more details about below.
Refer to our ChatGPT pricing page for details about each plan.
Usage limits
Codex usage limits depend on your plan and where you execute tasks. The number of Codex messages you can send within these limits varies based on the size and complexity of your coding tasks and the model you use. Small scripts or simple functions may only consume a fraction of your allowance, while larger codebases, multi-file projects, or extended sessions that require Codex to hold more context will use significantly more per message.
Note: Code Review usage will not count toward Codex usage limits until November 20th. Reviews triggered through GitHub—including across shared repositories—are waived during this period.
When you hit your usage limit, you can purchase additional ChatGPT credits to keep working. Credits are available on ChatGPT Plus, Pro, Business, Edu, and Enterprise plans.
Usage limits depend on your plan and the model used. Learn more.
For ChatGPT Business, Enterprise, and Edu customers, check out the ChatGPT rate card for more information on credits.
What happens when you hit usage limits?
ChatGPT Plus/Pro users who reach their usage limit can purchase additional credits to continue working without needing to upgrade their existing plan.
For Business, Edu, and Enterprise plans with flexible pricing, you have the option to purchase additional credits for your workspace if you wish to continue using Codex.
What counts as Code Review usage?
Code Review usage only applies when Codex runs reviews through GitHub—for example, when you tag @codex review in a pull request or enable automatic reviews on your repository. Reviews run locally or outside of GitHub count toward your general usage limits instead.
Use an OpenAI API key
You can extend your local Codex usage (CLI and IDE extension) with an API key. API key usage is billed through your OpenAI platform account at the standard API rates, which you can review on the API pricing page.
First, make sure you set up your OPENAI_API_KEY environment variable globally.
You can get your API key from the OpenAI dashboard.
Then, you can use the CLI and IDE extension with your API key.
If you’ve previously used the Codex CLI with an API key, update to the latest version, run codex logout, and then run codex to switch back to subscription-based access when you’re ready.
Use your API key with Codex CLI
You can change which auth method to use with the CLI by changing the preferred_auth_method in the codex config file:
# ~/.codex/config.toml
preferred_auth_method = "apikey"
You can also override it ad-hoc via CLI:
codex --config preferred_auth_method="apikey"
You can go back to ChatGPT auth (default) by running:
codex --config preferred_auth_method="chatgpt"
You can switch back and forth as needed, for example if you use your ChatGPT account but run out of usage credits.
Use your API key with the IDE extension
When you open the IDE extension, you’ll be prompted to sign in with your ChatGPT account or to use your API key instead. If you wish to use your API key instead, you can select the option to use your API key. Make sure it is configured in your environment variables.