Skip to content

OpenAI service tier support #2916

Open
Open

Description

@jakvbs

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 selection
  • flex: 50% cheaper processing with increased latency, ideal for non-production workloads
  • priority: Faster processing for enterprise users

Implementation Details

  • Configuration via service_tier in config.toml and profiles
  • CLI flag --service-tier for per-session override
  • Model compatibility validation with fallback to auto
  • Support for both exec and TUI modes

Use Cases

  • Development/testing: Use flex tier for 50% cost savings on non-critical workloads
  • Production: Use priority tier for faster response times
  • Batch processing: Use flex for 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.

Activity

  1. added
    enhancement
    on Sep 8, 2025
  2. hourianto commented on Sep 12, 2025

    @hourianto

    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.

  3. brainit-consulting commented on Sep 12, 2025

    @brainit-consulting

    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.

  4. pedrobergamini commented on Oct 15, 2025

    @pedrobergamini

    +1 supporting this. Question, what's the current default service_tier set for ChatGPT Plus/Pro users?

  5. changed the title [-]Feature request: Add OpenAI service tier support for cost optimization[/-] [+]OpenAI service tier support[/+] on Nov 13, 2025
  6. it-sha commented on Dec 4, 2025

    @it-sha

    Hi

    Do we have any news about service_tier in Codex?

    Ability to use GPT 5.1 high with priority service_tier would be awesome for our team
    By default, it's very slow

  7. etraut-openai commented on Dec 4, 2025

    @etraut-openai
    Contributor

    @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.

  8. maheshrijal commented on Dec 12, 2025

    @maheshrijal
    Contributor

    I was going to create an issue for this if did not exist. But turns out it does, +1 for this feature.

  9. waclawthedev commented on Feb 2, 2026

    @waclawthedev

    FYI open code already supports it. I created anomalyco/opencode#11597 to handle price

  10. mattCohesion commented on Feb 8, 2026

    @mattCohesion

    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.

  11. added
    agent
    on Mar 26, 2026
  12. 7 remaining items

  13. hourianto commented on May 27, 2026

    @hourianto

    Yeah it's supported (at least for API all 3, for sub normal and fast), the issue should be closed I think.

  14. lmtr0 commented on May 27, 2026

    @lmtr0

    Hmm, I'm on api key, just was a bit surprised with the speed of the flex tier, thanks

  15. per-mathisen-arm commented on Jun 1, 2026

    @per-mathisen-arm

    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 ,-)

  16. lukaemon commented on Jun 9, 2026

    @lukaemon

    Great idea. /slow for overnight grinding. /fast for real time collaboration.

  17. mlin commented on Jun 24, 2026

    @mlin

    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.

    Image

    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....

  18. mlin commented on Jun 24, 2026

    @mlin

    Codex self-diagnosed the problem to flex not being listed as an available service tier here:

    "service_tiers": [
    {
    "id": "priority",
    "name": "Fast",
    "description": "1.5x speed, increased usage"
    }
    ],

    (for GPT-5.5, but flex is not mentioned anywhere in that file)

    The config.toml service_tier setting is silently omitted from the API request if the value is not found in that list for the chosen model.

  19. mlin commented on Jun 30, 2026

    @mlin

    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:

    jq '
      {
        models: [
          .models[]
          | select(.slug == "gpt-5.4")
          | .service_tiers = (
              (.service_tiers // [])
              + [
                  {
                    "id": "flex",
                    "name": "Flex",
                    "description": "Flexible processing"
                  }
                ]
              | unique_by(.id)
            )
        ]
      }
    ' ~/.codex/models_cache.json > ~/.codex/gpt-5.4-flex-catalog.json
    

    ...and set ~/.codex/config.toml to use it:

    model_catalog_json = "/home/YOUR_USERNAME/.codex/gpt-5.4-flex-catalog.json"
    service_tier = "flex"
    model = "gpt-5.4"
    model_reasoning_effort = "medium"
    

    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.

  20. insilications commented on Jul 9, 2026

    @insilications

    If technically feasible, it would be really nice to support flex and adapt the harness around it, even with multi-agents v2.

  21. mlin commented on Jul 29, 2026

    @mlin

    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_tier config 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 ignoring service_tier = "flex" in ~/.codex/config.toml. The workaround:

    Splice flex into the models.json service_tiers...

    Save it as a model catalog file:

    jq '
      {
        models: [
          .models[]
          | select(.slug == "gpt-5.6-sol"
                or .slug == "gpt-5.6-terra"
                or .slug == "gpt-5.6-luna")
          | .service_tiers = (
              (.service_tiers // [])
              + [
                  {
                    "id": "flex",
                    "name": "Flex",
                    "description": "Flexible processing"
                  }
                ]
              | unique_by(.id)
            )
        ]
      }
    ' ~/.codex/models_cache.json > ~/.codex/gpt-5.6-flex-catalog.json
    

    ...and set ~/.codex/config.toml to use it:

    model_catalog_json = "/home/YOUR_USERNAME/.codex/gpt-5.6-flex-catalog.json"
    service_tier = "flex"
    model = "gpt-5.6-terra"
    model_reasoning_effort = "medium"
    

    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:

    Image
  22. mlin commented on Aug 3, 2026

    @mlin

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

configenhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions