💡

Key Points

Key Takeaways

  • 1

    Explaining 4 selected ways to use Codex for free in 2026

  • 2

    ChatGPT Plus users can use the CLI without additional cost

  • 3

    Specific steps for completely local operation with Ollama/LM Studio

  • 4

    Also introducing cloud integration methods utilizing Geminis free tier

As of January 2026, I will explain in detail, based on the latest information, how to use the coding AI “OpenAI Codex” for free or at a low cost.

While there used to be API waitlists, it is now integrated within the generative AI ecosystem, making more flexible ways of use possible.

[Latest 2026] 4 Ways to Use Codex for Free

If you are subscribed to a paid plan of ChatGPT Plus or higher (Plus/Pro/Team/Enterprise), you can use the Codex CLI without additional billing . This is a new mechanism introduced after the release of GPT-5 in August 2025.

💡 Pricing Plans
  • ChatGPT Plus : $20/month - Allows for intensive weekly coding sessions - ChatGPT Pro : $200/month - High usage limits that can cover full-time development work

Usage Limits

  • Plus Plan : 30-150 messages every 5 hours
  • Pro Plan : 300-1500 messages every 5 hours

As a guideline, Plus users can cover part-time or hobby work, and Pro users can cover full-time development work.

AI Expert
AI Expert
If you already have a ChatGPT Plus subscription, this is the easiest way. No API key management is needed; you can call Codex from the terminal with just browser authentication.

Setup Steps

  1. Register for a ChatGPT Plus/Pro plan
  2. Run the codex command in the terminal and select “Sign in with ChatGPT”
  3. Log in to your ChatGPT account on the authentication screen that opens automatically in the browser

Method 2: Completely Free Operation with Ollama + Local LLM

By using Ollama as a local LLM launcher and coordinating it with the Codex CLI, you can use it completely free without an API key . It is also ideal when you don’t want to send confidential information to the cloud.

Setup Steps

1. Install Ollama

# macOS
brew install ollama

# Serve
ollama serve

2. Download Models

You can choose from lightweight models to high-performance models provided by Ollama.

# Lightweight model (lightweight operation)
ollama pull qwen:4b

# High-performance model (requires VRAM)
ollama pull gpt-oss:20b

3. Create Codex Configuration File

Create ~/.codex/config.toml (or C:\Users\<username>\.codex\config.toml for Windows).

profile = "qwen-4b"

[model_providers.ollama]
name="Ollama"
base_url = "http://127.0.0.1:11434/v1"

[profiles.qwen-4b]
model = "qwen:4b"
model_provider = "ollama"
💡
Expanding Context Size

When handling large-scale codebases, the default context size may be insufficient. Let’s expand it manually.

# Launch interactive mode
ollama run gpt-oss:20b

# Set context size (expand to 64000 tokens)
>>> /set num_ctx 64000

# Save as a new model
>>> /save gpt-oss-64k:20b

Method 3: Utilize Gemini Free Tier

It is also possible to run the Codex CLI using the free tier of Google’s Gemini API. Gemini 2.5 Pro has a very wide context window and is suitable for large-scale refactoring.

Setup Steps

  1. Get a free Gemini API key from Google AI Studio
  2. Set it in environment variables
# macOS/Linux
export GOOGLE_GENERATIVE_AI_API_KEY="your-api-key"

# Windows
set GOOGLE_GENERATIVE_AI_API_KEY="your-api-key"
  1. Use Open Codex CLI (Fork version) Open Codex CLI is a fork version that supports multiple AI providers like Gemini and Ollama.

Configuration File (~/.codex/config.json):

{
 "provider": "gemini",
 "model": "gemini-2.5-pro-preview-03-25",
 "apiKey": "your-Gemini-API-key",
 "approvalMode": "auto-edit"
}

What about its prowess as a coding AI?

To check the actual behavior of the coding capability of the GPT-4/5 generation, which is the evolution of Codex, the following review is very helpful.

引用: YouTube

▲ Explanation by Nyanta’s AI Channel. Demonstrating autonomous movement in the terminal with comparisons to Claude Code.


Method 4: Local Operation with LM Studio

LM Studio is the easiest local LLM software to introduce based on a GUI. It has an OpenAI-compatible API server function and can easily connect to existing coding tools.

Features

  • Completely Free
  • Easily search and download models via GUI
  • Equipped with OpenAI-compatible server function

LM Studio

LM Studio
LM Studio

Comparison and How to Choose Each Method

Each method has tradeoffs between cost, ease, and performance.

Method Cost Setup Performance Recommendation
ChatGPT Paid Plan $20~/month Easy Best ★★★★★
Ollama (Local) Free Normal Mid-High ★★★★☆
Gemini Free Tier Free Somewhat Complex High ★★★☆☆
LM Studio Free Somewhat Complex Mid ★★★☆☆
Which method fits you?
  • Already subscribed to ChatGPT Plus/Pro

  • 👉 Method 1 is optimal. It has a triple threat of zero cost, high performance, and no setup needed.

  • Want to try completely for free / want to use offline

  • 👉 Method 2 (Ollama) is recommended. You can operate powerful local LLMs while protecting confidential information.

  • Want to load extra-long code

  • 👉 Method 3 (Gemini) is effective. Understand the entire library with a 1-million token class context.

  • Want to manage easily via GUI

  • 👉 Method 4 (LM Studio) . Safe even if you are not good at command line operations.

For those who want to learn AI coding more deeply, the following book is recommended.

Summary

The Codex CLI itself can be downloaded for free, but the LLM usage fees for the backend tend to be a bottleneck. However, as of 2026, choices have significantly increased due to the performance improvement of local LLMs and free tiers/subscriptions bundled by various companies.

Final responsibility for code quality lies with humans, but by mastering these tools, development efficiency will improve dramatically. I first recommend trying with ChatGPT Plus integration or Ollama .