@ai-sdk/openai 2.0.65 → 2.0.67

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 2.0.67
4
+
5
+ ### Patch Changes
6
+
7
+ - 3735f5a: feat(openai): Add support for 'promptCacheRetention: 24h' for gpt5.1 series
8
+
9
+ ## 2.0.66
10
+
11
+ ### Patch Changes
12
+
13
+ - 73f9178: feat(openai): add 'gpt-5.1' modelID
14
+
3
15
  ## 2.0.65
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -2,13 +2,13 @@ import { ProviderV2, LanguageModelV2, EmbeddingModelV2, ImageModelV2, Transcript
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
3
  import { InferValidator, 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.LazyValidator<{
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.LazyValidat
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 = InferValidator<typeof openaiChatLanguageModelOptions>;
@@ -322,7 +323,7 @@ declare const openaiTools: {
322
323
  }>;
323
324
  };
324
325
 
325
- 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 & {});
326
+ 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 & {});
326
327
  declare const openaiResponsesProviderOptionsSchema: _ai_sdk_provider_utils.LazyValidator<{
327
328
  include?: ("file_search_call.results" | "message.output_text.logprobs" | "reasoning.encrypted_content")[] | null | undefined;
328
329
  instructions?: string | null | undefined;
@@ -332,6 +333,7 @@ declare const openaiResponsesProviderOptionsSchema: _ai_sdk_provider_utils.LazyV
332
333
  parallelToolCalls?: boolean | null | undefined;
333
334
  previousResponseId?: string | null | undefined;
334
335
  promptCacheKey?: string | null | undefined;
336
+ promptCacheRetention?: "in_memory" | "24h" | null | undefined;
335
337
  reasoningEffort?: string | null | undefined;
336
338
  reasoningSummary?: string | null | undefined;
337
339
  safetyIdentifier?: string | null | undefined;
package/dist/index.d.ts CHANGED
@@ -2,13 +2,13 @@ import { ProviderV2, LanguageModelV2, EmbeddingModelV2, ImageModelV2, Transcript
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
3
  import { InferValidator, 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.LazyValidator<{
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.LazyValidat
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 = InferValidator<typeof openaiChatLanguageModelOptions>;
@@ -322,7 +323,7 @@ declare const openaiTools: {
322
323
  }>;
323
324
  };
324
325
 
325
- 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 & {});
326
+ 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 & {});
326
327
  declare const openaiResponsesProviderOptionsSchema: _ai_sdk_provider_utils.LazyValidator<{
327
328
  include?: ("file_search_call.results" | "message.output_text.logprobs" | "reasoning.encrypted_content")[] | null | undefined;
328
329
  instructions?: string | null | undefined;
@@ -332,6 +333,7 @@ declare const openaiResponsesProviderOptionsSchema: _ai_sdk_provider_utils.LazyV
332
333
  parallelToolCalls?: boolean | null | undefined;
333
334
  previousResponseId?: string | null | undefined;
334
335
  promptCacheKey?: string | null | undefined;
336
+ promptCacheRetention?: "in_memory" | "24h" | null | undefined;
335
337
  reasoningEffort?: string | null | undefined;
336
338
  reasoningSummary?: string | null | undefined;
337
339
  safetyIdentifier?: string | null | undefined;
package/dist/index.js CHANGED
@@ -433,7 +433,7 @@ var openaiChatLanguageModelOptions = (0, import_provider_utils4.lazyValidator)(
433
433
  /**
434
434
  * Reasoning effort for reasoning models. Defaults to `medium`.
435
435
  */
436
- reasoningEffort: import_v43.z.enum(["minimal", "low", "medium", "high"]).optional(),
436
+ reasoningEffort: import_v43.z.enum(["none", "minimal", "low", "medium", "high"]).optional(),
437
437
  /**
438
438
  * Maximum number of completion tokens to generate. Useful for reasoning models.
439
439
  */
@@ -483,6 +483,15 @@ var openaiChatLanguageModelOptions = (0, import_provider_utils4.lazyValidator)(
483
483
  * Useful for improving cache hit rates and working around automatic caching issues.
484
484
  */
485
485
  promptCacheKey: import_v43.z.string().optional(),
486
+ /**
487
+ * The retention policy for the prompt cache.
488
+ * - 'in_memory': Default. Standard prompt caching behavior.
489
+ * - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
490
+ * Currently only available for 5.1 series models.
491
+ *
492
+ * @default 'in_memory'
493
+ */
494
+ promptCacheRetention: import_v43.z.enum(["in_memory", "24h"]).optional(),
486
495
  /**
487
496
  * A stable identifier used to help detect users of your application
488
497
  * that may be violating OpenAI's usage policies. The IDs should be a
@@ -649,6 +658,7 @@ var OpenAIChatLanguageModel = class {
649
658
  reasoning_effort: openaiOptions.reasoningEffort,
650
659
  service_tier: openaiOptions.serviceTier,
651
660
  prompt_cache_key: openaiOptions.promptCacheKey,
661
+ prompt_cache_retention: openaiOptions.promptCacheRetention,
652
662
  safety_identifier: openaiOptions.safetyIdentifier,
653
663
  // messages:
654
664
  messages
@@ -2843,7 +2853,11 @@ var openaiResponsesReasoningModelIds = [
2843
2853
  "gpt-5-nano",
2844
2854
  "gpt-5-nano-2025-08-07",
2845
2855
  "gpt-5-pro",
2846
- "gpt-5-pro-2025-10-06"
2856
+ "gpt-5-pro-2025-10-06",
2857
+ "gpt-5.1",
2858
+ "gpt-5.1-chat-latest",
2859
+ "gpt-5.1-codex-mini",
2860
+ "gpt-5.1-codex"
2847
2861
  ];
2848
2862
  var openaiResponsesModelIds = [
2849
2863
  "gpt-4.1",
@@ -2916,6 +2930,15 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils22.lazyValid
2916
2930
  parallelToolCalls: import_v417.z.boolean().nullish(),
2917
2931
  previousResponseId: import_v417.z.string().nullish(),
2918
2932
  promptCacheKey: import_v417.z.string().nullish(),
2933
+ /**
2934
+ * The retention policy for the prompt cache.
2935
+ * - 'in_memory': Default. Standard prompt caching behavior.
2936
+ * - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
2937
+ * Currently only available for 5.1 series models.
2938
+ *
2939
+ * @default 'in_memory'
2940
+ */
2941
+ promptCacheRetention: import_v417.z.enum(["in_memory", "24h"]).nullish(),
2919
2942
  reasoningEffort: import_v417.z.string().nullish(),
2920
2943
  reasoningSummary: import_v417.z.string().nullish(),
2921
2944
  safetyIdentifier: import_v417.z.string().nullish(),
@@ -3199,6 +3222,7 @@ var OpenAIResponsesLanguageModel = class {
3199
3222
  service_tier: openaiOptions == null ? void 0 : openaiOptions.serviceTier,
3200
3223
  include,
3201
3224
  prompt_cache_key: openaiOptions == null ? void 0 : openaiOptions.promptCacheKey,
3225
+ prompt_cache_retention: openaiOptions == null ? void 0 : openaiOptions.promptCacheRetention,
3202
3226
  safety_identifier: openaiOptions == null ? void 0 : openaiOptions.safetyIdentifier,
3203
3227
  top_logprobs: topLogprobs,
3204
3228
  truncation: openaiOptions == null ? void 0 : openaiOptions.truncation,
@@ -4460,7 +4484,7 @@ var OpenAITranscriptionModel = class {
4460
4484
  };
4461
4485
 
4462
4486
  // src/version.ts
4463
- var VERSION = true ? "2.0.65" : "0.0.0-test";
4487
+ var VERSION = true ? "2.0.67" : "0.0.0-test";
4464
4488
 
4465
4489
  // src/openai-provider.ts
4466
4490
  function createOpenAI(options = {}) {