[FEATURE]: Support OpenAI service tier (flex/priority processing) #4543

Open
opened 2026-02-16 17:44:32 -05:00 by yindo · 10 comments
Owner

Originally created by @maheshrijal on GitHub (Jan 9, 2026).

Originally assigned to: @rekram1-node on GitHub.

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

OpenAI’s API supports selecting a processing/service tier. Although this can be expensive, but getting things done quickly for urgent tasks would be a great feature. Please add support for this in OpenCode.

Upstream reference: https://github.com/openai/codex/issues/2916

Originally created by @maheshrijal on GitHub (Jan 9, 2026). Originally assigned to: @rekram1-node on GitHub. ### Feature hasn't been suggested before. - [x] I have verified this feature I'm about to request hasn't been suggested before. ### Describe the enhancement you want to request OpenAI’s API supports selecting a processing/service tier. Although this can be expensive, but getting things done quickly for urgent tasks would be a great feature. Please add support for this in OpenCode. Upstream reference: https://github.com/openai/codex/issues/2916
yindo added the discussion label 2026-02-16 17:44:32 -05:00
Author
Owner

@emamulandalib commented on GitHub (Jan 11, 2026):

So far I found it was introduced 2 months ago already as part of this PR #4914 (get codex working in copilot)

https://github.com/anomalyco/opencode/blob/b26732812bc583bcdb8ced55878ac1fdda826637/packages/opencode/src/provider/sdk/openai-compatible/src/responses/openai-responses-language-model.ts#L1706

Tested with below configuration already and it's working but yes redundant value to handle. I guess here we need a good config design.

"agent": {
    "plan": { "options": { "serviceTier": "flex" } },
    "title": { "options": { "serviceTier": "flex" } },
    "build": { "options": { "serviceTier": "flex" } }
  },

The config will be parsed here...
https://github.com/anomalyco/opencode/blob/b26732812bc583bcdb8ced55878ac1fdda826637/packages/opencode/src/provider/sdk/openai-compatible/src/responses/openai-responses-language-model.ts#L196-L200

...and it will be sent to API.
https://github.com/anomalyco/opencode/blob/b26732812bc583bcdb8ced55878ac1fdda826637/packages/opencode/src/provider/sdk/openai-compatible/src/responses/openai-responses-language-model.ts#L289

Then, the repsonse will be captured for stream or non-stream
https://github.com/anomalyco/opencode/blob/b26732812bc583bcdb8ced55878ac1fdda826637/packages/opencode/src/provider/sdk/openai-compatible/src/responses/openai-responses-language-model.ts#L742-L744

https://github.com/anomalyco/opencode/blob/b26732812bc583bcdb8ced55878ac1fdda826637/packages/opencode/src/provider/sdk/openai-compatible/src/responses/openai-responses-language-model.ts#L1237-L1239
Added some logs to verify

timestamp            duration  provider  model       agent  requested  response
2026-01-11T22:04:35  +1ms      openai    gpt-5.2     build  flex       flex
2026-01-11T22:04:35  +549ms    openai    gpt-5-nano  title  flex       flex
2026-01-11T22:04:38  +1006ms   openai    gpt-5.2     build  flex       flex
2026-01-11T22:04:42  +402ms    openai    gpt-5.2     build  flex       flex
2026-01-11T22:04:54  +1324ms   openai    gpt-5.2     build  flex       flex
2026-01-11T22:04:59  +122ms    openai    gpt-5.2     build  flex       flex

This works as well at model level configuration. I guess we need to update the documentation and the config schema https://opencode.ai/config.json.

@emamulandalib commented on GitHub (Jan 11, 2026): So far I found it was introduced 2 months ago already as part of this PR #4914 (get codex working in copilot) https://github.com/anomalyco/opencode/blob/b26732812bc583bcdb8ced55878ac1fdda826637/packages/opencode/src/provider/sdk/openai-compatible/src/responses/openai-responses-language-model.ts#L1706 Tested with below configuration already and it's working but yes redundant value to handle. I guess here we need a good config design. ``` "agent": { "plan": { "options": { "serviceTier": "flex" } }, "title": { "options": { "serviceTier": "flex" } }, "build": { "options": { "serviceTier": "flex" } } }, ``` The config will be parsed here... https://github.com/anomalyco/opencode/blob/b26732812bc583bcdb8ced55878ac1fdda826637/packages/opencode/src/provider/sdk/openai-compatible/src/responses/openai-responses-language-model.ts#L196-L200 ...and it will be sent to API. https://github.com/anomalyco/opencode/blob/b26732812bc583bcdb8ced55878ac1fdda826637/packages/opencode/src/provider/sdk/openai-compatible/src/responses/openai-responses-language-model.ts#L289 Then, the repsonse will be captured for stream or non-stream https://github.com/anomalyco/opencode/blob/b26732812bc583bcdb8ced55878ac1fdda826637/packages/opencode/src/provider/sdk/openai-compatible/src/responses/openai-responses-language-model.ts#L742-L744 https://github.com/anomalyco/opencode/blob/b26732812bc583bcdb8ced55878ac1fdda826637/packages/opencode/src/provider/sdk/openai-compatible/src/responses/openai-responses-language-model.ts#L1237-L1239 Added some logs to verify ``` timestamp duration provider model agent requested response 2026-01-11T22:04:35 +1ms openai gpt-5.2 build flex flex 2026-01-11T22:04:35 +549ms openai gpt-5-nano title flex flex 2026-01-11T22:04:38 +1006ms openai gpt-5.2 build flex flex 2026-01-11T22:04:42 +402ms openai gpt-5.2 build flex flex 2026-01-11T22:04:54 +1324ms openai gpt-5.2 build flex flex 2026-01-11T22:04:59 +122ms openai gpt-5.2 build flex flex ``` This works as well at model level configuration. I guess we need to update the documentation and the config schema https://opencode.ai/config.json.
Author
Owner

