Switch Language
Toggle Theme

How to Use Codex: A Complete Beginner Guide to the CLI, IDE Extension, Codex Cloud, and Desktop App

"The OpenAI Codex overview was used to verify Codex positioning, available entry points, and suitable workflows."

When you use Codex for the first time, do not ask it to refactor the whole project. Open the repository first and give it one small task you can verify in about 20 minutes.

Entry Point Overview

OpenAI Codex is not one terminal command or one editor plugin. It is a coding agent that can be used through multiple entry points. In the official documentation you will see the CLI, IDE extension, Codex app, and Codex web/cloud. They share the same underlying capability and authentication model, but they fit different work.

Four Entry Points Compared

Entry pointWhat it isBest forTypical userMain constraint
CLIA coding agent running in your local terminalExisting local repositories, small changes, command-line workflowsHeavy terminal users, CI usersNeeds a local Git repository; file changes are visible locally
IDE ExtensionCodex collaboration in an editor sidebarCurrent editor work, shorter context through open files or selected codeVS Code, Cursor, Windsurf, and JetBrains usersDepends on the editor environment; complex work can be delegated to Cloud
Codex AppA desktop command centerMultiple threads, worktrees, automations, Git managementLocal users handling several tasks in parallelmacOS and Windows are supported; Linux availability should be checked on the official page
Codex Cloud/WebA cloud agent connected to GitHubRemote repositories, PRs, asynchronous tasks, work away from your machineTeam users and remote-repository workflowsEnterprise workspaces may require admin setup

Authentication and Feature Differences

Codex supports two authentication paths, but the available features are different:

AuthenticationAvailable entry pointsCloud feature availabilityBest fit
ChatGPT account (Plus/Pro/Business/Edu/Enterprise)All entry points (CLI/IDE/App/Cloud)Includes GitHub code review, Slack, and other cloud-based featuresIndividual subscribers and teams
API keyCLI, SDK, IDE ExtensionDoes not include GitHub code review, Slack, and other cloud-based featuresCI, automation, and API-billed workflows

Pricing, usage limits, and exact feature access should be checked on the official pricing page and in your account dashboard. If you sign in with an API key and Cloud features are unavailable, that is a surface difference, not a broken setup.

CLI Entry Point

The CLI is a coding agent that runs in your local terminal. It can read code from the selected directory, edit files, run commands, and inspect results, so it works well when you already have a local repository.

CLI Definition and Use Cases

The CLI’s core job is to work inside a local repository: read code, edit files, run tests, run lint, inspect errors, and produce a diff. You do not need to have the file open in an editor. You only need to describe the task in the terminal.

Good fits for the CLI:

  • You already have a local Git repository.
  • The task touches multiple files or needs command-line verification.
  • You want file changes to be visible locally for git diff and commits.
  • You are using CI or script-based automation.

Poor fits for the CLI:

  • You do not have a local repository yet, so you need to clone one first.
  • You only want to edit the currently open file, where the IDE extension is smoother.
  • You need a remote PR workflow, where Cloud is a better fit.

CLI Installation and Sign-In

Installation and sign-in can change over time, so treat this as the high-level flow and check the official CLI page for exact commands:

  1. Choose the installation method from the official CLI page: the current official page provides a standalone installer. Older posts may mention npm installation, but the current official page should win.
  2. Run it for the first time: after installation, run codex and follow the sign-in flow.
  3. Choose the sign-in method: use either a ChatGPT account or an API key. A ChatGPT account covers all surfaces; an API key is limited to CLI, SDK, and IDE extension use, without Cloud features.

The CLI supports macOS, Windows, and Linux. On Windows, use the PowerShell native sandbox or WSL2 depending on the current official guidance.

Common CLI Commands

The CLI has interactive and non-interactive modes. These are the six commands or command groups a beginner should recognize first; names may change, so check the CLI reference when you need exact syntax.

CommandPurposeExample
codexInteractive mode for conversational work in the terminalcodex
codex execNon-interactive mode for CI or scriptscodex exec "fix the CI failure"
codex loginSign in or switch accountscodex login
codex updateUpdate the CLIcodex update
codex doctorCheck environment configuration and common issuescodex doctor
Common flagsTune permissions, model, sandbox, and approval behavior--sandbox read-only, --model, --ask-for-approval

