@ai-sdk/openai 4.0.56 → 4.0.57

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.
@@ -906,20 +906,21 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
906
906
  incomplete_details?: {
907
907
  reason: string;
908
908
  } | null | undefined;
909
- usage?: {
909
+ usage?: (Record<string, JSONValue | undefined> & {
910
910
  input_tokens: number;
911
911
  output_tokens: number;
912
- input_tokens_details?: {
912
+ input_tokens_details?: (Record<string, JSONValue | undefined> & {
913
913
  cached_tokens?: number | null | undefined;
914
914
  cache_write_tokens?: number | null | undefined;
915
915
  orchestration_input_tokens?: number | null | undefined;
916
916
  orchestration_input_cached_tokens?: number | null | undefined;
917
- } | null | undefined;
918
- output_tokens_details?: {
917
+ }) | null | undefined;
918
+ output_tokens_details?: (Record<string, JSONValue | undefined> & {
919
919
  reasoning_tokens?: number | null | undefined;
920
920
  orchestration_output_tokens?: number | null | undefined;
921
- } | null | undefined;
922
- } | null | undefined;
921
+ }) | null | undefined;
922
+ total_tokens?: number | undefined;
923
+ }) | null | undefined;
923
924
  reasoning?: {
924
925
  context?: string | null | undefined;
925
926
  } | null | undefined;
@@ -936,20 +937,21 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
936
937
  incomplete_details?: {
937
938
  reason: string;
938
939
  } | null | undefined;
939
- usage?: {
940
+ usage?: (Record<string, JSONValue | undefined> & {
940
941
  input_tokens: number;
941
942
  output_tokens: number;
942
- input_tokens_details?: {
943
+ input_tokens_details?: (Record<string, JSONValue | undefined> & {
943
944
  cached_tokens?: number | null | undefined;
944
945
  cache_write_tokens?: number | null | undefined;
945
946
  orchestration_input_tokens?: number | null | undefined;
946
947
  orchestration_input_cached_tokens?: number | null | undefined;
947
- } | null | undefined;
948
- output_tokens_details?: {
948
+ }) | null | undefined;
949
+ output_tokens_details?: (Record<string, JSONValue | undefined> & {
949
950
  reasoning_tokens?: number | null | undefined;
950
951
  orchestration_output_tokens?: number | null | undefined;
951
- } | null | undefined;
952
- } | null | undefined;
952
+ }) | null | undefined;
953
+ total_tokens?: number | undefined;
954
+ }) | null | undefined;
953
955
  reasoning?: {
954
956
  context?: string | null | undefined;
955
957
  } | null | undefined;
@@ -4739,6 +4739,31 @@ var jsonValueSchema = z20.lazy(
4739
4739
  z20.record(z20.string(), jsonValueSchema.optional())
4740
4740
  ])
4741
4741
  );
4742
+ var jsonObjectSchema = z20.record(z20.string(), jsonValueSchema.optional());
4743
+ var openaiResponsesUsageSchema = z20.intersection(
4744
+ jsonObjectSchema,
4745
+ z20.object({
4746
+ input_tokens: z20.number(),
4747
+ input_tokens_details: z20.intersection(
4748
+ jsonObjectSchema,
4749
+ z20.object({
4750
+ cached_tokens: z20.number().nullish(),
4751
+ cache_write_tokens: z20.number().nullish(),
4752
+ orchestration_input_tokens: z20.number().nullish(),
4753
+ orchestration_input_cached_tokens: z20.number().nullish()
4754
+ })
4755
+ ).nullish(),
4756
+ output_tokens: z20.number(),
4757
+ output_tokens_details: z20.intersection(
4758
+ jsonObjectSchema,
4759
+ z20.object({
4760
+ reasoning_tokens: z20.number().nullish(),
4761
+ orchestration_output_tokens: z20.number().nullish()
4762
+ })
4763
+ ).nullish(),
4764
+ total_tokens: z20.number().optional()
4765
+ })
4766
+ );
4742
4767
  var openaiResponsesComputerSafetyCheckSchema = z20.object({
4743
4768
  id: z20.string(),
4744
4769
  code: z20.string().nullish(),
@@ -4935,20 +4960,7 @@ var openaiResponsesChunkSchema = lazySchema18(
4935
4960
  type: z20.enum(["response.completed", "response.incomplete"]),
4936
4961
  response: z20.object({
4937
4962
  incomplete_details: z20.object({ reason: z20.string() }).nullish(),
4938
- usage: z20.object({
4939
- input_tokens: z20.number(),
4940
- input_tokens_details: z20.object({
4941
- cached_tokens: z20.number().nullish(),
4942
- cache_write_tokens: z20.number().nullish(),
4943
- orchestration_input_tokens: z20.number().nullish(),
4944
- orchestration_input_cached_tokens: z20.number().nullish()
4945
- }).nullish(),
4946
- output_tokens: z20.number(),
4947
- output_tokens_details: z20.object({
4948
- reasoning_tokens: z20.number().nullish(),
4949
- orchestration_output_tokens: z20.number().nullish()
4950
- }).nullish()
4951
- }).nullish(),
4963
+ usage: openaiResponsesUsageSchema.nullish(),
4952
4964
  reasoning: z20.object({
4953
4965
  context: z20.string().nullish()
4954
4966
  }).nullish(),
@@ -4964,20 +4976,7 @@ var openaiResponsesChunkSchema = lazySchema18(
4964
4976
  message: z20.string()
4965
4977
  }).nullish(),
4966
4978
  incomplete_details: z20.object({ reason: z20.string() }).nullish(),
4967
- usage: z20.object({
4968
- input_tokens: z20.number(),
4969
- input_tokens_details: z20.object({
4970
- cached_tokens: z20.number().nullish(),
4971
- cache_write_tokens: z20.number().nullish(),
4972
- orchestration_input_tokens: z20.number().nullish(),
4973
- orchestration_input_cached_tokens: z20.number().nullish()
4974
- }).nullish(),
4975
- output_tokens: z20.number(),
4976
- output_tokens_details: z20.object({
4977
- reasoning_tokens: z20.number().nullish(),
4978
- orchestration_output_tokens: z20.number().nullish()
4979
- }).nullish()
4980
- }).nullish(),
4979
+ usage: openaiResponsesUsageSchema.nullish(),
4981
4980
  reasoning: z20.object({
4982
4981
  context: z20.string().nullish()
4983
4982
  }).nullish(),
@@ -5767,20 +5766,7 @@ var openaiResponsesResponseSchema = lazySchema18(
5767
5766
  context: z20.string().nullish()
5768
5767
  }).nullish(),
5769
5768
  incomplete_details: z20.object({ reason: z20.string() }).nullish(),
5770
- usage: z20.object({
5771
- input_tokens: z20.number(),
5772
- input_tokens_details: z20.object({
5773
- cached_tokens: z20.number().nullish(),
5774
- cache_write_tokens: z20.number().nullish(),
5775
- orchestration_input_tokens: z20.number().nullish(),
5776
- orchestration_input_cached_tokens: z20.number().nullish()
5777
- }).nullish(),
5778
- output_tokens: z20.number(),
5779
- output_tokens_details: z20.object({
5780
- reasoning_tokens: z20.number().nullish(),
5781
- orchestration_output_tokens: z20.number().nullish()
5782
- }).nullish()
5783
- }).nullish()
5769
+ usage: openaiResponsesUsageSchema.nullish()
5784
5770
  })
5785
5771
  )
5786
5772
  );