Skip to content

features fast mode

Nik edited this page May 30, 2026 · 1 revision

Fast mode

Active contributors: Nik, Ran

Purpose

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.

Key abstractions

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.

How it works

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]
Loading

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.

Integration points

  • src/Sources/AppPreferences.swift defines the three toggle keys and their accessors; ThinkingProxy reads them at request time.
  • src/Sources/SettingsView.swift renders 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.

Entry points for modification

  • Add a model to fast mode: add a UserDefaults key + accessor in src/Sources/AppPreferences.swift, add a case for the model id in the switch inside processOpenAIFastMode in src/Sources/ThinkingProxy.swift, and add a codexFastModeToggleRow in src/Sources/SettingsView.swift.
  • Change eligible paths: edit fastTierEligibleResponsePaths in src/Sources/ThinkingProxy.swift.

Key source files

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.

Related

Clone this wiki locally