@ai-sdk/openai 2.0.33 → 2.0.35

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/dist/index.mjs CHANGED
@@ -1,7 +1,8 @@
1
1
  // src/openai-provider.ts
2
2
  import {
3
3
  loadApiKey,
4
- withoutTrailingSlash
4
+ withoutTrailingSlash,
5
+ withUserAgentSuffix
5
6
  } from "@ai-sdk/provider-utils";
6
7
 
7
8
  // src/chat/openai-chat-language-model.ts
@@ -250,7 +251,7 @@ function mapOpenAIFinishReason(finishReason) {
250
251
 
251
252
  // src/chat/openai-chat-options.ts
252
253
  import { z as z2 } from "zod/v4";
253
- var openaiProviderOptions = z2.object({
254
+ var openaiChatLanguageModelOptions = z2.object({
254
255
  /**
255
256
  * Modify the likelihood of specified tokens appearing in the completion.
256
257
  *
@@ -434,7 +435,7 @@ var OpenAIChatLanguageModel = class {
434
435
  const openaiOptions = (_a = await parseProviderOptions({
435
436
  provider: "openai",
436
437
  providerOptions,
437
- schema: openaiProviderOptions
438
+ schema: openaiChatLanguageModelOptions
438
439
  })) != null ? _a : {};
439
440
  const structuredOutputs = (_b = openaiOptions.structuredOutputs) != null ? _b : true;
440
441
  if (topK != null) {
@@ -3902,21 +3903,27 @@ var openaiTranscriptionResponseSchema = z18.object({
3902
3903
  ).nullish()
3903
3904
  });
3904
3905
 
3906
+ // src/version.ts
3907
+ var VERSION = true ? "2.0.35" : "0.0.0-test";
3908
+
3905
3909
  // src/openai-provider.ts
3906
3910
  function createOpenAI(options = {}) {
3907
3911
  var _a, _b;
3908
3912
  const baseURL = (_a = withoutTrailingSlash(options.baseURL)) != null ? _a : "https://api.openai.com/v1";
3909
3913
  const providerName = (_b = options.name) != null ? _b : "openai";
3910
- const getHeaders = () => ({
3911
- Authorization: `Bearer ${loadApiKey({
3912
- apiKey: options.apiKey,
3913
- environmentVariableName: "OPENAI_API_KEY",
3914
- description: "OpenAI"
3915
- })}`,
3916
- "OpenAI-Organization": options.organization,
3917
- "OpenAI-Project": options.project,
3918
- ...options.headers
3919
- });
3914
+ const getHeaders = () => withUserAgentSuffix(
3915
+ {
3916
+ Authorization: `Bearer ${loadApiKey({
3917
+ apiKey: options.apiKey,
3918
+ environmentVariableName: "OPENAI_API_KEY",
3919
+ description: "OpenAI"
3920
+ })}`,
3921
+ "OpenAI-Organization": options.organization,
3922
+ "OpenAI-Project": options.project,
3923
+ ...options.headers
3924
+ },
3925
+ `ai-sdk/openai/${VERSION}`
3926
+ );
3920
3927
  const createChatModel = (modelId) => new OpenAIChatLanguageModel(modelId, {
3921
3928
  provider: `${providerName}.chat`,
3922
3929
  url: ({ path }) => `${baseURL}${path}`,
@@ -3991,6 +3998,7 @@ function createOpenAI(options = {}) {
3991
3998
  }
3992
3999
  var openai = createOpenAI();
3993
4000
  export {
4001
+ VERSION,
3994
4002
  createOpenAI,
3995
4003
  openai
3996
4004
  };