@ai-sdk/openai 3.0.0-beta.57 → 3.0.0-beta.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,13 +2,13 @@ import { LanguageModelV3, EmbeddingModelV3, ImageModelV3, TranscriptionModelV3Ca
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
3
  import { InferSchema, FetchFunction } from '@ai-sdk/provider-utils';
4
4
 
5
- type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | 'gpt-4.1' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4' | 'gpt-4-0613' | 'gpt-4.5-preview' | 'gpt-4.5-preview-2025-02-27' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'chatgpt-4o-latest' | 'gpt-5' | 'gpt-5-2025-08-07' | 'gpt-5-mini' | 'gpt-5-mini-2025-08-07' | 'gpt-5-nano' | 'gpt-5-nano-2025-08-07' | 'gpt-5-chat-latest' | (string & {});
5
+ type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | 'gpt-4.1' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4' | 'gpt-4-0613' | 'gpt-4.5-preview' | 'gpt-4.5-preview-2025-02-27' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'chatgpt-4o-latest' | 'gpt-5' | 'gpt-5-2025-08-07' | 'gpt-5-mini' | 'gpt-5-mini-2025-08-07' | 'gpt-5-nano' | 'gpt-5-nano-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5.1' | 'gpt-5.1-chat-latest' | (string & {});
6
6
  declare const openaiChatLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<{
7
7
  logitBias?: Record<number, number> | undefined;
8
8
  logprobs?: number | boolean | undefined;
9
9
  parallelToolCalls?: boolean | undefined;
10
10
  user?: string | undefined;
11
- reasoningEffort?: "minimal" | "low" | "medium" | "high" | undefined;
11
+ reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | undefined;
12
12
  maxCompletionTokens?: number | undefined;
13
13
  store?: boolean | undefined;
14
14
  metadata?: Record<string, string> | undefined;
@@ -18,6 +18,7 @@ declare const openaiChatLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<
18
18
  strictJsonSchema?: boolean | undefined;
19
19
  textVerbosity?: "low" | "medium" | "high" | undefined;
20
20
  promptCacheKey?: string | undefined;
21
+ promptCacheRetention?: "in_memory" | "24h" | undefined;
21
22
  safetyIdentifier?: string | undefined;
22
23
  }>;
23
24
  type OpenAIChatLanguageModelOptions = InferSchema<typeof openaiChatLanguageModelOptions>;
@@ -186,7 +187,7 @@ declare class OpenAISpeechModel implements SpeechModelV3 {
186
187
  doGenerate(options: Parameters<SpeechModelV3['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV3['doGenerate']>>>;
187
188
  }
188
189
 
189
- type OpenAIResponsesModelId = 'chatgpt-4o-latest' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo' | 'gpt-4-0613' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-turbo' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1' | 'gpt-4' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini' | 'gpt-4o' | 'gpt-5-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5-codex' | 'gpt-5-mini-2025-08-07' | 'gpt-5-mini' | 'gpt-5-nano-2025-08-07' | 'gpt-5-nano' | 'gpt-5-pro-2025-10-06' | 'gpt-5-pro' | 'gpt-5' | 'o1-2024-12-17' | 'o1' | 'o3-2025-04-16' | 'o3-mini-2025-01-31' | 'o3-mini' | 'o3' | (string & {});
190
+ type OpenAIResponsesModelId = 'chatgpt-4o-latest' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo' | 'gpt-4-0613' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-turbo' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1' | 'gpt-4' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini' | 'gpt-4o' | 'gpt-5.1' | 'gpt-5.1-chat-latest' | 'gpt-5.1-codex-mini' | 'gpt-5.1-codex' | 'gpt-5-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5-codex' | 'gpt-5-mini-2025-08-07' | 'gpt-5-mini' | 'gpt-5-nano-2025-08-07' | 'gpt-5-nano' | 'gpt-5-pro-2025-10-06' | 'gpt-5-pro' | 'gpt-5' | 'o1-2024-12-17' | 'o1' | 'o3-2025-04-16' | 'o3-mini-2025-01-31' | 'o3-mini' | 'o3' | (string & {});
190
191
 
191
192
  declare class OpenAIResponsesLanguageModel implements LanguageModelV3 {
192
193
  readonly specificationVersion = "v3";
@@ -2,13 +2,13 @@ import { LanguageModelV3, EmbeddingModelV3, ImageModelV3, TranscriptionModelV3Ca
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
3
  import { InferSchema, FetchFunction } from '@ai-sdk/provider-utils';
4
4
 
5
- type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | 'gpt-4.1' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4' | 'gpt-4-0613' | 'gpt-4.5-preview' | 'gpt-4.5-preview-2025-02-27' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'chatgpt-4o-latest' | 'gpt-5' | 'gpt-5-2025-08-07' | 'gpt-5-mini' | 'gpt-5-mini-2025-08-07' | 'gpt-5-nano' | 'gpt-5-nano-2025-08-07' | 'gpt-5-chat-latest' | (string & {});
5
+ type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | 'gpt-4.1' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4' | 'gpt-4-0613' | 'gpt-4.5-preview' | 'gpt-4.5-preview-2025-02-27' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'chatgpt-4o-latest' | 'gpt-5' | 'gpt-5-2025-08-07' | 'gpt-5-mini' | 'gpt-5-mini-2025-08-07' | 'gpt-5-nano' | 'gpt-5-nano-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5.1' | 'gpt-5.1-chat-latest' | (string & {});
6
6
  declare const openaiChatLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<{
7
7
  logitBias?: Record<number, number> | undefined;
8
8
  logprobs?: number | boolean | undefined;
9
9
  parallelToolCalls?: boolean | undefined;
10
10
  user?: string | undefined;
11
- reasoningEffort?: "minimal" | "low" | "medium" | "high" | undefined;
11
+ reasoningEffort?: "none" | "minimal" | "low" | "medium" | "high" | undefined;
12
12
  maxCompletionTokens?: number | undefined;
13
13
  store?: boolean | undefined;
14
14
  metadata?: Record<string, string> | undefined;
@@ -18,6 +18,7 @@ declare const openaiChatLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<
18
18
  strictJsonSchema?: boolean | undefined;
19
19
  textVerbosity?: "low" | "medium" | "high" | undefined;
20
20
  promptCacheKey?: string | undefined;
21
+ promptCacheRetention?: "in_memory" | "24h" | undefined;
21
22
  safetyIdentifier?: string | undefined;
22
23
  }>;
23
24
  type OpenAIChatLanguageModelOptions = InferSchema<typeof openaiChatLanguageModelOptions>;
@@ -186,7 +187,7 @@ declare class OpenAISpeechModel implements SpeechModelV3 {
186
187
  doGenerate(options: Parameters<SpeechModelV3['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV3['doGenerate']>>>;
187
188
  }
188
189
 
189
- type OpenAIResponsesModelId = 'chatgpt-4o-latest' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo' | 'gpt-4-0613' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-turbo' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1' | 'gpt-4' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini' | 'gpt-4o' | 'gpt-5-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5-codex' | 'gpt-5-mini-2025-08-07' | 'gpt-5-mini' | 'gpt-5-nano-2025-08-07' | 'gpt-5-nano' | 'gpt-5-pro-2025-10-06' | 'gpt-5-pro' | 'gpt-5' | 'o1-2024-12-17' | 'o1' | 'o3-2025-04-16' | 'o3-mini-2025-01-31' | 'o3-mini' | 'o3' | (string & {});
190
+ type OpenAIResponsesModelId = 'chatgpt-4o-latest' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo' | 'gpt-4-0613' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-turbo' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1' | 'gpt-4' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini' | 'gpt-4o' | 'gpt-5.1' | 'gpt-5.1-chat-latest' | 'gpt-5.1-codex-mini' | 'gpt-5.1-codex' | 'gpt-5-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5-codex' | 'gpt-5-mini-2025-08-07' | 'gpt-5-mini' | 'gpt-5-nano-2025-08-07' | 'gpt-5-nano' | 'gpt-5-pro-2025-10-06' | 'gpt-5-pro' | 'gpt-5' | 'o1-2024-12-17' | 'o1' | 'o3-2025-04-16' | 'o3-mini-2025-01-31' | 'o3-mini' | 'o3' | (string & {});
190
191
 
191
192
  declare class OpenAIResponsesLanguageModel implements LanguageModelV3 {
192
193
  readonly specificationVersion = "v3";
@@ -465,7 +465,7 @@ var openaiChatLanguageModelOptions = (0, import_provider_utils4.lazySchema)(
465
465
  /**
466
466
  * Reasoning effort for reasoning models. Defaults to `medium`.
467
467
  */
468
- reasoningEffort: import_v43.z.enum(["minimal", "low", "medium", "high"]).optional(),
468
+ reasoningEffort: import_v43.z.enum(["none", "minimal", "low", "medium", "high"]).optional(),
469
469
  /**
470
470
  * Maximum number of completion tokens to generate. Useful for reasoning models.
471
471
  */
@@ -515,6 +515,15 @@ var openaiChatLanguageModelOptions = (0, import_provider_utils4.lazySchema)(
515
515
  * Useful for improving cache hit rates and working around automatic caching issues.
516
516
  */
517
517
  promptCacheKey: import_v43.z.string().optional(),
518
+ /**
519
+ * The retention policy for the prompt cache.
520
+ * - 'in_memory': Default. Standard prompt caching behavior.
521
+ * - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
522
+ * Currently only available for 5.1 series models.
523
+ *
524
+ * @default 'in_memory'
525
+ */
526
+ promptCacheRetention: import_v43.z.enum(["in_memory", "24h"]).optional(),
518
527
  /**
519
528
  * A stable identifier used to help detect users of your application
520
529
  * that may be violating OpenAI's usage policies. The IDs should be a
@@ -681,6 +690,7 @@ var OpenAIChatLanguageModel = class {
681
690
  reasoning_effort: openaiOptions.reasoningEffort,
682
691
  service_tier: openaiOptions.serviceTier,
683
692
  prompt_cache_key: openaiOptions.promptCacheKey,
693
+ prompt_cache_retention: openaiOptions.promptCacheRetention,
684
694
  safety_identifier: openaiOptions.safetyIdentifier,
685
695
  // messages:
686
696
  messages
@@ -3060,7 +3070,11 @@ var openaiResponsesReasoningModelIds = [
3060
3070
  "gpt-5-nano",
3061
3071
  "gpt-5-nano-2025-08-07",
3062
3072
  "gpt-5-pro",
3063
- "gpt-5-pro-2025-10-06"
3073
+ "gpt-5-pro-2025-10-06",
3074
+ "gpt-5.1",
3075
+ "gpt-5.1-chat-latest",
3076
+ "gpt-5.1-codex-mini",
3077
+ "gpt-5.1-codex"
3064
3078
  ];
3065
3079
  var openaiResponsesModelIds = [
3066
3080
  "gpt-4.1",
@@ -3133,6 +3147,15 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils22.lazySchem
3133
3147
  parallelToolCalls: import_v415.z.boolean().nullish(),
3134
3148
  previousResponseId: import_v415.z.string().nullish(),
3135
3149
  promptCacheKey: import_v415.z.string().nullish(),
3150
+ /**
3151
+ * The retention policy for the prompt cache.
3152
+ * - 'in_memory': Default. Standard prompt caching behavior.
3153
+ * - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
3154
+ * Currently only available for 5.1 series models.
3155
+ *
3156
+ * @default 'in_memory'
3157
+ */
3158
+ promptCacheRetention: import_v415.z.enum(["in_memory", "24h"]).nullish(),
3136
3159
  reasoningEffort: import_v415.z.string().nullish(),
3137
3160
  reasoningSummary: import_v415.z.string().nullish(),
3138
3161
  safetyIdentifier: import_v415.z.string().nullish(),
@@ -3768,6 +3791,7 @@ var OpenAIResponsesLanguageModel = class {
3768
3791
  service_tier: openaiOptions == null ? void 0 : openaiOptions.serviceTier,
3769
3792
  include,
3770
3793
  prompt_cache_key: openaiOptions == null ? void 0 : openaiOptions.promptCacheKey,
3794
+ prompt_cache_retention: openaiOptions == null ? void 0 : openaiOptions.promptCacheRetention,
3771
3795
  safety_identifier: openaiOptions == null ? void 0 : openaiOptions.safetyIdentifier,
3772
3796
  top_logprobs: topLogprobs,
3773
3797
  truncation: openaiOptions == null ? void 0 : openaiOptions.truncation,