The CLI reference includes more commands and flags, including codex apply, codex cloud, and codex app. Some commands may have different maturity levels. As a beginner, learn interactive mode first, then move to codex exec when you need automation.

Your First CLI Task

The first-task rule is simple: choose an existing repository and give Codex a task you can verify in about 20 minutes.

OpenAI’s best practices recommend a high-quality prompt with four parts:

Prompt partMeaningExample
GoalThe outcome you want”Fix the outdated install command in the README”
ContextThe relevant background”This is a Node.js project. The README mentions npm install, but the project now uses yarn.”
ConstraintsBoundaries for the change”Only edit the README. Do not change other files. After editing, run node README-example.js to confirm the command works.”
Done whenThe verification condition”The README command is updated and node README-example.js prints the expected output.”

Good first tasks:

  • Fix an outdated README command or link.
  • Add a missing test or fix a failing test.
  • Fix a small bug with a clear error message.
  • Clean up a TODO comment.
  • Add a simple type annotation to one module.

Avoid first tasks that:

  • Touch secrets or production data.
  • Require a large refactor or a full new feature.
  • Have no clear acceptance condition, such as “optimize performance.”

CLI Review Checklist

After the CLI finishes, verify the result in this order:

  1. Read the diff: run git diff in the terminal and confirm the change matches the request. Do not rely only on the final “done” message.
  2. Run tests: if the project has tests, run npm test or the relevant command.
  3. Run lint or typecheck: if the project has these checks, make sure no new errors were introduced.
  4. Check command output: if the task required a command to run, confirm the output matches the expected result.
  5. Keep secrets away from the first task: if a task touches sensitive configuration, review whether the change is necessary before letting an agent edit it.

Commit or push only after the checks pass. If the change is wrong, restore it with Git, tighten the prompt, and try again.

IDE Extension Entry Point

The IDE extension lets Codex work in your editor sidebar. It is a good fit when you are already working in the editor. Its advantage is shorter, sharper context: open files, selected code, and explicit @file references, without having to describe the whole project in a terminal prompt.

IDE Definition and Use Cases

The IDE extension does not replace the editor. It embeds Codex as a coding agent inside your editor workflow. The context comes from open files, selected snippets, or files you explicitly reference with @file, so it can be more precise for local edits.

Good fits for the IDE extension:

  • You are working in VS Code, Cursor, Windsurf, or JetBrains.
  • The task is about the current file or a small set of related files.
  • You want to watch changes in the editor as they happen.
  • You need to reference a specific file as context.

Poor fits for the IDE extension:

  • You are not using an editor environment, where the CLI is simpler.
  • The task needs long background execution, where Cloud can take over.
  • The task touches many files or complex command flows, where the CLI or Cloud may be better.

Supported IDEs

The IDE extension supports these editors; check the official IDE page for current availability:

EditorNotes
VS CodeOfficially supported
CursorA VS Code fork compatible with the VS Code extension
WindsurfA VS Code fork compatible with the VS Code extension
JetBrainsSupports Rider, IntelliJ, PyCharm, WebStorm, and related IDEs, subject to official availability

If you work in Cursor or Windsurf, the Codex extension and the editor’s built-in AI features can sit side by side. Codex is another coding agent you can switch to when it fits the task.

IDE Installation and Sign-In

Use the official IDE page for current installation steps:

  1. Install from the extension marketplace: search for the Codex extension in VS Code, Cursor, Windsurf, or JetBrains.
  2. Sign in: use a ChatGPT account or an API key. A ChatGPT account covers all surfaces; an API key does not include Cloud features.

IDE Context

The IDE extension’s main value is editor context:

Context typeWhat it meansExample
Open filesCurrently open files are available as contextOpen example.tsx, and Codex can inspect it directly
Selected codeThe selected snippet becomes contextSelect a function and ask Codex to explain or refactor it
@file referenceExplicitly reference another file by name@example.tsx please check the component's type definitions
Reasoning effortAdjust how much reasoning the agent useslow/medium/high; use higher effort for harder tasks