@aarock1234 commented on GitHub (Jan 23, 2026):

Bump; would be useful to have. Cursor has it under its GPT-... Fast models.

@aarock1234 commented on GitHub (Jan 23, 2026): Bump; would be useful to have. Cursor has it under its `GPT-... Fast` models.
Author
Owner

@djosh34 commented on GitHub (Jan 31, 2026):

This works as well at model level configuration. I guess we need to update the documentation and the config schema https://opencode.ai/config.json.

How/Where to put this now in opencode.json?

@djosh34 commented on GitHub (Jan 31, 2026): > This works as well at model level configuration. I guess we need to update the documentation and the config schema https://opencode.ai/config.json. How/Where to put this now in `opencode.json`?
Author
Owner

@waclawthedev commented on GitHub (Feb 1, 2026):

I use it with config:

"provider": {
        "openai": {
            "models": {
                "gpt-5.2": {
                    "options": {
                        "serviceTier": "flex"
                    }
                }
            }
        },
...
@waclawthedev commented on GitHub (Feb 1, 2026): I use it with config: ``` "provider": { "openai": { "models": { "gpt-5.2": { "options": { "serviceTier": "flex" } } } }, ... ```
Author
Owner

@djosh34 commented on GitHub (Feb 1, 2026):

I use it with config:

"provider": {
        "openai": {
            "models": {
                "gpt-5.2": {
                    "options": {
                        "serviceTier": "flex"
                    }
                }
            }
        },
...

Amazing, added a PR for the docs only:

https://github.com/anomalyco/opencode/pull/11643

@djosh34 commented on GitHub (Feb 1, 2026): > I use it with config: > > ``` > "provider": { > "openai": { > "models": { > "gpt-5.2": { > "options": { > "serviceTier": "flex" > } > } > } > }, > ... > ``` Amazing, added a PR for the docs only: https://github.com/anomalyco/opencode/pull/11643
Author
Owner

@waclawthedev commented on GitHub (Feb 1, 2026):

@djosh34 FYI https://github.com/anomalyco/opencode/pull/11599

@waclawthedev commented on GitHub (Feb 1, 2026): @djosh34 FYI https://github.com/anomalyco/opencode/pull/11599
Author
Owner

@djosh34 commented on GitHub (Feb 1, 2026):

@djosh34 FYI #11599

when testing i couldn't get serviceTier to work with camelcase like your example shows, only with snake_case

@djosh34 commented on GitHub (Feb 1, 2026): > [@djosh34](https://github.com/djosh34) FYI [#11599](https://github.com/anomalyco/opencode/pull/11599) when testing i couldn't get serviceTier to work with camelcase like your example shows, only with snake_case
Author
Owner

@djosh34 commented on GitHub (Feb 1, 2026):

@djosh34 FYI #11599

open to merging my changes in your PR though

@djosh34 commented on GitHub (Feb 1, 2026): > [@djosh34](https://github.com/djosh34) FYI [#11599](https://github.com/anomalyco/opencode/pull/11599) open to merging my changes in your PR though
Author
Owner

@djosh34 commented on GitHub (Feb 1, 2026):

@djosh34 FYI #11599

when testing i couldn't get serviceTier to work with camelcase like your example shows, only with snake_case

nvm this comment, this is only if you don't add it to config like your PR

@djosh34 commented on GitHub (Feb 1, 2026): > > [@djosh34](https://github.com/djosh34) FYI [#11599](https://github.com/anomalyco/opencode/pull/11599) > > when testing i couldn't get serviceTier to work with camelcase like your example shows, only with snake_case nvm this comment, this is only if you don't add it to config like your PR
Author
Owner

@waclawthedev commented on GitHub (Feb 2, 2026):

@djosh34 check again your point.
To test your finding I added logging here: https://github.com/waclawthedev/opencode/commit/1bdfd4e3980e19cfe88ccf6fc24070a298ca72bc
So:

  • with "service_tier": "flex" in config model return serviceTier=default
  • with "serviceTier": "flex" in config model returns serviceTier=flex
@waclawthedev commented on GitHub (Feb 2, 2026): @djosh34 check again your point. To test your finding I added logging here: https://github.com/waclawthedev/opencode/commit/1bdfd4e3980e19cfe88ccf6fc24070a298ca72bc So: * with "service_tier": "flex" in config model return serviceTier=default * with "serviceTier": "flex" in config model returns serviceTier=flex
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4543