OpenCodevsCodex

OpenCode and Codex CLI are both open-source terminal coding agents. OpenCode works with 75+ model providers, and Codex is OpenAI’s own agent, which you can use with a ChatGPT plan. This page compares their published benchmark scores, cost and time per task, features and pricing.

Updated November 2, 2026

OpenCode vs Codex benchmark scores (Artificial Analysis)

  • Codex + GPT-6 Astra
  • Codex + GPT-6.1 Sol
  • OpenCode + GLM-5.3

Coding Agent Index

  • 55
  • 54
  • 49

Terminal-Bench 4.0 (%)

  • 56
  • 53
  • 40

FrontierCode v1.1 (%)

  • 49
  • 49
  • 48

SWE-Atlas-QnA (%)

  • 59
  • 60
  • 59
Artificial Analysis Coding Agent Index v2.0 and its three benchmarks, at maximum reasoning effort. Higher is better.[1]
  • Artificial Analysis ran every setup at maximum reasoning effort. It tested Codex with several OpenAI models and DeepSeek V4.1 Flash, and OpenCode with GLM-5.3 only, so each gap comes from the agent and the model together.[1]
  • The largest gap is on Terminal-Bench 4.0: 56% for Codex with GPT-6 Astra and 40% for OpenCode with GLM-5.3. On FrontierCode and SWE-Atlas-QnA, all three setups are within one point of each other.[1]

Cost, time and tokens per task

Average cost, time, tokens and turns per task, measured by Artificial Analysis
Agent and modelCost per taskTime per taskTokens per taskTurns per task
Codex + GPT-6 Astra$7.0424.8 min3.2M39.4
Codex + GPT-6.1 Sol$1.5023.7 min3.9MNot reported
OpenCode + GLM-5.3$5.2356.2 min15.9M111.5
  • OpenCode with GLM-5.3 cost less per task than Codex with GPT-6 Astra, but took more than twice as long and used about five times as many tokens.[1]
  • Most of those tokens were read from the cache. Artificial Analysis reports a 95% cache hit rate for OpenCode and 93% for Codex.[1]
  • Codex with GPT-6.1 Sol cost about a fifth as much as with GPT-6 Astra and scored one index point lower.[1]

Codex on Terminal-Bench 4.0, by model

  1. Codex + GPT-6.1 Sol58.2% · $634
  2. Codex + GPT-6 Astra58.2% · $3.3k
  3. Codex + GPT-6 Sol49.4% · $1.5k
  4. Codex + GPT-6 Luna16.4% · $72
Share of 330 Terminal-Bench 4.0 trials solved at maximum reasoning effort, with the cost of each full run. Leaderboard checked November 2, 2026.[2]
  • GPT-6.1 Sol and GPT-6 Astra both solved 58.2% of the 330 trials. The GPT-6.1 Sol run cost $634, about a fifth of GPT-6 Astra’s $3.3k.[2]
  • OpenCode has no entry on the Terminal-Bench 4.0 leaderboard, so the Artificial Analysis results above are the only independent benchmark we found that tests both agents.[2][1]

When to use OpenCode or Codex

You want to use many model providers

OpenCode

75+ providers and local models

OpenCode treats OpenAI as one provider of many, and keeps the same tools and agents when you switch.[21]

You want built-in LSP and permission rules

OpenCode

Diagnostics and allow, ask or deny

Language server errors go back to the agent, and permissions are set per tool in opencode.json.[29][27]

You already pay for ChatGPT

Codex

Included from Plus to Enterprise

Codex comes with paid ChatGPT plans, and OpenAI documents the usage limits for each one. OpenCode can also sign in with Plus or Pro.[6][21]

You want an OS-level sandbox

Codex

Seatbelt, bubblewrap, Windows sandbox

By default Codex can only write inside the workspace, and the operating system enforces it.[9]

You want to embed an agent in your code

Codex

TypeScript SDK and GitHub Action

Codex has an SDK, a non-interactive mode for scripts, and an official GitHub Action.[14][15]

OpenCode vs Codex features

Both agents have subagents, plan mode, MCP and permission prompts. The main differences are model choice, Codex’s operating-system sandbox, and OpenCode’s language server support.

SupportedPartial or with caveatsNot supported

License and models

License[18][4]

OpenCodeMIT

CodexApache-2.0

Model choice[21][7]

OpenCode75+ providers and local models

CodexOpenAI first; others by config

ChatGPT plan sign-in[21][6]

OpenCodePlus and Pro

CodexPlus to Enterprise

Instruction files[28][8]

OpenCodeAGENTS.md; CLAUDE.md fallback

CodexAGENTS.md

Agent capabilities

Subagents[24][10]

OpenCodeGeneral and Explore

CodexOn by default

Plan mode[24][11]

OpenCodePlan agent

Codex/plan

Sandbox[27][9]

OpenCodeNo OS sandbox

CodexOS-enforced

Permission prompts[27][9]

OpenCodeAllow, ask, deny

CodexOn request or never

MCP[30][12]

OpenCodeLocal and remote

CodexLocal and remote

Language servers[29][12]

OpenCodeBuilt in

CodexNot built in

Web search[25][17]

OpenCodeSome providers

CodexCached by default

Sessions[34][11]

OpenCodeResume, undo and redo

Codexcodex resume

Interfaces

Ways to run it[20][31][32][13][14]

OpenCodeTerminal, desktop, IDE, server

