GuidesHosting choices

Pi vs Codex: an open agent for any model, or OpenAI's own

Pi 1.5.2 and Codex 0.170.0 compared: licence, models and ChatGPT plans, sandbox and approvals, skills and MCP, scripted runs, and signing in on a server.

November 18, 2026The Everpod team
The short answer

Both are free and open source, Codex under Apache-2.0 and Pi under MIT, and both can sign in with a ChatGPT account. Codex is OpenAI’s agent: built around OpenAI’s models and your ChatGPT sign-in, it runs every command inside a bubblewrap sandbox on Linux and asks before stepping outside it. Pi is a deliberately small agent that talks to 15-plus providers, never asks before it acts, and has no sandbox of its own; you add guardrails as extensions or run it in a container. Pick Codex if OpenAI’s models are what you want and you would like the guardrails already there; pick Pi if you want to move between labs’ models and shape the agent yourself. As of November 18, 2026: Codex 0.170.0, Pi 1.5.2.

Side by side

Codex 0.170.0Pi 1.5.2
Licence
Apache-2.0MIT
Models
OpenAI by default; Ollama, LM Studio, Bedrock, Google Cloud and custom endpoints by config“15+ providers, hundreds of models”
How you pay
A ChatGPT plan, or an OpenAI API key per tokenWhichever provider you connect, by key or by sign-in
Sandbox
bubblewrap and seccomp on Linux, network offNone built in
Asks before acting
Only to leave the sandbox, by defaultNever
Scripted runs
codex exec, read-only by defaultpi -p, all default tools
Instructions
AGENTS.mdAGENTS.md or CLAUDE.md
Sign-in on a server
codex login --device-authpi auth login <provider> --no-browser
Update
codex updatepi update

Licence

Unlike Claude Code, Codex is open source: the openai/codex repository is under the Apache License 2.0, and the npm package @openai/codex says the same. Pi’s repository is MIT. Either can be read, forked and patched, so the licence rarely decides between them. What differs is who steers: Codex is OpenAI’s client for OpenAI’s service, and Pi is a harness whose README says it “ships with powerful defaults but skips features like sub-agents and plan mode.” The guide to Pi covers what it leaves out and why.

Models, plans and what it costs

Codex is OpenAI-first. Signed in with ChatGPT, it runs the models your plan includes; on an API key, OpenAI’s auth page says it bills at “standard API pricing instead of included ChatGPT plan credits.” It can leave OpenAI: its advanced config page reserves built-in providers named openai, ollama, lmstudio, amazon-bedrock and gcp, runs a local model through Ollama or LM Studio with --oss, and takes other endpoints as [model_providers.<id>] entries in ~/.codex/config.toml, with a Mistral endpoint among its examples. Those keys are ignored in a project’s own config, so a repository cannot redirect your agent to another endpoint.

Pi has no home provider. Its site lists Anthropic, OpenAI, Google, Azure, Bedrock, Mistral, Groq, Cerebras, xAI, OpenRouter, Ollama and more, connected by API key or by signing in. Pi itself is free; the bill is whichever provider you point it at.

Both sign in to a ChatGPT account, and the two do it differently. In Codex it is the main route: which ChatGPT plans include Codex sets out what each plan from Free to Enterprise gets, with Plus at $20 a month on OpenAI’s pricing page. Pi signs in to a ChatGPT account through its own OpenAI sign-in provider, which sends you to the same device page as Codex. OpenAI’s Sign in with ChatGPT page sorts outside apps into three lists: “Apps with ChatGPT plan usage”, “Apps with sign-in only”, and “Open-source integrations”, which names OpenClaw, OpenCode, Pi and T3 and says nothing further about them. Its general rules are that “eligible ChatGPT Go, Plus, Pro, and Business subscribers can also choose to use their ChatGPT plan for AI requests”, that “App usage counts toward your existing plan limits”, and that “Connecting an app does not add a new allowance.” By those rules, whatever an app draws from your plan comes out of the same allowance Codex uses.

Sandbox and approvals