The IDE extension also supports Chat, Agent, and Agent Full Access modes. The difference is permission and automation level. Start with the default Agent mode, then adjust once you understand the trade-offs.

Delegating from IDE to Cloud

The IDE extension can delegate work to Codex Cloud. Use that when:

  • The task may run for a long time.
  • The task involves a remote repository.
  • You need to leave the machine while work continues.
  • You want a complex task to run in the background and review the result later.

Common slash commands may include the following; command names can change, so check the IDE features page:

CommandPurpose
/cloudDelegate the current task to Cloud
/localRun the task locally
/reviewReview the base branch, uncommitted changes, or a commit
/statusCheck Cloud task status

After you use /cloud, the IDE shows task status. When the Cloud task finishes, return to review the diff and result.

Codex App Entry Point

Codex app is a desktop command center for multi-threaded work and Git management. It is not another chat window. It can pick up history and configuration from the CLI and IDE extension, which makes it useful for continuing work on an existing project.

App Definition and Use Cases

The app focuses on multiple threads, worktrees, automations, and Git operations. It is useful when you need parallel tasks, a diff pane, and Git integration in one local workspace.

Good fits for the app:

  • You need several task threads at the same time.
  • You need isolated parallel work through worktrees.
  • You want a visual diff pane and Git operations.
  • You want a desktop workflow with an integrated terminal.

Poor fits for the app:

  • You only want to edit the current file, where the IDE extension is smoother.
  • You do not have a local repository, in which case use Cloud or clone the repo first.
  • You only need one quick task, where the CLI is faster.

App Platform Support

Codex app supports macOS and Windows. Check the official app page for Linux availability.

App Installation and Sign-In

Use the official app page for current steps:

  1. Download and install: get the macOS or Windows installer from the official app page.
  2. Sign in: use a ChatGPT account or an API key. Some features may be unavailable with an API key, depending on the official guidance.
  3. Choose a project: the first launch asks you to select a local project directory.

App Thread Modes

The app provides three thread modes: Local, Worktree, and Cloud.

Thread modeWhat it doesBest for
LocalWorks directly in the current project directorySmall changes, single-threaded work, the default first message
WorktreeCreates an isolated worktree for the threadParallel tasks, isolated changes, avoiding conflicts
CloudDelegates the task to Codex CloudRemote repositories, PRs, long-running tasks

Save the detailed worktree workflow for a later guide. As a beginner, start with Local mode.

App Core Features

The app’s core features include:

FeatureWhat it does
Diff paneLets you visually inspect file changes and stage or revert chunks
Git operationsSupports commit, push, PR creation, and related Git flow actions
Integrated terminalCmd+J on macOS opens the terminal; check the official page for current shortcuts
IDE syncIDE extension and app workflows can sync within the same project
Shared MCP settingsCLI, IDE, and app can share MCP settings

The app also includes an in-app browser, but it does not use pages that require your logged-in browser profile. Open login-gated pages in an external browser when needed.

Codex Cloud/Web Entry Point

Codex web/cloud connects to a GitHub account and lets Codex work in a remote repository and create PRs. It fits team workflows, remote repositories, and tasks you want to keep running while you are away from your computer.

Cloud Definition and Use Cases

Cloud is about remote repositories, PRs, and asynchronous work. It creates a cloud container, checks out the repository, runs setup scripts, executes the task, and returns a diff and response.

Good fits for Cloud:

  • Remote repositories that you do not want to modify locally.
  • PR flows where Codex should create or review a PR.
  • Work that should continue while you are away.
  • Team workflows with review and collaboration.

Poor fits for Cloud:

  • Small local changes, where the CLI or IDE extension is better.
  • Your very first task, which should be verified locally first.
  • Highly interactive tasks, because Cloud is asynchronous.

Good Cloud Tasks

Cloud works well for these task types:

Task typeNotes
PR reviewReview a PR in a remote repository
Complex or long-running workRun tasks that need more time
Parallel tasksDelegate several tasks at the same time
Remote repository changesMake changes without touching your local checkout