CodexTerminal, ChatGPT app, IDE, SDK

GitHub[33][15][16]

OpenCode/oc comments

CodexAction and @codex review

OpenCode and Codex pricing and plans

Both agents are free and open source. You pay for the model, through an API key or a subscription.

OpenCode

OpenCode is MIT-licensed. You pay your model provider or one of OpenCode’s plans.

  • Your own API keyProvider rates

    75+ providers through the AI SDK and Models.dev, including OpenAI, plus local models.[21]

  • ChatGPT Plus or ProWhat you already pay

    Choose the ChatGPT Plus/Pro option when you connect OpenAI. GitHub Copilot and GitLab Duo also work.[21]

  • Go$10/mo

    Open models and GPT-6 Luna with usage caps. Go Plus is $40/month, and Go Teams is $20 per member per month.[22]

  • Pay as you goPer request

    OpenCode’s own provider, billed per request from prepaid credits. It includes GPT-6.1 Sol and GPT-6 Astra.[23]

Codex

Codex CLI is Apache-2.0 licensed. You sign in with a ChatGPT plan or an API key.

  • ChatGPT Plus$20/mo

    Includes Codex. OpenAI estimates 15 to 160 local messages per five hours on GPT-6.1 Sol, depending on the task.[6]

  • ChatGPT ProFrom $100/mo

    Tiers at $100, $200 and $500 a month, with no five-hour limit for now.[6]

  • ChatGPT Business$20/user/mo

    Billed annually for two or more users, or $25 billed monthly. Enterprise and Edu are priced through sales.[6]

  • OpenAI API keyAPI rates

    Billed per token instead of from plan credits, without cloud features such as GitHub code review.[5][6]

  • Other providersProvider rates

    Azure, Amazon Bedrock and other providers in config.toml, or local models through Ollama or LM Studio with --oss.[7]

GPT-6.1 Sol price per million tokens, by seller

OpenCode’s pay-as-you-go provider charges the same as OpenAI’s API for GPT-6.1 Sol, up to 272K tokens of context.

SellerInputOutputCached input
OpenAI API[3]$2.00$10.00$0.10
OpenCode pay as you go, up to 272K tokens[23]$2.00$10.00$0.10
OpenCode pay as you go, above 272K tokens[23]$4.00$15.00$0.20

Running OpenCode or Codex in the cloud

Both agents run on your own computer by default, so they stop when it sleeps or shuts down. Replicas runs each task in its own cloud VM with your repositories cloned.

  1. 01

    Pick either agent

    Choose OpenCode or Codex for a chat, an automation, or a task started from the CLI or API.[35][36]

  2. 02

    Use your ChatGPT plan or keys

    Codex can use your ChatGPT subscription through replicas codex-auth, an OpenAI API key, Microsoft Foundry or an OpenAI-compatible endpoint.[36]

  3. 03

    Start tasks from your tools

    Start a task from the dashboard, Slack, Linear, GitHub, the CLI, the API and more. The agent opens the pull request when it’s done.

  4. 04

    Compare the results

    Send the same task to both agents and review the two pull requests side by side.

Common questions

Sources and methodology

Benchmark results come from Artificial Analysis and the Terminal-Bench 4.0 leaderboard, checked on November 2, 2026. Feature and pricing details come from OpenAI’s Codex docs and OpenCode’s docs, checked the same day.

Artificial Analysis tested each agent with a different model, so its results compare the agent and the model together. Prices and plans change often, so confirm with each project before you buy.

If you spot an error, email founders@replicas.dev and we'll fix it.

  1. 1Codex vs Opencode: coding agent comparison · Artificial Analysis
  2. 2Terminal-Bench 4.0 leaderboard · Terminal-Bench
  3. 3OpenAI API pricing · OpenAI
  4. 4openai/codex repository and license · GitHub
  5. 5Codex authentication · OpenAI
  6. 6Codex pricing and plan features · OpenAI
  7. 7Codex model providers · OpenAI
  8. 8Codex AGENTS.md instructions · OpenAI
  9. 9Codex sandboxing and approvals · OpenAI
  10. 10Codex subagents · OpenAI
  11. 11Codex slash commands · OpenAI
  12. 12Codex CLI · OpenAI
  13. 13Codex IDE extension · OpenAI
  14. 14Codex SDK · OpenAI
  15. 15Codex GitHub Action · OpenAI
  16. 16Codex code review in GitHub · OpenAI
  17. 18anomalyco/opencode repository and license · GitHub
  18. 19OpenCode intro and install · OpenCode
  19. 20Download OpenCode · OpenCode
  20. 21OpenCode providers · OpenCode
  21. 22OpenCode Go · OpenCode
  22. 23OpenCode Zen · OpenCode
  23. 24OpenCode agents · OpenCode
  24. 25OpenCode tools · OpenCode
  25. 26OpenCode CLI · OpenCode
  26. 27OpenCode permissions · OpenCode
  27. 28OpenCode rules (AGENTS.md) · OpenCode
  28. 29OpenCode LSP servers · OpenCode
  29. 30OpenCode MCP servers · OpenCode
  30. 31OpenCode IDE and ACP support · OpenCode
  31. 32OpenCode server · OpenCode
  32. 33OpenCode GitHub integration · OpenCode
  33. 34OpenCode TUI commands · OpenCode
  34. 35OpenCode in Replicas · Replicas
  35. 36Codex in Replicas · Replicas