In late April 2026, OpenAI introduced a feature via Codex CLI 0.128.0 that has the developer community buzzing: Codex Goal mode (/goal). This isn't your typical "one prompt, one response" interaction; it's a genuine autonomous agent loop. You set a goal (e.g., "Migrate this Python project from Pydantic v1 to v2 and ensure all tests pass"), and Codex automatically enters a continuous cycle of plan → act → test → review → iterate. It won't stop until the job is done or your token budget is exhausted.
However, many developers in China have run into three common questions: Is Goal mode locked behind a ChatGPT subscription? Is the $100/month Pro plan actually worth it? Can an API proxy service run Goal mode? The answers to these questions will determine whether you can truly leverage this powerful new feature.
In this article, we’ll break down the Codex Goal mode from three perspectives: how it works, subscription options, and how to use it effectively in China, providing you with a practical, actionable guide.

1. What is Codex Goal Mode: A True Autonomous Task Agent
To understand the value of Codex Goal mode, we first need to clarify how it differs from the standard Codex mode.
1.1 Core Differences: Goal Mode vs. Standard Codex Mode
Standard Codex mode is a "single-turn task": you provide a prompt, Codex gives a response, and it stops once finished. If the task isn't complete, you have to manually follow up, point out issues, and tell it to continue.
Goal mode is "persistent goal-driven": you define a verifiable completion goal, and Codex automatically loops through execution until it evaluates that the goal has been achieved (or the budget is exhausted). You don't need to touch your keyboard throughout the entire process.
| Comparison Dimension | Standard Codex Mode | Codex Goal Mode |
|---|---|---|
| Task Granularity | Single-turn prompt | Long-horizon goal |
| Interruption Recovery | Stop on interrupt | Resume supported; goal state is persistent |
| Failure Handling | Stop on failure | Automatic plan → act → test → review → iterate |
| Termination Condition | Single response completion | Goal verified / Token budget exhausted / Manual clear |
| Use Cases | Write a function, fix a bug | Refactoring, migration, multi-file feature dev |
| Authentication | API key or ChatGPT subscription | Requires ChatGPT subscription |
| Start Command | codex "your request" |
codex then enter /goal in TUI |
As you can see, Goal mode isn't just a parameter change; it's an upgrade to the Codex agent paradigm: evolving from a "tool-based assistant" to an "autonomous agent."
💡 Key Reminder: The ChatGPT subscription requirement for Goal mode is central to our discussion. This means using an official OpenAI API key or a third-party API proxy service will not enable the
/goalcommand. Chapter 6 of this article will explain why in detail.
1.2 The 5 Core Features of Goal Mode
Based on the Codex CLI 0.128.0 release notes, Goal mode includes these 5 engineering-grade features:
- Persistent Goal: Goal state is saved in the app-server, allowing you to resume across sessions and terminals.
- Budget Aware: When the token budget is exhausted, it performs a "soft stop," is marked as
budget_limited, and triggers a wrap-up steering instead of an abrupt termination. - TUI Console: You can directly create, pause, resume, or clear the current goal within the TUI.
- Runtime Continuation: No need to type on every turn; the CLI automatically continues the work.
- Interruption Friendly: You can interrupt with Ctrl+C; the Goal state is automatically preserved and will resume when you re-enter the TUI.
Combined, these 5 features give Goal mode the engineering viability to "run overnight," rather than being just a demo-level concept.
2. How Codex Goal Mode Works: Implementing the Ralph Loop
OpenAI internally refers to the Goal mode loop as the Ralph Loop. It's not just a simple "retry on failure," but a closed loop that includes evaluation, planning, and testing.
2.1 The 5-Stage Loop of Goal Mode
In every cycle, Codex completes the following 5 stages:

Here is what happens in each stage:
- Plan: Codex breaks the high-level goal into a list of executable sub-tasks and defines success criteria.
- Act: Modifies code, installs dependencies, and executes shell commands according to the plan.
- Test: Runs unit tests, linters, and build commands, collecting failure information.
- Review: Evaluates whether current progress is approaching the goal and identifies new blockers.
- Iterate: Generates the next Plan based on the Review results and returns to the first step.
2.2 Termination Conditions for Goal Mode
Not every loop runs indefinitely. Goal mode has 3 clear termination conditions:
- Goal Achieved: Codex self-evaluates that all success criteria are met → outputs a final summary and exits.
- Token Budget Exhausted: Triggers a
budget_limitedsoft stop; Codex uses remaining tokens to wrap up, writes a progress report, and exits. - Manual Clear: Input
/goal clearin the TUI or choose to terminate afterCtrl+C.
⚠️ Budget Control Tip: The default token budget may be exhausted quickly in large projects. It's recommended to explicitly set a budget limit using
/goal budget <tokens>to prevent Codex from consuming excessive tokens in the wrong direction due to a misjudgment.
3. Getting Started with Codex Goal Mode: 5 Steps to Autonomous Tasks
Theory is fine, but let's get to the practical steps you can follow right now. Just a heads-up: you'll need a ChatGPT Pro subscription or higher to get started (see Chapter 5 for details).
3.1 Step 1: Upgrade Codex CLI to 0.128.0+
Goal mode was introduced in Codex CLI 0.128.0, so older versions won't work. First, check your version:
codex --version
# If it's lower than 0.128.0, upgrade it:
npm install -g @openai/codex@latest
# Or via brew
brew upgrade codex
3.2 Step 2: Authenticate with Your ChatGPT Subscription
Goal mode requires authentication via your ChatGPT subscription (not an API key):
codex login
# Select "Sign in with ChatGPT"
# Your browser will open an authorization page; log in with your ChatGPT Pro account
Once logged in, Codex will deduct usage from your subscription plan's quota—it won't charge you separately per API token.
3.3 Step 3: Enter the TUI and Define Your Goal
cd /your/project
codex
# Once inside the TUI, enter:
/goal Migrate this codebase from Pydantic v1 to v2, fix all type errors, and ensure all tests pass.
3 Principles for writing a great Goal:
- Goals must be verifiable: Use criteria like "all tests pass" or "no lint errors" rather than subjective ones like "make the code more elegant."
- Define clear boundaries: For example, "only modify the src/ directory, do not touch tests/," to prevent Codex from overstepping.
- Set exit conditions: If you're worried about runaway costs or loops, add a constraint like "stop if any step fails more than 3 times."
3.4 Step 4: Monitor Codex's Autonomous Execution
After setting the Goal, Codex will automatically start the Ralph Loop. In the TUI, you'll see:
- Current step (Plan / Act / Test / Review / Iterate)
- Tokens consumed
- Current iteration count
- Stage output (code diffs, test results)
You can step away while Codex handles the work. If you need to intervene, you can use these commands:
/goal pause # Pause the current Goal
/goal resume # Resume
/goal status # Check current progress
/goal clear # Clear the current Goal
3.5 Step 5: Review the Results
Once the Goal is completed or stopped due to budget limits, Codex will output a final report, including:
- A list of all modified files
- Actual tests run and their results
- A self-assessment of the goal's completion
- Remaining optimization tasks (for your next Goal)
💡 Pro-tip for your first try: Start with a small task that takes under 30 minutes, like "add ruff configuration to the project and fix all lint warnings." Once you're comfortable with the workflow, you can assign more complex, long-running tasks to Codex. If you just want to experiment with non-Goal capabilities, you can use the APIYI (apiyi.com) model invocation API for prototyping before upgrading to a ChatGPT Pro subscription for full Goal mode.
4. Practical Scenarios for Codex Goal Mode: 5 High-ROI Tasks
Not every task is a good fit for Goal mode. Based on early community feedback, these 5 types of tasks offer the best ROI.
4.1 Major Version Migrations
Typical examples: Pydantic v1 → v2, Vue 2 → Vue 3, Webpack 4 → 5.
These tasks share common traits: they involve changes across many files, have clear success criteria (tests pass), and are easy to start but tedious to complete. The Goal mode iteration loop is perfect for these "fix one error, trigger another" scenarios.
4.2 Improving Test Coverage
Typical Goal: "Increase test coverage for the src/services/ directory from 45% to 85%; all test cases must be valid and not empty."
Codex will loop through: write tests → run coverage → identify uncovered files → write the next batch of tests, until the target is met.
4.3 Large-Scale Refactoring
Typical Goal: "In this monorepo, replace all instances of axios with fetch + a custom wrapper, while maintaining equivalent error handling logic."
These tasks have clear success criteria (passing tests), but modifying dozens or hundreds of files manually is simply impractical.
4.4 Bug Investigation and Repair
Typical Goal: "Address the concurrency deadlock described in Issue #1234: reproduce, locate, fix, and add at least 1 regression test."
Codex will handle the entire closed-loop process: writing reproduction scripts, adding logs, locating the issue, applying the fix, and writing tests.
4.5 Documentation Generation and Syncing
Typical Goal: "Complete JSDoc comments for all publicly exported functions under src/api/ and generate docs/api.md based on those comments."
Goal mode can automate the entire workflow of scanning files, writing comments, running the documentation generator, and checking the output.
5. Choosing a ChatGPT Subscription: Why the $100 Pro Plan is the Sweet Spot
The Goal mode requires ChatGPT subscription authentication, so which tier gives you the best bang for your buck? This is the critical decision for successfully implementing Goal mode.
5.1 Comparison of ChatGPT Codex Usage Limits

