Skip to content

Run OpenAI Codex CLI on Your Phone (iPhone + Android)

The CLI is already installed in a cloud terminal. Sign in with a device code and run it.

Updated 5 min read Cosyra team

Cosyra Terminals screen with the New menu open, showing New terminal and Open folder
Codex CLI welcome screen on a phone with three sign-in choices
Codex CLI device code sign-in on a phone, with a link and a one-time code

The Codex CLI runs on your phone through Cosyra for iPhone or Cosyra for Android. The CLI itself runs in a cloud Linux workspace, where it is already installed. Your phone is the terminal.

This page is about the command line: starting it, the sign-in that works from a mobile device, and the commands worth knowing. If you only want the quickest way in, read Codex on your phone. The screenshots are from the Cosyra 2.8.5 iPhone app, taken in October 2026.

What you need

Run the Codex CLI on a mobile device

Step 1

Open a terminal in Cosyra

On Terminals, tap New and choose New terminal. You get a shell in your workspace home folder.

The Codex shortcut does this and starts the CLI in one tap. Use it when you do not need a shell first.

Cosyra Terminals screen with the New button pressed, offering New terminal and Open folder

Step 2

Start the Codex CLI

Type the command and press return:

codex

There is nothing to install. On first run the CLI asks how you want to sign in:

  • Sign in with ChatGPT
  • Sign in with Device Code
  • Provide your own API key
Codex CLI first run: Sign in with ChatGPT, Sign in with Device Code, or Provide your own API key

Step 3

Sign in with a device code

Move down to Sign in with Device Code with the arrow keys in the toolbar and press return. The CLI prints a link and a one-time code.

Tap the link, sign in to ChatGPT in the browser and enter the code. It expires after 15 minutes. Back in Cosyra the CLI moves on by itself.

This is the sign-in to pick on a phone. The first option expects a browser on the same machine as the CLI, and here the CLI is in the cloud.

Codex CLI asking you to open auth.openai.com/codex/device and enter a one-time code that expires in 15 minutes

Step 4

Or use an API key

Choose Provide your own API key to pay for what you use through your OpenAI account. Paste the key when the CLI asks for it. It is stored in your workspace, not on the phone.

Step 5

Run Codex in a project

Change into a repository and start the CLI there:

git clone https://github.com/you/your-repo.git
cd your-repo
codex

You can pass the prompt on the command line, which saves typing in the interactive screen:

codex "explain what this repo does"

Commands worth knowing on a phone

Command What it does
codex --version Shows the installed release.
codex "prompt" Opens the CLI with that prompt already sent.
codex exec "prompt" Runs one task without the interactive screen and exits.
codex resume Picks up an earlier session.
/model Inside the CLI, switches the model.
/status Inside the CLI, shows the account and session details.

An AGENTS.md file in the repository tells Codex how the project is built and tested. It is worth adding before a long task, because Codex reads it at the start of every session.

The keys the CLI needs

The Codex CLI is driven with Esc, Ctrl and the arrow keys. Cosyra puts those in a toolbar above the keyboard, with Tab, Alt and a microphone for dictation. The docs list every toolbar key.

The terminal lives in the workspace, so a run carries on when you lock the phone. Open the app again and the output is waiting.

Questions

Can the Codex CLI run on a phone?

Not on the phone itself. The Codex CLI needs a Linux or macOS shell. Cosyra gives your phone a cloud Linux workspace where the CLI is already installed, and you drive it from the app's terminal.

Why use the device code sign-in on mobile?

Sign in with ChatGPT expects the browser to be on the same machine as the CLI. On a phone the CLI is in the cloud and the browser is in your hand, so the device code is the sign-in that fits: you open a link on any device and type a short code.

Do I need to install the Codex CLI first?

No. It is in the workspace already. Run codex --version to see which release you have.

Can I run Codex CLI without the interactive screen?

Yes. codex exec "your prompt" runs one task, prints the result and exits. It is useful on a mobile device because there is no menu to steer.

Does the same setup work on iPhone and Android?

Yes. The CLI runs in the cloud workspace, so the commands and your sign-in are the same from either app.

What does it cost?

Cosyra is a subscription: Core is $20 a month and Pro is $30 a month. Eligible new users can start a 7-day free trial in the App Store app. Codex usage is separate: it comes from your ChatGPT plan or is billed to your OpenAI API key.