@ai-sdk/openai 1.3.9 → 1.3.11

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.
@@ -1,8 +1,8 @@
1
- import { LanguageModelV1, EmbeddingModelV1, ImageModelV1, TranscriptionModelV1CallOptions, TranscriptionModelV1 } from '@ai-sdk/provider';
1
+ import { LanguageModelV1, EmbeddingModelV1, ImageModelV1, TranscriptionModelV1CallOptions, TranscriptionModelV1, SpeechModelV1 } from '@ai-sdk/provider';
2
2
  import { FetchFunction } from '@ai-sdk/provider-utils';
3
3
  import { z } from 'zod';
4
4
 
5
- type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o1-mini' | 'o1-mini-2024-09-12' | 'o1-preview' | 'o1-preview-2024-09-12' | 'o3-mini' | 'o3-mini-2025-01-31' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-audio-preview' | 'gpt-4o-audio-preview-2024-10-01' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-turbo-preview' | 'gpt-4-0125-preview' | 'gpt-4-1106-preview' | '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' | (string & {});
5
+ type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o1-mini' | 'o1-mini-2024-09-12' | 'o1-preview' | 'o1-preview-2024-09-12' | 'o3-mini' | 'o3-mini-2025-01-31' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-audio-preview' | 'gpt-4o-audio-preview-2024-10-01' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-search-preview' | 'gpt-4o-search-preview-2025-03-11' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-turbo-preview' | 'gpt-4-0125-preview' | 'gpt-4-1106-preview' | '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' | (string & {});
6
6
  interface OpenAIChatSettings {
7
7
  /**
8
8
  Modify the likelihood of specified tokens appearing in the completion.
@@ -270,28 +270,28 @@ type OpenAITranscriptionModelOptions = {
270
270
  timestamp_granularities?: Array<'word' | 'segment'>;
271
271
  };
272
272
 
273
- declare const OpenAIProviderOptionsSchema: z.ZodObject<{
274
- include: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
275
- language: z.ZodOptional<z.ZodString>;
276
- prompt: z.ZodOptional<z.ZodString>;
277
- temperature: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
278
- timestampGranularities: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEnum<["word", "segment"]>, "many">>>;
273
+ declare const openAIProviderOptionsSchema: z.ZodObject<{
274
+ include: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
275
+ language: z.ZodOptional<z.ZodNullable<z.ZodString>>;
276
+ prompt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
277
+ temperature: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
278
+ timestampGranularities: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<["word", "segment"]>, "many">>>>;
279
279
  }, "strip", z.ZodTypeAny, {
280
- temperature: number;
281
- timestampGranularities: ("word" | "segment")[];
282
- prompt?: string | undefined;
283
- include?: string[] | undefined;
284
- language?: string | undefined;
280
+ temperature: number | null;
281
+ timestampGranularities: ("word" | "segment")[] | null;
282
+ prompt?: string | null | undefined;
283
+ include?: string[] | null | undefined;
284
+ language?: string | null | undefined;
285
285
  }, {
286
- prompt?: string | undefined;
287
- temperature?: number | undefined;
288
- include?: string[] | undefined;
289
- language?: string | undefined;
290
- timestampGranularities?: ("word" | "segment")[] | undefined;
286
+ prompt?: string | null | undefined;
287
+ temperature?: number | null | undefined;
288
+ include?: string[] | null | undefined;
289
+ language?: string | null | undefined;
290
+ timestampGranularities?: ("word" | "segment")[] | null | undefined;
291
291
  }>;
292
292
  type OpenAITranscriptionCallOptions = Omit<TranscriptionModelV1CallOptions, 'providerOptions'> & {
293
293
  providerOptions?: {
294
- openai?: z.infer<typeof OpenAIProviderOptionsSchema>;
294
+ openai?: z.infer<typeof openAIProviderOptionsSchema>;
295
295
  };
296
296
  };
297
297
  interface OpenAITranscriptionModelConfig extends OpenAIConfig {
@@ -309,6 +309,34 @@ declare class OpenAITranscriptionModel implements TranscriptionModelV1 {
309
309
  doGenerate(options: OpenAITranscriptionCallOptions): Promise<Awaited<ReturnType<TranscriptionModelV1['doGenerate']>>>;
310
310
  }
311
311
 
312
+ type OpenAISpeechModelId = 'tts-1' | 'tts-1-hd' | 'gpt-4o-mini-tts' | (string & {});
313
+
314
+ declare const OpenAIProviderOptionsSchema: z.ZodObject<{
315
+ instructions: z.ZodOptional<z.ZodNullable<z.ZodString>>;
316
+ speed: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodNumber>>>;
317
+ }, "strip", z.ZodTypeAny, {
318
+ instructions?: string | null | undefined;
319
+ speed?: number | null | undefined;
320
+ }, {
321
+ instructions?: string | null | undefined;
322
+ speed?: number | null | undefined;
323
+ }>;
324
+ type OpenAISpeechCallOptions = z.infer<typeof OpenAIProviderOptionsSchema>;
325
+ interface OpenAISpeechModelConfig extends OpenAIConfig {
326
+ _internal?: {
327
+ currentDate?: () => Date;
328
+ };
329
+ }
330
+ declare class OpenAISpeechModel implements SpeechModelV1 {
331
+ readonly modelId: OpenAISpeechModelId;
332
+ private readonly config;
333
+ readonly specificationVersion = "v1";
334
+ get provider(): string;
335
+ constructor(modelId: OpenAISpeechModelId, config: OpenAISpeechModelConfig);
336
+ private getArgs;
337
+ doGenerate(options: Parameters<SpeechModelV1['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV1['doGenerate']>>>;
338
+ }
339
+
312
340
  type OpenAIResponsesModelId = 'o1' | 'o1-2024-12-17' | 'o1-mini' | 'o1-mini-2024-09-12' | 'o1-preview' | 'o1-preview-2024-09-12' | 'o3-mini' | 'o3-mini-2025-01-31' | '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-turbo-preview' | 'gpt-4-0125-preview' | 'gpt-4-1106-preview' | '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' | (string & {});
313
341
 
314
342
  declare class OpenAIResponsesLanguageModel implements LanguageModelV1 {
@@ -336,20 +364,20 @@ declare const openaiResponsesProviderOptionsSchema: z.ZodObject<{
336
364
  store?: boolean | null | undefined;
337
365
  metadata?: any;
338
366
  reasoningEffort?: string | null | undefined;
367
+ instructions?: string | null | undefined;
339
368
  parallelToolCalls?: boolean | null | undefined;
340
369
  previousResponseId?: string | null | undefined;
341
370
  strictSchemas?: boolean | null | undefined;
342
- instructions?: string | null | undefined;
343
371
  }, {
344
372
  user?: string | null | undefined;
345
373
  store?: boolean | null | undefined;
346
374
  metadata?: any;
347
375
  reasoningEffort?: string | null | undefined;
376
+ instructions?: string | null | undefined;
348
377
  parallelToolCalls?: boolean | null | undefined;
349
378
  previousResponseId?: string | null | undefined;
350
379
  strictSchemas?: boolean | null | undefined;
351
- instructions?: string | null | undefined;
352
380
  }>;
353
381
  type OpenAIResponsesProviderOptions = z.infer<typeof openaiResponsesProviderOptionsSchema>;
354
382
 
355
- export { OpenAIChatLanguageModel, type OpenAIChatModelId, type OpenAIChatSettings, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionSettings, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingSettings, OpenAIImageModel, type OpenAIImageModelId, type OpenAIImageSettings, OpenAIResponsesLanguageModel, type OpenAIResponsesProviderOptions, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionModelOptions, modelMaxImagesPerCall };
383
+ export { OpenAIChatLanguageModel, type OpenAIChatModelId, type OpenAIChatSettings, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionSettings, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingSettings, OpenAIImageModel, type OpenAIImageModelId, type OpenAIImageSettings, OpenAIResponsesLanguageModel, type OpenAIResponsesProviderOptions, type OpenAISpeechCallOptions, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionModelOptions, modelMaxImagesPerCall };
@@ -1,8 +1,8 @@
1
- import { LanguageModelV1, EmbeddingModelV1, ImageModelV1, TranscriptionModelV1CallOptions, TranscriptionModelV1 } from '@ai-sdk/provider';
1
+ import { LanguageModelV1, EmbeddingModelV1, ImageModelV1, TranscriptionModelV1CallOptions, TranscriptionModelV1, SpeechModelV1 } from '@ai-sdk/provider';
2
2
  import { FetchFunction } from '@ai-sdk/provider-utils';
3
3
  import { z } from 'zod';
4
4
 
5
- type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o1-mini' | 'o1-mini-2024-09-12' | 'o1-preview' | 'o1-preview-2024-09-12' | 'o3-mini' | 'o3-mini-2025-01-31' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-audio-preview' | 'gpt-4o-audio-preview-2024-10-01' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-turbo-preview' | 'gpt-4-0125-preview' | 'gpt-4-1106-preview' | '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' | (string & {});
5
+ type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o1-mini' | 'o1-mini-2024-09-12' | 'o1-preview' | 'o1-preview-2024-09-12' | 'o3-mini' | 'o3-mini-2025-01-31' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-audio-preview' | 'gpt-4o-audio-preview-2024-10-01' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-search-preview' | 'gpt-4o-search-preview-2025-03-11' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-turbo-preview' | 'gpt-4-0125-preview' | 'gpt-4-1106-preview' | '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' | (string & {});
6
6
  interface OpenAIChatSettings {
7
7
  /**
8
8
  Modify the likelihood of specified tokens appearing in the completion.
@@ -270,28 +270,28 @@ type OpenAITranscriptionModelOptions = {
270
270
  timestamp_granularities?: Array<'word' | 'segment'>;
271
271
  };
272
272
 
273
- declare const OpenAIProviderOptionsSchema: z.ZodObject<{
274
- include: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
275
- language: z.ZodOptional<z.ZodString>;
276
- prompt: z.ZodOptional<z.ZodString>;
277
- temperature: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
278
- timestampGranularities: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEnum<["word", "segment"]>, "many">>>;
273
+ declare const openAIProviderOptionsSchema: z.ZodObject<{
274
+ include: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
275
+ language: z.ZodOptional<z.ZodNullable<z.ZodString>>;
276
+ prompt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
277
+ temperature: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
278
+ timestampGranularities: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<["word", "segment"]>, "many">>>>;
279
279
  }, "strip", z.ZodTypeAny, {
280
- temperature: number;
281
- timestampGranularities: ("word" | "segment")[];
282
- prompt?: string | undefined;
283
- include?: string[] | undefined;
284
- language?: string | undefined;
280
+ temperature: number | null;
281
+ timestampGranularities: ("word" | "segment")[] | null;
282
+ prompt?: string | null | undefined;
283
+ include?: string[] | null | undefined;
284
+ language?: string | null | undefined;
285
285
  }, {
286
- prompt?: string | undefined;
287
- temperature?: number | undefined;
288
- include?: string[] | undefined;
289
- language?: string | undefined;
290
- timestampGranularities?: ("word" | "segment")[] | undefined;
286
+ prompt?: string | null | undefined;
287
+ temperature?: number | null | undefined;
288
+ include?: string[] | null | undefined;
289
+ language?: string | null | undefined;
290
+ timestampGranularities?: ("word" | "segment")[] | null | undefined;
291
291
  }>;
292
292
  type OpenAITranscriptionCallOptions = Omit<TranscriptionModelV1CallOptions, 'providerOptions'> & {
293
293
  providerOptions?: {
294
- openai?: z.infer<typeof OpenAIProviderOptionsSchema>;
294
+ openai?: z.infer<typeof openAIProviderOptionsSchema>;
295
295
  };
296
296
  };
297
297
  interface OpenAITranscriptionModelConfig extends OpenAIConfig {
@@ -309,6 +309,34 @@ declare class OpenAITranscriptionModel implements TranscriptionModelV1 {
309
309
  doGenerate(options: OpenAITranscriptionCallOptions): Promise<Awaited<ReturnType<TranscriptionModelV1['doGenerate']>>>;
310
310
  }
311
311
 
312
+ type OpenAISpeechModelId = 'tts-1' | 'tts-1-hd' | 'gpt-4o-mini-tts' | (string & {});
313
+
314
+ declare const OpenAIProviderOptionsSchema: z.ZodObject<{
315
+ instructions: z.ZodOptional<z.ZodNullable<z.ZodString>>;
316
+ speed: z.ZodOptional<z.ZodNullable<z.ZodDefault<z.ZodNumber>>>;
317
+ }, "strip", z.ZodTypeAny, {
318
+ instructions?: string | null | undefined;
319
+ speed?: number | null | undefined;
320
+ }, {
321
+ instructions?: string | null | undefined;
322
+ speed?: number | null | undefined;
323
+ }>;
324
+ type OpenAISpeechCallOptions = z.infer<typeof OpenAIProviderOptionsSchema>;
325
+ interface OpenAISpeechModelConfig extends OpenAIConfig {
326
+ _internal?: {
327
+ currentDate?: () => Date;
328
+ };
329
+ }
330
+ declare class OpenAISpeechModel implements SpeechModelV1 {
331
+ readonly modelId: OpenAISpeechModelId;
332
+ private readonly config;
333
+ readonly specificationVersion = "v1";
334
+ get provider(): string;
335
+ constructor(modelId: OpenAISpeechModelId, config: OpenAISpeechModelConfig);
336
+ private getArgs;
337
+ doGenerate(options: Parameters<SpeechModelV1['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV1['doGenerate']>>>;
338
+ }
339
+
312
340
  type OpenAIResponsesModelId = 'o1' | 'o1-2024-12-17' | 'o1-mini' | 'o1-mini-2024-09-12' | 'o1-preview' | 'o1-preview-2024-09-12' | 'o3-mini' | 'o3-mini-2025-01-31' | '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-turbo-preview' | 'gpt-4-0125-preview' | 'gpt-4-1106-preview' | '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' | (string & {});
313
341
 
314
342
  declare class OpenAIResponsesLanguageModel implements LanguageModelV1 {
@@ -336,20 +364,20 @@ declare const openaiResponsesProviderOptionsSchema: z.ZodObject<{
336
364
  store?: boolean | null | undefined;
337
365
  metadata?: any;
338
366
  reasoningEffort?: string | null | undefined;
367
+ instructions?: string | null | undefined;
339
368
  parallelToolCalls?: boolean | null | undefined;
340
369
  previousResponseId?: string | null | undefined;
341
370
  strictSchemas?: boolean | null | undefined;
342
- instructions?: string | null | undefined;
343
371
  }, {
344
372
  user?: string | null | undefined;
345
373
  store?: boolean | null | undefined;
346
374
  metadata?: any;
347
375
  reasoningEffort?: string | null | undefined;
376
+ instructions?: string | null | undefined;
348
377
  parallelToolCalls?: boolean | null | undefined;
349
378
  previousResponseId?: string | null | undefined;
350
379
  strictSchemas?: boolean | null | undefined;
351
- instructions?: string | null | undefined;
352
380
  }>;
353
381
  type OpenAIResponsesProviderOptions = z.infer<typeof openaiResponsesProviderOptionsSchema>;
354
382
 
355
- export { OpenAIChatLanguageModel, type OpenAIChatModelId, type OpenAIChatSettings, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionSettings, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingSettings, OpenAIImageModel, type OpenAIImageModelId, type OpenAIImageSettings, OpenAIResponsesLanguageModel, type OpenAIResponsesProviderOptions, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionModelOptions, modelMaxImagesPerCall };
383
+ export { OpenAIChatLanguageModel, type OpenAIChatModelId, type OpenAIChatSettings, OpenAICompletionLanguageModel, type OpenAICompletionModelId, type OpenAICompletionSettings, OpenAIEmbeddingModel, type OpenAIEmbeddingModelId, type OpenAIEmbeddingSettings, OpenAIImageModel, type OpenAIImageModelId, type OpenAIImageSettings, OpenAIResponsesLanguageModel, type OpenAIResponsesProviderOptions, type OpenAISpeechCallOptions, OpenAISpeechModel, type OpenAISpeechModelId, type OpenAITranscriptionCallOptions, OpenAITranscriptionModel, type OpenAITranscriptionModelId, type OpenAITranscriptionModelOptions, modelMaxImagesPerCall };