Skip to content

Commit bf6811f

Browse files
feat: add serviceTier parameter to Responses API LLM (#1206)
1 parent a044ea3 commit bf6811f

3 files changed

Lines changed: 17 additions & 0 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@livekit/agents-plugin-openai': patch
3+
---
4+
5+
add serviceTier parameter to Responses API LLM for parity with Chat Completions LLM

plugins/openai/src/responses/llm.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ export interface LLMOptions {
2626
store?: boolean;
2727
metadata?: Record<string, string>;
2828
strictToolSchema?: boolean;
29+
/** Specifies the processing tier (e.g. 'auto', 'default', 'priority', 'flex'). */
30+
serviceTier?: string;
2931

3032
/**
3133
* Whether to use the WebSocket API.
@@ -114,6 +116,10 @@ class ResponsesHttpLLM extends llm.LLM {
114116
modelOptions.metadata = this.#opts.metadata;
115117
}
116118

119+
if (this.#opts.serviceTier) {
120+
modelOptions.service_tier = this.#opts.serviceTier;
121+
}
122+
117123
return new ResponsesHttpLLMStream(this, {
118124
model: this.#opts.model,
119125
client: this.#client,

plugins/openai/src/ws/llm.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ export interface WSLLMOptions {
141141
store?: boolean;
142142
metadata?: Record<string, string>;
143143
strictToolSchema?: boolean;
144+
/** Specifies the processing tier (e.g. 'auto', 'default', 'priority', 'flex'). */
145+
serviceTier?: string;
144146
}
145147

146148
const defaultLLMOptions: WSLLMOptions = {
@@ -266,6 +268,10 @@ export class WSLLM extends llm.LLM {
266268
modelOptions.metadata = this.#opts.metadata;
267269
}
268270

271+
if (this.#opts.serviceTier) {
272+
modelOptions.service_tier = this.#opts.serviceTier;
273+
}
274+
269275
let inputChatCtx = chatCtx;
270276
let prevResponseId: string | undefined;
271277
const canUseStoredResponse = modelOptions.store !== false;

0 commit comments

Comments
 (0)