This is the sharpest difference. Codex sandboxes the commands it runs. OpenAI’s security page says “Linux uses bwrap plus seccomp by default” and that “the agent runs with network access turned off.” In a Git repository the default is Auto: it may edit the working folder and run commands there without asking, and asks before anything the sandbox would block, such as a write elsewhere or a download. Outside version control it starts read-only. .git stays read-only even inside the writable folder. The modes run from read-only to danger-full-access, and --ask-for-approval never turns the questions off.

On a server, the sandbox is also the part most likely to need work: on Ubuntu 24.04 bubblewrap cannot create its user namespace until AppArmor allows it, and every command fails until then. Codex on a Linux server has the fix, and each bubblewrap warning and error its causes.

Pi has neither. Its security guide says Pi “does not ask for approval before every tool call”, tells you to “Treat model-generated commands and code as untrusted”, and calls running it inside a container, virtual machine or sandbox “usually the strongest practical option.” What you have instead: a confirmation step as an extension, which Pi’s docs list as an example use, and the choice of tools for a run. Leaving out bash, edit and write gives a run that can only look, as in the CLI reference’s own example:

pi --tools read,grep,find,ls --print "Review this project"
Copied

Pi does ask one question: whether to trust a project before loading its .pi/ settings, extensions, skills and MCP servers. That decides what loads, not what the agent may touch.

Skills, MCP and instructions

The two are closer here than anywhere else, and much of a setup carries across.

Scripted and scheduled runs

codex exec and pi -p both run one prompt and print the final answer, and both have a JSON event stream (codex exec --json, pi --mode json). They start from opposite ends.

Pi also has an RPC mode, which takes commands on standard input from another program, for driving it from your own tool.

Signing in on a server with no browser

Both use a device code, and for a ChatGPT account both send you to the same OpenAI page, auth.openai.com/codex/device, where you enter a one-time code from any phone or laptop within 15 minutes:

codex login --device-auth                  # Codex
pi auth login <provider> --no-browser      # Pi; pick its ChatGPT sign-in
Copied

For Codex, device-code sign-in has to be switched on first, in ChatGPT’s security settings for a personal account or by an admin for a workspace; the device-code guide covers the message you get while it is off. pi auth login, new in 1.5.1, takes any provider: with --no-browser it uses “the provider’s other sign-in method, such as a device code, for example over SSH”, and with --api-key it saves a key without echoing it; signing Pi in on a server goes provider by provider.

Codex keeps its sign-in in ~/.codex/auth.json, which OpenAI’s auth page calls a plaintext file, or in the system’s credential store if you configure one; Pi keeps keys and tokens in ~/.pi/agent/auth.json. Run both as one user and each can read the other’s file. One clash on a shared machine: Pi’s browser sign-in for a ChatGPT account listens on port 1455, the same port as codex login, and its source notes it falls back to a pasted redirect URL when Codex holds it.

Installing and updating

curl -fsSL https://chatgpt.com/codex/install.sh | sh     # Codex
curl -fsSL https://pi.dev/install.sh | sh                # Pi
Copied

Both also come from npm: npm install -g @openai/codex needs Node.js 16 or newer, and npm install -g --ignore-scripts @earendil-works/pi-coding-agent needs 22.19 or newer. Each updates itself with one command, codex update (“Update Codex to the latest version.”) and pi update, which with no target updates Pi rather than its packages. The detail, and what to do when an update fails, is in updating Codex and installing Pi on Linux.

Who each fits

Neither choice locks you in: they share skills folders and MCP setup, and both sign in to a ChatGPT account. For the same comparison against other agents, see Pi vs OpenCode and Codex vs Claude Code.

Run Claude Code, Codex, OpenCode, Pi, Hermes or OpenClaw on an always-on developer pod.

A developer pod is a permanent cloud computer (VPS), set up and secured for you, with your pick of Claude Code, Codex, OpenCode, Pi, Hermes and OpenClaw installed. Run more agents at once than your laptop can hold, and keep them working when it’s closed. From $24 a month, built in about ten minutes.