Skip to content

Commit c150c30

Browse files
authored
🤖 feat: default OpenAI service_tier to priority (#1105)
Change OpenAI service_tier default from `auto` to `priority` for low-latency responses. ## Changes - Default to `priority` service tier for faster responses - Support all OpenAI service tiers: `auto`, `default`, `flex`, `priority` - Allow override via `providers.jsonc` ## Usage Users can configure in `~/.mux/providers.jsonc`: ```json { "openai": { "apiKey": "sk-...", "serviceTier": "flex" } } ``` Service tier options: - **priority**: Low-latency responses (new default) - **flex**: 50% cheaper, higher latency (o3, o4-mini, gpt-5) - **auto/default**: Standard processing _Generated with `mux`_
1 parent e6e4c2e commit c150c30

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

src/common/orpc/schemas/providerOptions.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ export const MuxProviderOptionsSchema = z.object({
1010
.optional(),
1111
openai: z
1212
.object({
13+
serviceTier: z.enum(["auto", "default", "flex", "priority"]).optional().meta({
14+
description:
15+
"OpenAI service tier: priority (low-latency), flex (50% cheaper, higher latency), auto/default (standard)",
16+
}),
1317
disableAutoTruncation: z
1418
.boolean()
1519
.optional()

src/common/utils/ai/providerOptions.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,12 @@ export function buildProviderOptions(
217217
disableAutoTruncation,
218218
});
219219

220+
const serviceTier = muxProviderOptions?.openai?.serviceTier ?? "priority";
221+
220222
const options: ProviderOptions = {
221223
openai: {
222224
parallelToolCalls: true, // Always enable concurrent tool execution
223-
// TODO: allow this to be configured
224-
serviceTier: "auto", // Use "auto" to automatically select the best service tier
225+
serviceTier,
225226
// Automatically truncate conversation to fit context window, unless disabled for testing
226227
truncation: disableAutoTruncation ? "disabled" : "auto",
227228
// Conditionally add reasoning configuration

src/node/services/aiService.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,16 @@ export class AIService extends EventEmitter {
500500
provider: providerName,
501501
});
502502
}
503+
504+
// Extract serviceTier from config to pass through to buildProviderOptions
505+
const configServiceTier = providerConfig.serviceTier as string | undefined;
506+
if (configServiceTier && muxProviderOptions) {
507+
muxProviderOptions.openai = {
508+
...muxProviderOptions.openai,
509+
serviceTier: configServiceTier as "auto" | "default" | "flex" | "priority",
510+
};
511+
}
512+
503513
const baseFetch = getProviderFetch(providerConfig);
504514

505515
// Wrap fetch to force truncation: "auto" for OpenAI Responses API calls.

0 commit comments

Comments
 (0)