@ai-sdk/openai 3.0.0-beta.60 → 3.0.0-beta.61

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,11 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 3.0.0-beta.61
4
+
5
+ ### Patch Changes
6
+
7
+ - 23f132b: fix: error schema for Responses API
8
+
3
9
  ## 3.0.0-beta.60
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -2847,10 +2847,13 @@ var openaiResponsesChunkSchema = (0, import_provider_utils22.lazySchema)(
2847
2847
  }),
2848
2848
  import_v417.z.object({
2849
2849
  type: import_v417.z.literal("error"),
2850
- code: import_v417.z.string(),
2851
- message: import_v417.z.string(),
2852
- param: import_v417.z.string().nullish(),
2853
- sequence_number: import_v417.z.number()
2850
+ sequence_number: import_v417.z.number(),
2851
+ error: import_v417.z.object({
2852
+ type: import_v417.z.string(),
2853
+ code: import_v417.z.string(),
2854
+ message: import_v417.z.string(),
2855
+ param: import_v417.z.string().nullish()
2856
+ })
2854
2857
  }),
2855
2858
  import_v417.z.object({ type: import_v417.z.string() }).loose().transform((value) => ({
2856
2859
  type: "unknown_chunk",
@@ -2863,13 +2866,15 @@ var openaiResponsesChunkSchema = (0, import_provider_utils22.lazySchema)(
2863
2866
  var openaiResponsesResponseSchema = (0, import_provider_utils22.lazySchema)(
2864
2867
  () => (0, import_provider_utils22.zodSchema)(
2865
2868
  import_v417.z.object({
2866
- id: import_v417.z.string(),
2867
- created_at: import_v417.z.number(),
2869
+ id: import_v417.z.string().optional(),
2870
+ created_at: import_v417.z.number().optional(),
2868
2871
  error: import_v417.z.object({
2869
- code: import_v417.z.string(),
2870
- message: import_v417.z.string()
2872
+ message: import_v417.z.string(),
2873
+ type: import_v417.z.string(),
2874
+ param: import_v417.z.string().nullish(),
2875
+ code: import_v417.z.string()
2871
2876
  }).nullish(),
2872
- model: import_v417.z.string(),
2877
+ model: import_v417.z.string().optional(),
2873
2878
  output: import_v417.z.array(
2874
2879
  import_v417.z.discriminatedUnion("type", [
2875
2880
  import_v417.z.object({
@@ -3072,7 +3077,7 @@ var openaiResponsesResponseSchema = (0, import_provider_utils22.lazySchema)(
3072
3077
  approval_request_id: import_v417.z.string()
3073
3078
  })
3074
3079
  ])
3075
- ),
3080
+ ).optional(),
3076
3081
  service_tier: import_v417.z.string().nullish(),
3077
3082
  incomplete_details: import_v417.z.object({ reason: import_v417.z.string() }).nullish(),
3078
3083
  usage: import_v417.z.object({
@@ -3080,7 +3085,7 @@ var openaiResponsesResponseSchema = (0, import_provider_utils22.lazySchema)(
3080
3085
  input_tokens_details: import_v417.z.object({ cached_tokens: import_v417.z.number().nullish() }).nullish(),
3081
3086
  output_tokens: import_v417.z.number(),
3082
3087
  output_tokens_details: import_v417.z.object({ reasoning_tokens: import_v417.z.number().nullish() }).nullish()
3083
- })
3088
+ }).optional()
3084
3089
  })
3085
3090
  )
3086
3091
  );
@@ -3960,6 +3965,7 @@ var OpenAIResponsesLanguageModel = class {
3960
3965
  if (typeof response.service_tier === "string") {
3961
3966
  providerMetadata.openai.serviceTier = response.service_tier;
3962
3967
  }
3968
+ const usage = response.usage;
3963
3969
  return {
3964
3970
  content,
3965
3971
  finishReason: mapOpenAIResponseFinishReason({
@@ -3967,11 +3973,11 @@ var OpenAIResponsesLanguageModel = class {
3967
3973
  hasFunctionCall
3968
3974
  }),
3969
3975
  usage: {
3970
- inputTokens: response.usage.input_tokens,
3971
- outputTokens: response.usage.output_tokens,
3972
- totalTokens: response.usage.input_tokens + response.usage.output_tokens,
3973
- reasoningTokens: (_z = (_y = response.usage.output_tokens_details) == null ? void 0 : _y.reasoning_tokens) != null ? _z : void 0,
3974
- cachedInputTokens: (_B = (_A = response.usage.input_tokens_details) == null ? void 0 : _A.cached_tokens) != null ? _B : void 0
3976
+ inputTokens: usage.input_tokens,
3977
+ outputTokens: usage.output_tokens,
3978
+ totalTokens: usage.input_tokens + usage.output_tokens,
3979
+ reasoningTokens: (_z = (_y = usage.output_tokens_details) == null ? void 0 : _y.reasoning_tokens) != null ? _z : void 0,
3980
+ cachedInputTokens: (_B = (_A = usage.input_tokens_details) == null ? void 0 : _A.cached_tokens) != null ? _B : void 0
3975
3981
  },
3976
3982
  request: { body },
3977
3983
  response: {
@@ -4970,7 +4976,7 @@ var OpenAITranscriptionModel = class {
4970
4976
  };
4971
4977
 
4972
4978
  // src/version.ts
4973
- var VERSION = true ? "3.0.0-beta.60" : "0.0.0-test";
4979
+ var VERSION = true ? "3.0.0-beta.61" : "0.0.0-test";
4974
4980
 
4975
4981
  // src/openai-provider.ts
4976
4982
  function createOpenAI(options = {}) {