Do not send a large refactor or full feature to Cloud on day one. First use the CLI or IDE locally, learn how the result looks, then move suitable tasks to Cloud.

Enterprise workspaces may need admin setup. Check the official Cloud page and your workspace policy.

Cloud Flow

A Cloud task roughly follows five steps:

  1. Create a container: Cloud creates the runtime environment.
  2. Check out the repository: it checks out the GitHub repository.
  3. Run the setup script: it runs the configured setup script, if one exists.
  4. Execute the agent loop: the agent runs commands, checks results, and continues until the task is done.
  5. Return the diff and answer: the finished task shows the diff and a response.

Container caching can last up to 12 hours. Check the official Cloud environments page for the current cache policy.

Cloud Security Notes

Cloud has a few important security boundaries:

Security itemWhat it means
Secrets are only available during setupSecrets are available to setup scripts and removed before the agent phase. Do not make the agent phase depend on scripts that read secrets.
The agent phase has no internet by defaultInternet access is off by default during the agent phase, though limited or unrestricted access can be configured. Do not assume the agent can reach external services.
Cache lasts up to 12 hoursContainer cache is not long-term storage. Do not assume state will persist indefinitely.

For deeper security configuration, use the later guide on permissions, sandboxes, and secrets.

Next Steps

After the first task, if Codex keeps making the same mistake on the second or third run, write an AGENTS.md project guide. AGENTS.md gives coding agents project-specific instructions so you do not repeat the same context in every prompt.

Recommended follow-up topics:

  • AGENTS.md project rules: preserve project guidance and reduce repeated context.
  • Worktree isolation: run multiple tasks in parallel without mixing changes.
  • Cloud workflow: remote repositories, PRs, and environment setup.
  • Permissions, sandboxes, and secrets: security boundaries and configuration.
  • Three-tool comparison: Codex vs Claude Code vs Cursor in real projects.
  • codex exec automation: CI calls and script-based automation.

Related BetterLink articles:

Run your first small coding task with Codex

Use a local repository, a small task, a clear prompt, diff review, and tests to make your first Codex run easy to verify.

⏱️ Estimated time: 30 min

  1. 1

    Step1: Choose an existing Git repository

    Make sure the working tree is clean or has a checkpoint, and keep production data and real secrets away from the first task.
  2. 2

    Step2: Pick the right entry point

    Use the CLI or IDE extension for a small local fix, open Codex app for multi-threaded work, and use Cloud later for PR-oriented remote work.
  3. 3

    Step3: Write the four-part prompt

    Include Goal, Context, Constraints, and Done when, plus any failure output, relevant directories, and forbidden changes.
  4. 4

    Step4: Approve only actions you understand

    Review the plan and diff before allowing file edits, command execution, or dependency changes.
  5. 5

    Step5: Run checks and review the risk

    Run tests, lint, or typecheck, then ask Codex to summarize what changed, what was not verified, and what still needs human review.

FAQ

What is the difference between Codex CLI, the IDE extension, Codex app, and Codex Cloud?
The CLI is best for local terminal tasks, the IDE extension is best for the current file or selection, Codex app is better for multi-threaded Git work, and Cloud is better for remote repositories and PRs.
Where should I start with Codex for the first time?
If you already have a local project, start with a small task in the CLI or IDE extension. It is faster to inspect, easier to verify, and does not require Cloud setup on day one.
Do I need an API key to use Codex?
Not necessarily. Codex can use a ChatGPT account. API keys are useful for CLI, SDK, IDE extension, and automation scenarios, but they do not include some cloud-based features.
Can Codex modify my code automatically?
In agent-style workflows, Codex can edit files and run commands. You should still control the scope with permissions, diff review, tests, and normal Git checkpoints.
Should a beginner use Codex Cloud on the first day?
Not for a small local fix. Cloud is a better fit after the environment is configured and the task needs remote repositories, background execution, team review, or a PR.
How should I choose between Codex, Cursor, and Claude Code?
For this entry guide, choose by entry point and workflow first. A serious comparison needs the task type, collaboration model, cost, context, and security boundary.

14 min read · Published on: Jun 24, 2026 · Modified on: Jun 24, 2026

Comments

Sign in with GitHub to leave a comment