| Subscription Tier | Monthly Fee (USD) | Codex Usage Limit | Goal Mode | Model Version | Value Rating |
|---|---|---|---|---|---|
| Free | 0 | Minimal | ❌ | Basic | ⭐ |
| Plus | 20 | 1× (Baseline) | ✅ | GPT-5.4 | ⭐⭐⭐ |
| Pro $100 | 100 | 10× Plus (Promo until 5/31, then 5×) | ✅ | GPT-5.4 / 5.5 | ⭐⭐⭐⭐⭐ |
| Pro $200 | 200 | 20× Plus | ✅ | GPT-5.5 Pro | ⭐⭐⭐⭐ |
| Business | 25/seat | 10× Plus | ✅ | Team Edition | ⭐⭐⭐ (Teams) |
| Enterprise | Negotiable | Custom | ✅ | Full Suite | ⭐⭐⭐ (Large Enterprise) |
5.2 Why the $100/month Pro Plan is the Best Choice for Solo Developers
Let's break down the key data from the table above:
Pro $100 vs. Plus $20:
- Price is 5×, but usage is 10× (during the promo period) → effective cost per token is 50% cheaper.
- Goal mode runs long tasks that can easily exhaust the Plus limit; the Pro plan is much more robust.
- For developers using Codex for more than 4 hours a day, the Plus quota is almost certainly insufficient.
Pro $100 vs. Pro $200:
- Price is 1/2, usage is 1/2 (during the promo period) → cost per token is the same.
- Most individual developers won't exhaust the $100 Pro limit in a month.
- Unless you're running multiple parallel Goal mode tasks long-term, you don't need the $200 tier.
Pro $100 vs. API Mode (Pay-per-token):
- Codex usage averages $100–$200/month per developer (based on API pricing).
- The subscription is a flat fee, so the more you use it, the more you save.
- API mode lacks the "Goal" boost, meaning you'd have to write your own loops for long tasks.
🎯 Bottom Line: For any individual developer serious about using Codex, the $100/month ChatGPT Pro plan is the undisputed best choice. It offers: ① Goal mode access, ② 10× the Codex usage of Plus, ③ predictable flat-rate pricing, and ④ savings on the engineering effort required to implement your own long-task loops. It's more cost-effective than pay-per-use API calls and more budget-friendly than the $200 Pro plan.
5.3 Decision Tree for Developers
Do you need Goal mode?
├─ Yes → ChatGPT subscription authentication required
│ ├─ Using Codex < 1 hour/day → Start with Plus $20
│ ├─ Using Codex 1-4 hours/day → ⭐ Pro $100 (Recommended)
│ └─ Running multiple parallel Goals → Pro $200
└─ No (Single-turn Codex usage only)
├─ Temporary trial / exploration → Use API proxy service (pay-as-you-go)
└─ Long-term heavy usage → Start with Plus $20
6. Why API Proxy Services Can't Run Codex Goal Mode
Many readers ask: "I'm already using an API proxy service to call GPT-5, so why can't I use it to run Goal mode?" Let's break down the reasons.
6.1 Limitations of the Goal Mode Authentication Architecture
Codex CLI offers two authentication modes:
| Auth Mode | Billing Method | Supports Goal Mode | Can Proxy Service Handle It? |
|---|---|---|---|
| ChatGPT auth (Subscription) | Uses subscription plan quota | ✅ | ❌ No |
| API key (Pay-as-you-go) | Token-based billing | ❌ | ✅ Yes |
The /goal command in Codex CLI is only activated in ChatGPT auth mode. This is because the app-server persistence logic for Goal mode is tied to the ChatGPT account system, rather than being a simple OpenAI Chat Completions API endpoint.
6.2 Why Proxy Services Can't Handle ChatGPT Subscriptions
At its core, an API proxy service acts as a transparent layer for RESTful interfaces like OpenAI's /v1/chat/completions. Here's what it can do:
- Forward standard OpenAI API requests
- Unify APIs from multiple providers into the OpenAI protocol
- Handle automatic load balancing and failover
Here's what it cannot do:
- Simulate ChatGPT.com's web authentication (which requires a real subscription cookie/session)
- Connect to the Codex app-server's persistent storage
- Proxy the subscription plan's quota system
In short, Goal mode isn't just an API endpoint; it's a product feature within the ChatGPT subscription ecosystem. Proxy services simply can't replicate that.
6.3 So, When Are API Proxy Services Useful?
Just because they can't run Goal mode doesn't mean they're useless. They remain the optimal solution in the following scenarios:
- Small-scale trials / Prototyping: Testing models like GPT-5 or Claude 4.7 on the fly.
- Building AI products: Integrating multiple model APIs into your backend where you need a unified interface and a stable channel.
- CI/CD integration: Automating tasks like code reviews or documentation generation.
- Pure API calls that don't require Goal mode: For example, using the Codex API for one-off code generation.
💡 Usage Advice: If you're only doing small-scale trials of Codex models or building a product that requires API access, you can quickly get started using an API proxy service like APIYI (apiyi.com). However, if you need to formally run long-term tasks in Goal mode, you must subscribe to ChatGPT Pro; there is no third-party alternative.
7. A Complete Guide for Developers in China to Use Codex Goal Mode
To use Goal mode in China, you need to solve two external hurdles: ① How to purchase a ChatGPT Pro subscription, and ② How to get the Codex CLI authenticated over the network. Here is the complete path.
7.1 Channels for Obtaining a ChatGPT Pro Subscription
The official OpenAI ChatGPT Pro subscription doesn't directly accept payments from Chinese credit cards. Several mature proxy-buying solutions exist in the community:
| Channel Type | Pros | Cons | Best For |
|---|---|---|---|
| Overseas friend pays | Most transparent pricing | Relies on favors, hard to renew long-term | Occasional users |
| Virtual credit card (Wise / OneKey, etc.) | High autonomy | High barrier to entry, country restrictions | Technical developers |
| Domestic account purchasing sites | Ready to use, includes support | Need to choose a reliable platform | Most developers |
Recommended domestic purchasing sites:
- Site 1:
ai.daishengji.com— Offers ChatGPT Pro / Plus account purchasing, supports RMB payments, and has relatively stable support. - Site 2:
www.gpt516.com— Also provides ChatGPT Pro subscription channels with various pricing tiers.
📌 Purchasing Advice: When choosing a provider, focus on: ① Whether they provide a stability guarantee of 30+ days, ② Whether you can change the password yourself, and ③ Whether the account is exclusive (to avoid being kicked off by others sharing the account). Both recommended sites support the $100 ChatGPT Pro tier, so feel free to compare prices and terms.
7.2 Preparing Your Network Proxy
Once you have your ChatGPT Pro account, you'll need a stable network proxy for both Codex CLI authentication and subsequent API calls. Developers are expected to provide their own, and common compliant solutions include:
- Self-hosted overseas VPS + Clash / Sing-box
- Commercial VPN/proxy services (choose one with long-term stability)
- Corporate overseas office networks (if your company has overseas branches with SSO access)
Once configured, the Codex CLI will typically read the HTTP_PROXY and HTTPS_PROXY environment variables automatically:
export HTTPS_PROXY=http://127.0.0.1:7890
export HTTP_PROXY=http://127.0.0.1:7890
codex login # The browser authorization flow will only complete successfully after this
⚠️ Proxy stability is a prerequisite for Goal mode: Goal mode can run for anywhere from tens of minutes to several hours. Any connection drop during this time might cause Codex to misjudge the task progress. We recommend a global proxy configuration with a stable, non-frequently changing IP.
7.3 A Hybrid Strategy for Developers
Combining everything above, here is the optimal strategy:
- Formally running Goal mode / Long tasks → ChatGPT Pro $100 subscription + your own proxy.
- Small-scale trials of Codex models / Verifying capabilities → Use APIYI (apiyi.com) to call the Codex API, saving you the trouble of setting up proxies and registration.
- Integrating APIs in production → API proxy service + automated monitoring.
- High-frequency, closed-loop development → Pro $100 + Codex CLI 0.128.0+.
🎯 Decision Advice: If you've decided to use Codex Goal mode extensively, subscribing to the $100/month Pro plan is the most cost-effective solution. You can use mature platforms like
ai.daishengji.comorwww.gpt516.comfor the purchase, paired with your own proxy. If you're just exploring the capabilities of the Codex models themselves, using a proxy service like APIYI (apiyi.com) for small-scale calls is more economical.
VIII. Comparison of Codex Goal Mode and Similar Products
To help you with your technical selection, let's place the Codex Goal mode within the industry landscape.
| Product | Vendor | Long-task Mode | Authentication | Proxy Support | Overall Experience |
|---|---|---|---|---|---|
| Codex /goal | OpenAI | ✅ Ralph Loop | ChatGPT Subscription | ❌ Not proxyable | ⭐⭐⭐⭐⭐ (Most complete) |
| Claude Code Long-task | Anthropic | ✅ Managed Outcomes | API Key or Pro | ✅ Partial support | ⭐⭐⭐⭐ |
| Aider auto mode | Open Source | ✅ Self-loop | Any API | ✅ Fully supported | ⭐⭐⭐ (Requires manual tuning) |
| Cursor Composer | Cursor | ✅ Background Agents | Subscription | ❌ | ⭐⭐⭐⭐ |
| GitHub Copilot Workspace | Microsoft | ✅ Workspace Auto Mode | GitHub Subscription | ❌ | ⭐⭐⭐ |
| Devin | Cognition | ✅ ACE Agent | Subscription | ❌ | ⭐⭐⭐⭐ |
As you can see, the Codex Goal mode is one of the most mature engineering solutions for long-running tasks among mainstream closed-source AI programming products. When paired with the $100 ChatGPT Pro subscription, it offers highly competitive value.
IX. Codex Goal Mode FAQ
Q1: Is a ChatGPT Pro subscription required to use Codex Goal mode?
Theoretically, ChatGPT Plus ($20/month) also supports Goal mode. However, the Codex usage limit for Plus (1× baseline) is easily exhausted during long tasks, leading to a poor experience where the Goal is interrupted by budget limits. For real-world use, we recommend starting with at least the $100/month Pro plan.
Q2: Can I run Goal mode using an OpenAI API key?
No. Goal mode is only activated under the ChatGPT auth mode (subscription-based authentication); the API key mode cannot enable the /goal command. Even if you are willing to pay per token, it won't work—this is a product feature boundary, not a billing issue.
Q3: Can I run Goal mode through an API proxy service like APIYI?
No. Goal mode relies on the persistent goal storage of the ChatGPT app-server and the ChatGPT subscription authentication system. API proxy services can only proxy standard OpenAI RESTful interfaces and cannot proxy the subscription authentication flow. If you are just doing small-scale API calls to test the Codex model, you can use proxy services like APIYI (apiyi.com), but Goal mode requires a Pro subscription.
Q4: Is the $100 or $200 Pro plan better for Goal mode?
For the vast majority of individual developers, the $100 Pro plan is more than enough. The Codex usage for the $100 Pro plan is 10× that of Plus (during the promotional period until May 31, 2026), and will stabilize at 5× thereafter. Unless you are running more than three Goal tasks simultaneously for long periods, you won't exhaust the $100 Pro quota, so there's no need to spend $200.
Q5: Can I subscribe to ChatGPT Pro directly from China?
No. OpenAI does not accept domestic credit cards, and there are regional restrictions on account registration. Domestic developers usually obtain accounts through third-party purchasing websites, such as ai.daishengji.com or www.gpt516.com. These platforms support RMB payments and provide basic after-sales support. After a successful subscription, you will still need your own network proxy to use the Codex CLI normally.
Q6: What happens if I run out of tokens while a Goal task is running?
Codex will trigger a budget_limited soft stop and write a wrap-up progress report using the remaining tokens. You can resume with /goal resume the next time you open the TUI, provided your subscription quota has been restored. If you frequently run out of quota, consider upgrading to the $200 Pro plan or breaking your goals into smaller pieces.
Q7: Can I run multiple Goals at the same time?
In the current implementation of the Codex CLI, there can only be one active goal per project directory at a time. However, you can open multiple Codex instances in different directories, each running its own Goal. If you are working in a monorepo, it is recommended to break the Goal down into serializable sub-goals.
Q8: Is it safe to run long tasks in Goal mode? Will it mess up my code?
Goal mode follows the standard sandbox policy of the Codex CLI: it can read and write to the current working directory, execute commands on an allowlist, and cannot access external system resources. We strongly recommend performing a git commit before starting Goal mode so that changes can be rolled back. You can also add constraints to your Goal description, such as "only modify the src/ directory, do not touch tests/ or docs/."
Q9: Are there specific requirements for my own proxy?
Minimum requirements: ① Support for global HTTPS proxy, ② at least 5Mbps stable bandwidth, ③ avoid frequent IP switching (which may trigger OpenAI risk control). If your proxy drops during a long-running Goal task, it could ruin an entire cycle, so stability is more important than speed.
Q10: Will Codex Goal mode replace IDE agents like Cursor?
Not in the short term. They have different positioning: Codex Goal mode excels at fully unattended, long-span tasks (start it, walk away, and collect results later); IDE agents like Cursor/Copilot excel at real-time, human-AI collaborative editing. The best practice is to use them together: use Cursor for daily development and leave the heavy lifting to Codex Goal.
10. Summary: Core Takeaways for Implementing the Codex Goal Mode
Looking back at everything we've covered, here are the key points regarding the Codex Goal mode:
- Goal mode is a long-span autonomous task mode introduced in Codex CLI 0.128.0. It allows Codex to automatically cycle through plan→act→test→review→iterate, never stopping until the goal is achieved.
- 5 types of tasks are best suited for Goal mode: major version migrations, increasing test coverage, large-scale refactoring, bug investigation and fixing, and documentation generation.
- Goal mode requires a ChatGPT subscription for authentication. Neither OpenAI API keys nor third-party API proxy services will work here.
- The $100/month Pro subscription is the best choice for individual developers. It offers 10x the usage of Plus, access to Goal mode, and predictable fixed costs, making it more cost-effective than pay-as-you-go APIs for long-term users.
- Recommended path for developers in China: Purchase a Pro account through platforms like
ai.daishengji.comorwww.gpt516.com, and ensure you have a stable network proxy. - API proxy services still hold value: For small-scale testing of Large Language Model capabilities, building AI products, or CI/CD integration scenarios, you can choose a unified access platform like APIYI.
- Hybrid strategy: Use the Pro subscription + Goal mode for long-running tasks, and use API proxy services for model testing and product integration.
- First-time trial advice: Start with a small goal that takes less than 30 minutes to get familiar with the workflow before letting Codex handle larger tasks.
🎯 Final Recommendation: If you're a developer serious about your coding workflow and spend over an hour a day using AI for assistance, subscribing directly to ChatGPT Pro at $100/month is currently your best bet. It unlocks the Goal mode—a killer feature that can actually handle long-running tasks—making it more cost-effective than pay-as-you-go APIs and much less of a headache than manually managing loops. You can check out purchasing channels like
ai.daishengji.comorwww.gpt516.com, and with a reliable proxy, you'll be able to fully experience this new paradigm of AI coding that's shaping up to be the most important trend of 2026.
Codex Goal mode is redefining the engineering ceiling for "AI helping me write code." The shift from a simple tool to an autonomous agent is already happening right in your terminal.
Author: APIYI Technical Team | Focusing on the practical implementation of Large Language Models. For more technical content, please visit APIYI at apiyi.com
