-
Notifications
You must be signed in to change notification settings - Fork 12
features fast mode
Active contributors: Nik, Ran
Fast mode requests OpenAI's priority service tier for selected Codex models. When enabled, ThinkingProxy injects "service_tier":"priority" into the request body on the OpenAI Responses API paths so eligible requests are served at higher priority. It is independent of reasoning effort: priority tier and reasoning level are separate request fields.
| Item | Role |
|---|---|
AppPreferences.gpt53CodexFastMode / gpt54FastMode / gpt55FastMode
|
UserDefaults-backed toggles (default false), one per eligible model. |
fastTierEligibleResponsePaths |
Set of paths eligible for injection: /v1/responses, /api/v1/responses. |
processOpenAIFastMode |
The ThinkingProxy function that decides whether to inject and performs the surgical string insertion. |
RequestJSONFields |
Parsed view of the body exposing model, modelLocation, and hasServiceTier. |
codexFastModeToggleRow |
The SwiftUI checkbox rows under the Codex service row. |
Eligible models: gpt-5.3-codex, gpt-5.4, gpt-5.5. gpt-5.2 has no fast-mode toggle.
graph TD
A[POST request] --> B{path in fastTierEligibleResponsePaths?}
B -- no --> Z[forward unchanged]
B -- yes --> C{model + modelLocation parsed?}
C -- no --> Z
C -- yes --> D{model is gpt-5.3-codex / 5.4 / 5.5?}
D -- no --> Z
D -- yes --> E{matching AppPreferences toggle on?}
E -- no --> Z
E -- yes --> F{client already set service_tier?}
F -- yes --> Z
F -- no --> G[insert service_tier priority after model field]
G --> H[forward modified body]
The injection is a surgical string insert: processOpenAIFastMode inserts ,"service_tier":"priority" at the upper bound of the model field's key/value pair range. Editing the raw JSON string this way preserves key order, which matters for Anthropic-style prompt caching elsewhere in the proxy. The request is otherwise forwarded unchanged.
-
src/Sources/AppPreferences.swiftdefines the three toggle keys and their accessors;ThinkingProxyreads them at request time. -
src/Sources/SettingsView.swiftrenders the toggles in a collapsible "Fast Mode" subsection under the Codex service row, shown only when Codex is enabled. - The injection runs in the same request pipeline as the Gemini path rewrite and Anthropic-Beta header rewrite in
src/Sources/ThinkingProxy.swift.
- Add a model to fast mode: add a UserDefaults key + accessor in
src/Sources/AppPreferences.swift, add acasefor the model id in theswitchinsideprocessOpenAIFastModeinsrc/Sources/ThinkingProxy.swift, and add acodexFastModeToggleRowinsrc/Sources/SettingsView.swift. - Change eligible paths: edit
fastTierEligibleResponsePathsinsrc/Sources/ThinkingProxy.swift.
| File | Role |
|---|---|
src/Sources/ThinkingProxy.swift |
processOpenAIFastMode, fastTierEligibleResponsePaths, the injection. |
src/Sources/AppPreferences.swift |
gpt53CodexFastMode / gpt54FastMode / gpt55FastMode keys and accessors. |
src/Sources/SettingsView.swift |
Collapsible Fast Mode subsection and codexFastModeToggleRow. |