Repository navigation
Open
Labels
configIssues involving config.toml, config keys, config merging, or config updatesenhancementNew feature or request
Description
Problem
Currently, Codex CLI doesn't provide users with control over OpenAI API service tiers, limiting cost optimization options for different use cases.
Proposed Solution
Add service_tier configuration option to control API request cost and latency via OpenAI's service tier parameter:
auto(default): Standard processing with automatic tier selectionflex: 50% cheaper processing with increased latency, ideal for non-production workloadspriority: Faster processing for enterprise users
Implementation Details
- Configuration via
service_tierin config.toml and profiles - CLI flag
--service-tierfor per-session override - Model compatibility validation with fallback to
auto - Support for both exec and TUI modes
Use Cases
- Development/testing: Use
flextier for 50% cost savings on non-critical workloads - Production: Use
prioritytier for faster response times - Batch processing: Use
flexfor cost-effective background tasks
Configuration Examples
# Global setting
service_tier = "flex"
# Profile-specific
[profiles.cost-optimized]
model = "o3"
service_tier = "flex"# CLI usage
codex --service-tier flex "Analyze this code"
codex exec --service-tier priority "Generate tests"Benefits
- Cost optimization: Up to 50% savings with flex tier
- Performance control: Priority tier for time-sensitive work
- Flexibility: Per-session and per-profile configuration
- Backward compatibility: Auto tier maintains existing behavior
This feature aligns with OpenAI's service tier offerings and provides users with cost/performance control without breaking existing workflows.
Reacted by Raka Hourianto, Jouni Suominen, rmilkowski, AJ Clemendor, ericrafalovsky, Adrien KERFOURN, Gautham, Peter Hollows, Oliver Mannion, jlflores and 54 more
Metadata
Metadata
Assignees
Labels
configIssues involving config.toml, config keys, config merging, or config updatesenhancementNew feature or request
Activity
hourianto commentedon Sep 12, 2025
I'd like to see this implemented, service_tier = priority would be nice for people who want lower latency responses, even if it costs more.
brainit-consulting commentedon Sep 12, 2025
I support this. I tried codex cli for two days of work, not for production to learn and made great progress until it abruptly and rudely presented me with '🖐 You've hit your usage limit. Upgrade to Pro (https://openai.com/chatgpt/pricing) or try again in 4 days 1 hour 57 minutes." I am sure ya'll know what I mean. I am on the Plus plan, but a hobby developer. I wish we could instead 'auto switch' to a 'pay as you go' during the 'time-out' period, (happy to accept slower response) and then auto-switch back after 'time limit' resets. I know there is an option to use setx and your key, but that is a pain. make it easier to switch modes please.
Remove legacy codex exec --json format (#4525)
Remove legacy codex exec --json format (openai#4525)
pedrobergamini commentedon Oct 15, 2025
+1 supporting this. Question, what's the current default
service_tierset for ChatGPT Plus/Pro users?[-]Feature request: Add OpenAI service tier support for cost optimization[/-][+]OpenAI service tier support[/+]Remove legacy codex exec --json format (openai#4525)
it-sha commentedon Dec 4, 2025
Hi
Do we have any news about
service_tierin Codex?Ability to use GPT 5.1 high with priority
service_tierwould be awesome for our teamBy default, it's very slow
etraut-openai commentedon Dec 4, 2025
@it-sha, thanks for your interest. We generally prioritize features based on community feedback. This has received some upvotes, but there are many features that are ahead of it in the priority list.
maheshrijal commentedon Dec 12, 2025
I was going to create an issue for this if did not exist. But turns out it does, +1 for this feature.
waclawthedev commentedon Feb 2, 2026
FYI open code already supports it. I created anomalyco/opencode#11597 to handle price
mattCohesion commentedon Feb 8, 2026
This would also be great for background task completion. We create many tasks for our coding agent to complete and running in flex mode during non-peak hours would help us save on cost significantly.
7 remaining items
hourianto commentedon May 27, 2026
Yeah it's supported (at least for API all 3, for sub normal and fast), the issue should be closed I think.
lmtr0 commentedon May 27, 2026
Hmm, I'm on api key, just was a bit surprised with the speed of the flex tier, thanks
per-mathisen-arm commentedon Jun 1, 2026
An overnight batch mode would be quite useful. Sometimes we issue many jobs that are picked up and reviewed the next day (and sometimes we also know roughly how many tokens they will consume because we've run them many times before). Providing OpenAI with this information ahead of time could allow you guys to schedule it to optimize data center usage and perhaps pass on some of those savings on to your users ,-)
Remove legacy codex exec --json format (#4525)
lukaemon commentedon Jun 9, 2026
Great idea. /slow for overnight grinding. /fast for real time collaboration.
mlin commentedon Jun 24, 2026
I also have a doubt whether the config.toml setting actually works. I have another app that definitely uses the flex tier through Node.js bindings, and in the Usage > Spend categories area of platform.openai.com, flex-tier requests are clearly distinguished from from normal tier ("flex |" prefix). Illustrative example below.
When I look at the Spend categories for the API key I'm using with Codex CLI, none of the categories are "flex |". Of course it's possible the first-party codex CLI app uses the API in some special way that makes the usage viewer lose the distinction. But doubt is sown....
mlin commentedon Jun 24, 2026
Codex self-diagnosed the problem to
flexnot being listed as an available service tier here:codex/codex-rs/models-manager/models.json
Lines 85 to 91 in 81f3404
(for GPT-5.5, but flex is not mentioned anywhere in that file)
The config.toml
service_tiersetting is silently omitted from the API request if the value is not found in that list for the chosen model.Remove legacy codex exec --json format (openai#4525)
mlin commentedon Jun 30, 2026
The following workaround seems effective any way I've looked at it:
Splice flex into the models.json
service_tiers...Save it as a model catalog file:
...and set
~/.codex/config.tomlto use it:Naturally, I tried this first with GPT-5.5 and it works, but the frequency of turn-ending
⚠ Selected model is at capacity. Please try a different model.errors was much too high to be worth the frustration. GPT-5.4 has been pleasantly usable (still happens occasionally of course), while cheaper anyway and very capable.insilications commentedon Jul 9, 2026
If technically feasible, it would be really nice to support flex and adapt the harness around it, even with multi-agents v2.
mlin commentedon Jul 29, 2026
With 5h usage limits returning per Tibo, I updated my flex workaround to gpt-5.6-terra and tried a few small things with it successfully. This is for Codex CLI with an API key.
To review, AOTW Codex CLI's
service_tierconfig option works for priority ($$$), but it doesn't work for flex only because flex isn't listed among the available options in the internal model listing, silently ignoringservice_tier = "flex"in~/.codex/config.toml. The workaround:Splice flex into the models.json
service_tiers...Save it as a model catalog file:
...and set
~/.codex/config.tomlto use it:To confirm flex is used, on platform.openai.com Usage > Spend Categories (make sure the project associated with the API key is selected), we should see
flex |prefixes:mlin commentedon Aug 3, 2026
I've been going pretty hard all day on gpt-5.6-luna max and spent about $4 on flex without a single failed turn (albeit Sunday). wow
Remove legacy codex exec --json format (#4525)