@openrouter/sdk 0.1.27 → 0.2.9

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.
Files changed (146) hide show
  1. package/biome.json +171 -0
  2. package/esm/funcs/callModel.d.ts +7 -7
  3. package/esm/funcs/callModel.js +35 -23
  4. package/esm/funcs/embeddingsGenerate.js +2 -4
  5. package/esm/funcs/oAuthCreateAuthorizationUrl.d.ts +3 -3
  6. package/esm/funcs/oAuthCreateAuthorizationUrl.js +30 -14
  7. package/esm/funcs/oAuthCreateSHA256CodeChallenge.d.ts +2 -2
  8. package/esm/funcs/oAuthCreateSHA256CodeChallenge.js +13 -12
  9. package/esm/hooks/registration.d.ts +2 -2
  10. package/esm/hooks/registration.js +1 -2
  11. package/esm/lib/config.d.ts +3 -3
  12. package/esm/lib/config.js +3 -3
  13. package/esm/lib/encodings.d.ts +1 -0
  14. package/esm/lib/encodings.js +12 -1
  15. package/esm/lib/response-wrapper.d.ts +17 -5
  16. package/esm/lib/response-wrapper.js +119 -68
  17. package/esm/lib/reusable-stream.js +26 -7
  18. package/esm/lib/stream-transformers.d.ts +3 -3
  19. package/esm/lib/stream-transformers.js +43 -41
  20. package/esm/lib/tool-executor.d.ts +9 -9
  21. package/esm/lib/tool-executor.js +9 -9
  22. package/esm/lib/tool-orchestrator.d.ts +3 -3
  23. package/esm/lib/tool-orchestrator.js +39 -19
  24. package/esm/lib/tool-types.d.ts +26 -25
  25. package/esm/lib/tool-types.js +3 -3
  26. package/esm/models/chatcompletionfinishreason.d.ts +13 -0
  27. package/esm/models/chatcompletionfinishreason.js +14 -0
  28. package/esm/models/chatgenerationparams.d.ts +16 -4
  29. package/esm/models/chatgenerationparams.js +16 -4
  30. package/esm/models/chatmessagecontentitem.d.ts +2 -19
  31. package/esm/models/chatmessagecontentitem.js +6 -9
  32. package/esm/models/chatmessagecontentitemaudio.d.ts +1 -16
  33. package/esm/models/chatmessagecontentitemaudio.js +2 -16
  34. package/esm/models/chatmessagecontentitemcachecontrol.d.ts +29 -0
  35. package/esm/models/chatmessagecontentitemcachecontrol.js +33 -0
  36. package/esm/models/chatmessagecontentitemtext.d.ts +3 -0
  37. package/esm/models/chatmessagecontentitemtext.js +12 -0
  38. package/esm/models/chatmessagecontentitemvideo.d.ts +23 -11
  39. package/esm/models/chatmessagecontentitemvideo.js +24 -11
  40. package/esm/models/chatresponsechoice.d.ts +1 -21
  41. package/esm/models/chatresponsechoice.js +1 -25
  42. package/esm/models/chatstreamingchoice.d.ts +16 -0
  43. package/esm/models/chatstreamingchoice.js +24 -0
  44. package/esm/models/chatstreamingresponsechunk.d.ts +1 -1
  45. package/esm/models/chatstreamingresponsechunk.js +1 -1
  46. package/esm/models/completionchoice.d.ts +2 -0
  47. package/esm/models/completionchoice.js +3 -0
  48. package/esm/models/completioncreateparams.d.ts +4 -4
  49. package/esm/models/completioncreateparams.js +4 -4
  50. package/esm/models/completionresponse.d.ts +1 -0
  51. package/esm/models/completionresponse.js +1 -0
  52. package/esm/models/filecitation.d.ts +2 -11
  53. package/esm/models/filecitation.js +2 -9
  54. package/esm/models/filepath.d.ts +2 -11
  55. package/esm/models/filepath.js +2 -10
  56. package/esm/models/index.d.ts +3 -2
  57. package/esm/models/index.js +3 -2
  58. package/esm/models/message.d.ts +2 -2
  59. package/esm/models/message.js +1 -1
  60. package/esm/models/openairesponsesannotation.d.ts +2 -2
  61. package/esm/models/openairesponsesannotation.js +2 -2
  62. package/esm/models/openairesponsesinputunion.d.ts +5 -45
  63. package/esm/models/openairesponsesinputunion.js +20 -20
  64. package/esm/models/openairesponsesrefusalcontent.d.ts +2 -11
  65. package/esm/models/openairesponsesrefusalcontent.js +2 -9
  66. package/esm/models/openresponseseasyinputmessage.d.ts +6 -54
  67. package/esm/models/openresponseseasyinputmessage.js +12 -12
  68. package/esm/models/openresponseserrorevent.d.ts +1 -8
  69. package/esm/models/openresponseserrorevent.js +1 -6
  70. package/esm/models/openresponsesimagegencallcompleted.d.ts +1 -8
  71. package/esm/models/openresponsesimagegencallcompleted.js +1 -6
  72. package/esm/models/openresponsesimagegencallgenerating.d.ts +1 -8
  73. package/esm/models/openresponsesimagegencallgenerating.js +1 -6
  74. package/esm/models/openresponsesimagegencallinprogress.d.ts +1 -8
  75. package/esm/models/openresponsesimagegencallinprogress.js +1 -6
  76. package/esm/models/openresponsesimagegencallpartialimage.d.ts +1 -8
  77. package/esm/models/openresponsesimagegencallpartialimage.js +1 -6
  78. package/esm/models/openresponsesinputmessageitem.d.ts +4 -36
  79. package/esm/models/openresponsesinputmessageitem.js +8 -8
  80. package/esm/models/openresponsesnonstreamingresponse.d.ts +1 -7
  81. package/esm/models/openresponsesnonstreamingresponse.js +1 -6
  82. package/esm/models/openresponsesreasoningdeltaevent.d.ts +1 -8
  83. package/esm/models/openresponsesreasoningdeltaevent.js +1 -6
  84. package/esm/models/openresponsesreasoningdoneevent.d.ts +1 -8
  85. package/esm/models/openresponsesreasoningdoneevent.js +1 -6
  86. package/esm/models/openresponsesreasoningsummarypartaddedevent.d.ts +1 -8
  87. package/esm/models/openresponsesreasoningsummarypartaddedevent.js +1 -6
  88. package/esm/models/openresponsesreasoningsummarytextdeltaevent.d.ts +1 -8
  89. package/esm/models/openresponsesreasoningsummarytextdeltaevent.js +1 -6
  90. package/esm/models/openresponsesreasoningsummarytextdoneevent.d.ts +1 -8
  91. package/esm/models/openresponsesreasoningsummarytextdoneevent.js +1 -6
  92. package/esm/models/openresponsesrequest.d.ts +26 -44
  93. package/esm/models/openresponsesrequest.js +15 -32
  94. package/esm/models/openresponsesstreamevent.d.ts +30 -125
  95. package/esm/models/openresponsesstreamevent.js +34 -119
  96. package/esm/models/openresponseswebsearch20250826tool.d.ts +2 -11
  97. package/esm/models/openresponseswebsearch20250826tool.js +2 -9
  98. package/esm/models/openresponseswebsearchpreview20250311tool.d.ts +2 -11
  99. package/esm/models/openresponseswebsearchpreview20250311tool.js +2 -9
  100. package/esm/models/openresponseswebsearchpreviewtool.d.ts +2 -11
  101. package/esm/models/openresponseswebsearchpreviewtool.js +2 -9
  102. package/esm/models/openresponseswebsearchtool.d.ts +2 -11
  103. package/esm/models/openresponseswebsearchtool.js +2 -9
  104. package/esm/models/operations/createembeddings.d.ts +5 -21
  105. package/esm/models/operations/createembeddings.js +3 -22
  106. package/esm/models/operations/getcredits.d.ts +16 -1
  107. package/esm/models/operations/getcredits.js +17 -1
  108. package/esm/models/operations/getparameters.d.ts +5 -1
  109. package/esm/models/operations/getparameters.js +5 -1
  110. package/esm/models/providername.d.ts +5 -1
  111. package/esm/models/providername.js +5 -1
  112. package/esm/models/responseformattextconfig.d.ts +2 -2
  113. package/esm/models/responseformattextconfig.js +2 -2
  114. package/esm/models/responseinputaudio.d.ts +3 -11
  115. package/esm/models/responseinputaudio.js +2 -9
  116. package/esm/models/responseinputfile.d.ts +2 -11
  117. package/esm/models/responseinputfile.js +2 -9
  118. package/esm/models/responseinputimage.d.ts +3 -11
  119. package/esm/models/responseinputimage.js +2 -9
  120. package/esm/models/responseinputtext.d.ts +2 -11
  121. package/esm/models/responseinputtext.js +2 -9
  122. package/esm/models/responseoutputtext.d.ts +2 -11
  123. package/esm/models/responseoutputtext.js +2 -9
  124. package/esm/models/responsesformatjsonobject.d.ts +2 -11
  125. package/esm/models/responsesformatjsonobject.js +2 -9
  126. package/esm/models/responsesformattext.d.ts +2 -11
  127. package/esm/models/responsesformattext.js +2 -9
  128. package/esm/models/responsesformattextjsonschemaconfig.d.ts +2 -11
  129. package/esm/models/responsesformattextjsonschemaconfig.js +2 -9
  130. package/esm/models/responsesoutputitem.d.ts +13 -1
  131. package/esm/models/responsesoutputitem.js +6 -6
  132. package/esm/models/urlcitation.d.ts +2 -11
  133. package/esm/models/urlcitation.js +2 -9
  134. package/esm/sdk/oauth.d.ts +2 -2
  135. package/esm/sdk/oauth.js +2 -3
  136. package/esm/sdk/sdk.d.ts +9 -8
  137. package/esm/types/unrecognized.d.ts +7 -1
  138. package/esm/types/unrecognized.js +9 -1
  139. package/jsr.json +1 -1
  140. package/package.json +1 -1
  141. package/tsconfig.json +0 -1
  142. package/vitest.config.ts +14 -8
  143. package/esm/models/chatmessagecontentitemfile.d.ts +0 -36
  144. package/esm/models/chatmessagecontentitemfile.js +0 -51
  145. package/esm/models/videourl.d.ts +0 -17
  146. package/esm/models/videourl.js +0 -21
@@ -0,0 +1,24 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+ import * as z from "zod/v4";
5
+ import { remap as remap$ } from "../lib/primitives.js";
6
+ import { safeParse } from "../lib/schemas.js";
7
+ import { ChatCompletionFinishReason$inboundSchema, } from "./chatcompletionfinishreason.js";
8
+ import { ChatMessageTokenLogprobs$inboundSchema, } from "./chatmessagetokenlogprobs.js";
9
+ import { ChatStreamingMessageChunk$inboundSchema, } from "./chatstreamingmessagechunk.js";
10
+ /** @internal */
11
+ export const ChatStreamingChoice$inboundSchema = z.object({
12
+ delta: ChatStreamingMessageChunk$inboundSchema,
13
+ finish_reason: z.nullable(ChatCompletionFinishReason$inboundSchema),
14
+ index: z.number(),
15
+ logprobs: z.nullable(ChatMessageTokenLogprobs$inboundSchema).optional(),
16
+ }).transform((v) => {
17
+ return remap$(v, {
18
+ "finish_reason": "finishReason",
19
+ });
20
+ });
21
+ export function chatStreamingChoiceFromJSON(jsonString) {
22
+ return safeParse(jsonString, (x) => ChatStreamingChoice$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatStreamingChoice' from JSON`);
23
+ }
24
+ //# sourceMappingURL=chatstreamingchoice.js.map
@@ -1,7 +1,7 @@
1
1
  import * as z from "zod/v4";
2
2
  import { Result as SafeParseResult } from "../types/fp.js";
3
3
  import { ChatGenerationTokenUsage } from "./chatgenerationtokenusage.js";
4
- import { ChatStreamingChoice } from "./chatresponsechoice.js";
4
+ import { ChatStreamingChoice } from "./chatstreamingchoice.js";
5
5
  import { SDKValidationError } from "./errors/sdkvalidationerror.js";
6
6
  export type ChatStreamingResponseChunkError = {
7
7
  message: string;
@@ -5,7 +5,7 @@ import * as z from "zod/v4";
5
5
  import { remap as remap$ } from "../lib/primitives.js";
6
6
  import { safeParse } from "../lib/schemas.js";
7
7
  import { ChatGenerationTokenUsage$inboundSchema, } from "./chatgenerationtokenusage.js";
8
- import { ChatStreamingChoice$inboundSchema, } from "./chatresponsechoice.js";
8
+ import { ChatStreamingChoice$inboundSchema, } from "./chatstreamingchoice.js";
9
9
  /** @internal */
10
10
  export const ChatStreamingResponseChunkError$inboundSchema = z.object({
11
11
  message: z.string(),
@@ -14,6 +14,8 @@ export type CompletionChoice = {
14
14
  index: number;
15
15
  logprobs: CompletionLogprobs | null;
16
16
  finishReason: CompletionFinishReason | null;
17
+ nativeFinishReason?: string | undefined;
18
+ reasoning?: string | null | undefined;
17
19
  };
18
20
  /** @internal */
19
21
  export declare const CompletionFinishReason$inboundSchema: z.ZodType<CompletionFinishReason, unknown>;
@@ -19,9 +19,12 @@ export const CompletionChoice$inboundSchema = z.object({
19
19
  index: z.number(),
20
20
  logprobs: z.nullable(CompletionLogprobs$inboundSchema),
21
21
  finish_reason: z.nullable(CompletionFinishReason$inboundSchema),
22
+ native_finish_reason: z.string().optional(),
23
+ reasoning: z.nullable(z.string()).optional(),
22
24
  }).transform((v) => {
23
25
  return remap$(v, {
24
26
  "finish_reason": "finishReason",
27
+ "native_finish_reason": "nativeFinishReason",
25
28
  });
26
29
  });
27
30
  export function completionChoiceFromJSON(jsonString) {
@@ -15,7 +15,7 @@ export type CompletionCreateParamsResponseFormatJSONObject = {
15
15
  export type CompletionCreateParamsResponseFormatText = {
16
16
  type: "text";
17
17
  };
18
- export type CompletionCreateParamsResponseFormatUnion = ResponseFormatJSONSchema | ResponseFormatTextGrammar | CompletionCreateParamsResponseFormatText | CompletionCreateParamsResponseFormatJSONObject | CompletionCreateParamsResponseFormatPython;
18
+ export type CompletionCreateParamsResponseFormatUnion = CompletionCreateParamsResponseFormatText | CompletionCreateParamsResponseFormatJSONObject | ResponseFormatJSONSchema | ResponseFormatTextGrammar | CompletionCreateParamsResponseFormatPython;
19
19
  export type CompletionCreateParams = {
20
20
  model?: string | undefined;
21
21
  models?: Array<string> | undefined;
@@ -41,7 +41,7 @@ export type CompletionCreateParams = {
41
41
  metadata?: {
42
42
  [k: string]: string;
43
43
  } | null | undefined;
44
- responseFormat?: ResponseFormatJSONSchema | ResponseFormatTextGrammar | CompletionCreateParamsResponseFormatText | CompletionCreateParamsResponseFormatJSONObject | CompletionCreateParamsResponseFormatPython | null | undefined;
44
+ responseFormat?: CompletionCreateParamsResponseFormatText | CompletionCreateParamsResponseFormatJSONObject | ResponseFormatJSONSchema | ResponseFormatTextGrammar | CompletionCreateParamsResponseFormatPython | null | undefined;
45
45
  };
46
46
  /** @internal */
47
47
  export type Prompt$Outbound = string | Array<string> | Array<number> | Array<Array<number>>;
@@ -82,7 +82,7 @@ export type CompletionCreateParamsResponseFormatText$Outbound = {
82
82
  export declare const CompletionCreateParamsResponseFormatText$outboundSchema: z.ZodType<CompletionCreateParamsResponseFormatText$Outbound, CompletionCreateParamsResponseFormatText>;
83
83
  export declare function completionCreateParamsResponseFormatTextToJSON(completionCreateParamsResponseFormatText: CompletionCreateParamsResponseFormatText): string;
84
84
  /** @internal */
85
- export type CompletionCreateParamsResponseFormatUnion$Outbound = ResponseFormatJSONSchema$Outbound | ResponseFormatTextGrammar$Outbound | CompletionCreateParamsResponseFormatText$Outbound | CompletionCreateParamsResponseFormatJSONObject$Outbound | CompletionCreateParamsResponseFormatPython$Outbound;
85
+ export type CompletionCreateParamsResponseFormatUnion$Outbound = CompletionCreateParamsResponseFormatText$Outbound | CompletionCreateParamsResponseFormatJSONObject$Outbound | ResponseFormatJSONSchema$Outbound | ResponseFormatTextGrammar$Outbound | CompletionCreateParamsResponseFormatPython$Outbound;
86
86
  /** @internal */
87
87
  export declare const CompletionCreateParamsResponseFormatUnion$outboundSchema: z.ZodType<CompletionCreateParamsResponseFormatUnion$Outbound, CompletionCreateParamsResponseFormatUnion>;
88
88
  export declare function completionCreateParamsResponseFormatUnionToJSON(completionCreateParamsResponseFormatUnion: CompletionCreateParamsResponseFormatUnion): string;
@@ -112,7 +112,7 @@ export type CompletionCreateParams$Outbound = {
112
112
  metadata?: {
113
113
  [k: string]: string;
114
114
  } | null | undefined;
115
- response_format?: ResponseFormatJSONSchema$Outbound | ResponseFormatTextGrammar$Outbound | CompletionCreateParamsResponseFormatText$Outbound | CompletionCreateParamsResponseFormatJSONObject$Outbound | CompletionCreateParamsResponseFormatPython$Outbound | null | undefined;
115
+ response_format?: CompletionCreateParamsResponseFormatText$Outbound | CompletionCreateParamsResponseFormatJSONObject$Outbound | ResponseFormatJSONSchema$Outbound | ResponseFormatTextGrammar$Outbound | CompletionCreateParamsResponseFormatPython$Outbound | null | undefined;
116
116
  };
117
117
  /** @internal */
118
118
  export declare const CompletionCreateParams$outboundSchema: z.ZodType<CompletionCreateParams$Outbound, CompletionCreateParams>;
@@ -55,10 +55,10 @@ export function completionCreateParamsResponseFormatTextToJSON(completionCreateP
55
55
  }
56
56
  /** @internal */
57
57
  export const CompletionCreateParamsResponseFormatUnion$outboundSchema = z.union([
58
- ResponseFormatJSONSchema$outboundSchema,
59
- ResponseFormatTextGrammar$outboundSchema,
60
58
  z.lazy(() => CompletionCreateParamsResponseFormatText$outboundSchema),
61
59
  z.lazy(() => CompletionCreateParamsResponseFormatJSONObject$outboundSchema),
60
+ ResponseFormatJSONSchema$outboundSchema,
61
+ ResponseFormatTextGrammar$outboundSchema,
62
62
  z.lazy(() => CompletionCreateParamsResponseFormatPython$outboundSchema),
63
63
  ]);
64
64
  export function completionCreateParamsResponseFormatUnionToJSON(completionCreateParamsResponseFormatUnion) {
@@ -93,10 +93,10 @@ export const CompletionCreateParams$outboundSchema = z.object({
93
93
  user: z.string().optional(),
94
94
  metadata: z.nullable(z.record(z.string(), z.string())).optional(),
95
95
  responseFormat: z.nullable(z.union([
96
- ResponseFormatJSONSchema$outboundSchema,
97
- ResponseFormatTextGrammar$outboundSchema,
98
96
  z.lazy(() => CompletionCreateParamsResponseFormatText$outboundSchema),
99
97
  z.lazy(() => CompletionCreateParamsResponseFormatJSONObject$outboundSchema),
98
+ ResponseFormatJSONSchema$outboundSchema,
99
+ ResponseFormatTextGrammar$outboundSchema,
100
100
  z.lazy(() => CompletionCreateParamsResponseFormatPython$outboundSchema),
101
101
  ])).optional(),
102
102
  }).transform((v) => {
@@ -8,6 +8,7 @@ export type CompletionResponse = {
8
8
  object: "text_completion";
9
9
  created: number;
10
10
  model: string;
11
+ provider?: string | undefined;
11
12
  systemFingerprint?: string | undefined;
12
13
  choices: Array<CompletionChoice>;
13
14
  usage?: CompletionUsage | undefined;
@@ -12,6 +12,7 @@ export const CompletionResponse$inboundSchema = z.object({
12
12
  object: z.literal("text_completion"),
13
13
  created: z.number(),
14
14
  model: z.string(),
15
+ provider: z.string().optional(),
15
16
  system_fingerprint: z.string().optional(),
16
17
  choices: z.array(CompletionChoice$inboundSchema),
17
18
  usage: CompletionUsage$inboundSchema.optional(),
@@ -1,26 +1,17 @@
1
1
  import * as z from "zod/v4";
2
- import { ClosedEnum } from "../types/enums.js";
3
2
  import { Result as SafeParseResult } from "../types/fp.js";
4
3
  import { SDKValidationError } from "./errors/sdkvalidationerror.js";
5
- export declare const FileCitationType: {
6
- readonly FileCitation: "file_citation";
7
- };
8
- export type FileCitationType = ClosedEnum<typeof FileCitationType>;
9
4
  export type FileCitation = {
10
- type: FileCitationType;
5
+ type: "file_citation";
11
6
  fileId: string;
12
7
  filename: string;
13
8
  index: number;
14
9
  };
15
10
  /** @internal */
16
- export declare const FileCitationType$inboundSchema: z.ZodEnum<typeof FileCitationType>;
17
- /** @internal */
18
- export declare const FileCitationType$outboundSchema: z.ZodEnum<typeof FileCitationType>;
19
- /** @internal */
20
11
  export declare const FileCitation$inboundSchema: z.ZodType<FileCitation, unknown>;
21
12
  /** @internal */
22
13
  export type FileCitation$Outbound = {
23
- type: string;
14
+ type: "file_citation";
24
15
  file_id: string;
25
16
  filename: string;
26
17
  index: number;
@@ -4,17 +4,10 @@
4
4
  import * as z from "zod/v4";
5
5
  import { remap as remap$ } from "../lib/primitives.js";
6
6
  import { safeParse } from "../lib/schemas.js";
7
- export const FileCitationType = {
8
- FileCitation: "file_citation",
9
- };
10
- /** @internal */
11
- export const FileCitationType$inboundSchema = z.enum(FileCitationType);
12
- /** @internal */
13
- export const FileCitationType$outboundSchema = FileCitationType$inboundSchema;
14
7
  /** @internal */
15
8
  export const FileCitation$inboundSchema = z
16
9
  .object({
17
- type: FileCitationType$inboundSchema,
10
+ type: z.literal("file_citation"),
18
11
  file_id: z.string(),
19
12
  filename: z.string(),
20
13
  index: z.number(),
@@ -25,7 +18,7 @@ export const FileCitation$inboundSchema = z
25
18
  });
26
19
  /** @internal */
27
20
  export const FileCitation$outboundSchema = z.object({
28
- type: FileCitationType$outboundSchema,
21
+ type: z.literal("file_citation"),
29
22
  fileId: z.string(),
30
23
  filename: z.string(),
31
24
  index: z.number(),
@@ -1,25 +1,16 @@
1
1
  import * as z from "zod/v4";
2
- import { ClosedEnum } from "../types/enums.js";
3
2
  import { Result as SafeParseResult } from "../types/fp.js";
4
3
  import { SDKValidationError } from "./errors/sdkvalidationerror.js";
5
- export declare const FilePathType: {
6
- readonly FilePath: "file_path";
7
- };
8
- export type FilePathType = ClosedEnum<typeof FilePathType>;
9
4
  export type FilePath = {
10
- type: FilePathType;
5
+ type: "file_path";
11
6
  fileId: string;
12
7
  index: number;
13
8
  };
14
9
  /** @internal */
15
- export declare const FilePathType$inboundSchema: z.ZodEnum<typeof FilePathType>;
16
- /** @internal */
17
- export declare const FilePathType$outboundSchema: z.ZodEnum<typeof FilePathType>;
18
- /** @internal */
19
10
  export declare const FilePath$inboundSchema: z.ZodType<FilePath, unknown>;
20
11
  /** @internal */
21
12
  export type FilePath$Outbound = {
22
- type: string;
13
+ type: "file_path";
23
14
  file_id: string;
24
15
  index: number;
25
16
  };
@@ -4,17 +4,9 @@
4
4
  import * as z from "zod/v4";
5
5
  import { remap as remap$ } from "../lib/primitives.js";
6
6
  import { safeParse } from "../lib/schemas.js";
7
- export const FilePathType = {
8
- FilePath: "file_path",
9
- };
10
- /** @internal */
11
- export const FilePathType$inboundSchema = z
12
- .enum(FilePathType);
13
- /** @internal */
14
- export const FilePathType$outboundSchema = FilePathType$inboundSchema;
15
7
  /** @internal */
16
8
  export const FilePath$inboundSchema = z.object({
17
- type: FilePathType$inboundSchema,
9
+ type: z.literal("file_path"),
18
10
  file_id: z.string(),
19
11
  index: z.number(),
20
12
  }).transform((v) => {
@@ -25,7 +17,7 @@ export const FilePath$inboundSchema = z.object({
25
17
  /** @internal */
26
18
  export const FilePath$outboundSchema = z
27
19
  .object({
28
- type: FilePathType$outboundSchema,
20
+ type: z.literal("file_path"),
29
21
  fileId: z.string(),
30
22
  index: z.number(),
31
23
  }).transform((v) => {
@@ -2,12 +2,13 @@ export * from "./activityitem.js";
2
2
  export * from "./assistantmessage.js";
3
3
  export * from "./badgatewayresponseerrordata.js";
4
4
  export * from "./badrequestresponseerrordata.js";
5
+ export * from "./chatcompletionfinishreason.js";
5
6
  export * from "./chaterror.js";
6
7
  export * from "./chatgenerationparams.js";
7
8
  export * from "./chatgenerationtokenusage.js";
8
9
  export * from "./chatmessagecontentitem.js";
9
10
  export * from "./chatmessagecontentitemaudio.js";
10
- export * from "./chatmessagecontentitemfile.js";
11
+ export * from "./chatmessagecontentitemcachecontrol.js";
11
12
  export * from "./chatmessagecontentitemimage.js";
12
13
  export * from "./chatmessagecontentitemtext.js";
13
14
  export * from "./chatmessagecontentitemvideo.js";
@@ -16,6 +17,7 @@ export * from "./chatmessagetokenlogprobs.js";
16
17
  export * from "./chatmessagetoolcall.js";
17
18
  export * from "./chatresponse.js";
18
19
  export * from "./chatresponsechoice.js";
20
+ export * from "./chatstreamingchoice.js";
19
21
  export * from "./chatstreamingmessagechunk.js";
20
22
  export * from "./chatstreamingmessagetoolcall.js";
21
23
  export * from "./chatstreamingresponsechunk.js";
@@ -138,7 +140,6 @@ export * from "./unauthorizedresponseerrordata.js";
138
140
  export * from "./unprocessableentityresponseerrordata.js";
139
141
  export * from "./urlcitation.js";
140
142
  export * from "./usermessage.js";
141
- export * from "./videourl.js";
142
143
  export * from "./websearchpreviewtooluserlocation.js";
143
144
  export * from "./websearchstatus.js";
144
145
  //# sourceMappingURL=index.d.ts.map
@@ -5,12 +5,13 @@ export * from "./activityitem.js";
5
5
  export * from "./assistantmessage.js";
6
6
  export * from "./badgatewayresponseerrordata.js";
7
7
  export * from "./badrequestresponseerrordata.js";
8
+ export * from "./chatcompletionfinishreason.js";
8
9
  export * from "./chaterror.js";
9
10
  export * from "./chatgenerationparams.js";
10
11
  export * from "./chatgenerationtokenusage.js";
11
12
  export * from "./chatmessagecontentitem.js";
12
13
  export * from "./chatmessagecontentitemaudio.js";
13
- export * from "./chatmessagecontentitemfile.js";
14
+ export * from "./chatmessagecontentitemcachecontrol.js";
14
15
  export * from "./chatmessagecontentitemimage.js";
15
16
  export * from "./chatmessagecontentitemtext.js";
16
17
  export * from "./chatmessagecontentitemvideo.js";
@@ -19,6 +20,7 @@ export * from "./chatmessagetokenlogprobs.js";
19
20
  export * from "./chatmessagetoolcall.js";
20
21
  export * from "./chatresponse.js";
21
22
  export * from "./chatresponsechoice.js";
23
+ export * from "./chatstreamingchoice.js";
22
24
  export * from "./chatstreamingmessagechunk.js";
23
25
  export * from "./chatstreamingmessagetoolcall.js";
24
26
  export * from "./chatstreamingresponsechunk.js";
@@ -141,7 +143,6 @@ export * from "./unauthorizedresponseerrordata.js";
141
143
  export * from "./unprocessableentityresponseerrordata.js";
142
144
  export * from "./urlcitation.js";
143
145
  export * from "./usermessage.js";
144
- export * from "./videourl.js";
145
146
  export * from "./websearchpreviewtooluserlocation.js";
146
147
  export * from "./websearchstatus.js";
147
148
  //# sourceMappingURL=index.js.map
@@ -10,7 +10,7 @@ export type MessageDeveloper = {
10
10
  content: string | Array<ChatMessageContentItemText>;
11
11
  name?: string | undefined;
12
12
  };
13
- export type Message = ToolResponseMessage | SystemMessage | UserMessage | MessageDeveloper | AssistantMessage;
13
+ export type Message = SystemMessage | UserMessage | MessageDeveloper | AssistantMessage | ToolResponseMessage;
14
14
  /** @internal */
15
15
  export type MessageContent$Outbound = string | Array<ChatMessageContentItemText$Outbound>;
16
16
  /** @internal */
@@ -26,7 +26,7 @@ export type MessageDeveloper$Outbound = {
26
26
  export declare const MessageDeveloper$outboundSchema: z.ZodType<MessageDeveloper$Outbound, MessageDeveloper>;
27
27
  export declare function messageDeveloperToJSON(messageDeveloper: MessageDeveloper): string;
28
28
  /** @internal */
29
- export type Message$Outbound = ToolResponseMessage$Outbound | SystemMessage$Outbound | UserMessage$Outbound | MessageDeveloper$Outbound | AssistantMessage$Outbound;
29
+ export type Message$Outbound = SystemMessage$Outbound | UserMessage$Outbound | MessageDeveloper$Outbound | AssistantMessage$Outbound | ToolResponseMessage$Outbound;
30
30
  /** @internal */
31
31
  export declare const Message$outboundSchema: z.ZodType<Message$Outbound, Message>;
32
32
  export declare function messageToJSON(message: Message): string;
@@ -27,11 +27,11 @@ export function messageDeveloperToJSON(messageDeveloper) {
27
27
  /** @internal */
28
28
  export const Message$outboundSchema = z
29
29
  .union([
30
- ToolResponseMessage$outboundSchema,
31
30
  SystemMessage$outboundSchema,
32
31
  UserMessage$outboundSchema,
33
32
  z.lazy(() => MessageDeveloper$outboundSchema),
34
33
  AssistantMessage$outboundSchema,
34
+ ToolResponseMessage$outboundSchema,
35
35
  ]);
36
36
  export function messageToJSON(message) {
37
37
  return JSON.stringify(Message$outboundSchema.parse(message));
@@ -4,11 +4,11 @@ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
4
4
  import { FileCitation, FileCitation$Outbound } from "./filecitation.js";
5
5
  import { FilePath, FilePath$Outbound } from "./filepath.js";
6
6
  import { URLCitation, URLCitation$Outbound } from "./urlcitation.js";
7
- export type OpenAIResponsesAnnotation = URLCitation | FileCitation | FilePath;
7
+ export type OpenAIResponsesAnnotation = FileCitation | URLCitation | FilePath;
8
8
  /** @internal */
9
9
  export declare const OpenAIResponsesAnnotation$inboundSchema: z.ZodType<OpenAIResponsesAnnotation, unknown>;
10
10
  /** @internal */
11
- export type OpenAIResponsesAnnotation$Outbound = URLCitation$Outbound | FileCitation$Outbound | FilePath$Outbound;
11
+ export type OpenAIResponsesAnnotation$Outbound = FileCitation$Outbound | URLCitation$Outbound | FilePath$Outbound;
12
12
  /** @internal */
13
13
  export declare const OpenAIResponsesAnnotation$outboundSchema: z.ZodType<OpenAIResponsesAnnotation$Outbound, OpenAIResponsesAnnotation>;
14
14
  export declare function openAIResponsesAnnotationToJSON(openAIResponsesAnnotation: OpenAIResponsesAnnotation): string;
@@ -8,14 +8,14 @@ import { FilePath$inboundSchema, FilePath$outboundSchema, } from "./filepath.js"
8
8
  import { URLCitation$inboundSchema, URLCitation$outboundSchema, } from "./urlcitation.js";
9
9
  /** @internal */
10
10
  export const OpenAIResponsesAnnotation$inboundSchema = z.union([
11
- URLCitation$inboundSchema,
12
11
  FileCitation$inboundSchema,
12
+ URLCitation$inboundSchema,
13
13
  FilePath$inboundSchema,
14
14
  ]);
15
15
  /** @internal */
16
16
  export const OpenAIResponsesAnnotation$outboundSchema = z.union([
17
- URLCitation$outboundSchema,
18
17
  FileCitation$outboundSchema,
18
+ URLCitation$outboundSchema,
19
19
  FilePath$outboundSchema,
20
20
  ]);
21
21
  export function openAIResponsesAnnotationToJSON(openAIResponsesAnnotation) {
@@ -49,28 +49,12 @@ export declare const OpenAIResponsesInputRoleUser2: {
49
49
  };
50
50
  export type OpenAIResponsesInputRoleUser2 = ClosedEnum<typeof OpenAIResponsesInputRoleUser2>;
51
51
  export type OpenAIResponsesInputRoleUnion2 = OpenAIResponsesInputRoleUser2 | OpenAIResponsesInputRoleSystem2 | OpenAIResponsesInputRoleDeveloper2;
52
- export type OpenAIResponsesInputContent3 = (ResponseInputText & {
53
- type: "input_text";
54
- }) | (ResponseInputImage & {
55
- type: "input_image";
56
- }) | (ResponseInputAudio & {
57
- type: "input_audio";
58
- }) | (ResponseInputFile & {
59
- type: "input_file";
60
- });
52
+ export type OpenAIResponsesInputContent3 = ResponseInputText | ResponseInputImage | ResponseInputFile | ResponseInputAudio;
61
53
  export type OpenAIResponsesInputMessage2 = {
62
54
  id: string;
63
55
  type?: OpenAIResponsesInputTypeMessage2 | undefined;
64
56
  role: OpenAIResponsesInputRoleUser2 | OpenAIResponsesInputRoleSystem2 | OpenAIResponsesInputRoleDeveloper2;
65
- content: Array<(ResponseInputText & {
66
- type: "input_text";
67
- }) | (ResponseInputImage & {
68
- type: "input_image";
69
- }) | (ResponseInputAudio & {
70
- type: "input_audio";
71
- }) | (ResponseInputFile & {
72
- type: "input_file";
73
- })>;
57
+ content: Array<ResponseInputText | ResponseInputImage | ResponseInputFile | ResponseInputAudio>;
74
58
  };
75
59
  export declare const OpenAIResponsesInputTypeMessage1: {
76
60
  readonly Message: "message";
@@ -93,36 +77,12 @@ export declare const OpenAIResponsesInputRoleUser1: {
93
77
  };
94
78
  export type OpenAIResponsesInputRoleUser1 = ClosedEnum<typeof OpenAIResponsesInputRoleUser1>;
95
79
  export type OpenAIResponsesInputRoleUnion1 = OpenAIResponsesInputRoleUser1 | OpenAIResponsesInputRoleSystem1 | OpenAIResponsesInputRoleAssistant | OpenAIResponsesInputRoleDeveloper1;
96
- export type OpenAIResponsesInputContent1 = (ResponseInputText & {
97
- type: "input_text";
98
- }) | (ResponseInputImage & {
99
- type: "input_image";
100
- }) | (ResponseInputAudio & {
101
- type: "input_audio";
102
- }) | (ResponseInputFile & {
103
- type: "input_file";
104
- });
105
- export type OpenAIResponsesInputContent2 = Array<(ResponseInputText & {
106
- type: "input_text";
107
- }) | (ResponseInputImage & {
108
- type: "input_image";
109
- }) | (ResponseInputAudio & {
110
- type: "input_audio";
111
- }) | (ResponseInputFile & {
112
- type: "input_file";
113
- })> | string;
80
+ export type OpenAIResponsesInputContent1 = ResponseInputText | ResponseInputImage | ResponseInputFile | ResponseInputAudio;
81
+ export type OpenAIResponsesInputContent2 = Array<ResponseInputText | ResponseInputImage | ResponseInputFile | ResponseInputAudio> | string;
114
82
  export type OpenAIResponsesInputMessage1 = {
115
83
  type?: OpenAIResponsesInputTypeMessage1 | undefined;
116
84
  role: OpenAIResponsesInputRoleUser1 | OpenAIResponsesInputRoleSystem1 | OpenAIResponsesInputRoleAssistant | OpenAIResponsesInputRoleDeveloper1;
117
- content: Array<(ResponseInputText & {
118
- type: "input_text";
119
- }) | (ResponseInputImage & {
120
- type: "input_image";
121
- }) | (ResponseInputAudio & {
122
- type: "input_audio";
123
- }) | (ResponseInputFile & {
124
- type: "input_file";
125
- })> | string;
85
+ content: Array<ResponseInputText | ResponseInputImage | ResponseInputFile | ResponseInputAudio> | string;
126
86
  };
127
87
  export type OpenAIResponsesInputUnion1 = OpenAIResponsesInputFunctionCall | OutputMessage | OpenAIResponsesInputMessage2 | OpenAIResponsesInputFunctionCallOutput | OutputItemImageGenerationCall | OpenAIResponsesInputMessage1;
128
88
  export type OpenAIResponsesInputUnion = string | Array<OpenAIResponsesInputFunctionCall | OutputMessage | OpenAIResponsesInputMessage2 | OpenAIResponsesInputFunctionCallOutput | OutputItemImageGenerationCall | OpenAIResponsesInputMessage1> | any;
@@ -98,10 +98,10 @@ export function openAIResponsesInputRoleUnion2FromJSON(jsonString) {
98
98
  }
99
99
  /** @internal */
100
100
  export const OpenAIResponsesInputContent3$inboundSchema = z.union([
101
- ResponseInputText$inboundSchema.and(z.object({ type: z.literal("input_text") })),
102
- ResponseInputImage$inboundSchema.and(z.object({ type: z.literal("input_image") })),
103
- ResponseInputAudio$inboundSchema.and(z.object({ type: z.literal("input_audio") })),
104
- ResponseInputFile$inboundSchema.and(z.object({ type: z.literal("input_file") })),
101
+ ResponseInputText$inboundSchema,
102
+ ResponseInputImage$inboundSchema,
103
+ ResponseInputFile$inboundSchema,
104
+ ResponseInputAudio$inboundSchema,
105
105
  ]);
106
106
  export function openAIResponsesInputContent3FromJSON(jsonString) {
107
107
  return safeParse(jsonString, (x) => OpenAIResponsesInputContent3$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OpenAIResponsesInputContent3' from JSON`);
@@ -116,10 +116,10 @@ export const OpenAIResponsesInputMessage2$inboundSchema = z.object({
116
116
  OpenAIResponsesInputRoleDeveloper2$inboundSchema,
117
117
  ]),
118
118
  content: z.array(z.union([
119
- ResponseInputText$inboundSchema.and(z.object({ type: z.literal("input_text") })),
120
- ResponseInputImage$inboundSchema.and(z.object({ type: z.literal("input_image") })),
121
- ResponseInputAudio$inboundSchema.and(z.object({ type: z.literal("input_audio") })),
122
- ResponseInputFile$inboundSchema.and(z.object({ type: z.literal("input_file") })),
119
+ ResponseInputText$inboundSchema,
120
+ ResponseInputImage$inboundSchema,
121
+ ResponseInputFile$inboundSchema,
122
+ ResponseInputAudio$inboundSchema,
123
123
  ])),
124
124
  });
125
125
  export function openAIResponsesInputMessage2FromJSON(jsonString) {
@@ -147,10 +147,10 @@ export function openAIResponsesInputRoleUnion1FromJSON(jsonString) {
147
147
  }
148
148
  /** @internal */
149
149
  export const OpenAIResponsesInputContent1$inboundSchema = z.union([
150
- ResponseInputText$inboundSchema.and(z.object({ type: z.literal("input_text") })),
151
- ResponseInputImage$inboundSchema.and(z.object({ type: z.literal("input_image") })),
152
- ResponseInputAudio$inboundSchema.and(z.object({ type: z.literal("input_audio") })),
153
- ResponseInputFile$inboundSchema.and(z.object({ type: z.literal("input_file") })),
150
+ ResponseInputText$inboundSchema,
151
+ ResponseInputImage$inboundSchema,
152
+ ResponseInputFile$inboundSchema,
153
+ ResponseInputAudio$inboundSchema,
154
154
  ]);
155
155
  export function openAIResponsesInputContent1FromJSON(jsonString) {
156
156
  return safeParse(jsonString, (x) => OpenAIResponsesInputContent1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OpenAIResponsesInputContent1' from JSON`);
@@ -158,10 +158,10 @@ export function openAIResponsesInputContent1FromJSON(jsonString) {
158
158
  /** @internal */
159
159
  export const OpenAIResponsesInputContent2$inboundSchema = z.union([
160
160
  z.array(z.union([
161
- ResponseInputText$inboundSchema.and(z.object({ type: z.literal("input_text") })),
162
- ResponseInputImage$inboundSchema.and(z.object({ type: z.literal("input_image") })),
163
- ResponseInputAudio$inboundSchema.and(z.object({ type: z.literal("input_audio") })),
164
- ResponseInputFile$inboundSchema.and(z.object({ type: z.literal("input_file") })),
161
+ ResponseInputText$inboundSchema,
162
+ ResponseInputImage$inboundSchema,
163
+ ResponseInputFile$inboundSchema,
164
+ ResponseInputAudio$inboundSchema,
165
165
  ])),
166
166
  z.string(),
167
167
  ]);
@@ -179,10 +179,10 @@ export const OpenAIResponsesInputMessage1$inboundSchema = z.object({
179
179
  ]),
180
180
  content: z.union([
181
181
  z.array(z.union([
182
- ResponseInputText$inboundSchema.and(z.object({ type: z.literal("input_text") })),
183
- ResponseInputImage$inboundSchema.and(z.object({ type: z.literal("input_image") })),
184
- ResponseInputAudio$inboundSchema.and(z.object({ type: z.literal("input_audio") })),
185
- ResponseInputFile$inboundSchema.and(z.object({ type: z.literal("input_file") })),
182
+ ResponseInputText$inboundSchema,
183
+ ResponseInputImage$inboundSchema,
184
+ ResponseInputFile$inboundSchema,
185
+ ResponseInputAudio$inboundSchema,
186
186
  ])),
187
187
  z.string(),
188
188
  ]),
@@ -1,24 +1,15 @@
1
1
  import * as z from "zod/v4";
2
- import { ClosedEnum } from "../types/enums.js";
3
2
  import { Result as SafeParseResult } from "../types/fp.js";
4
3
  import { SDKValidationError } from "./errors/sdkvalidationerror.js";
5
- export declare const OpenAIResponsesRefusalContentType: {
6
- readonly Refusal: "refusal";
7
- };
8
- export type OpenAIResponsesRefusalContentType = ClosedEnum<typeof OpenAIResponsesRefusalContentType>;
9
4
  export type OpenAIResponsesRefusalContent = {
10
- type: OpenAIResponsesRefusalContentType;
5
+ type: "refusal";
11
6
  refusal: string;
12
7
  };
13
8
  /** @internal */
14
- export declare const OpenAIResponsesRefusalContentType$inboundSchema: z.ZodEnum<typeof OpenAIResponsesRefusalContentType>;
15
- /** @internal */
16
- export declare const OpenAIResponsesRefusalContentType$outboundSchema: z.ZodEnum<typeof OpenAIResponsesRefusalContentType>;
17
- /** @internal */
18
9
  export declare const OpenAIResponsesRefusalContent$inboundSchema: z.ZodType<OpenAIResponsesRefusalContent, unknown>;
19
10
  /** @internal */
20
11
  export type OpenAIResponsesRefusalContent$Outbound = {
21
- type: string;
12
+ type: "refusal";
22
13
  refusal: string;
23
14
  };
24
15
  /** @internal */
@@ -3,21 +3,14 @@
3
3
  */
4
4
  import * as z from "zod/v4";
5
5
  import { safeParse } from "../lib/schemas.js";
6
- export const OpenAIResponsesRefusalContentType = {
7
- Refusal: "refusal",
8
- };
9
- /** @internal */
10
- export const OpenAIResponsesRefusalContentType$inboundSchema = z.enum(OpenAIResponsesRefusalContentType);
11
- /** @internal */
12
- export const OpenAIResponsesRefusalContentType$outboundSchema = OpenAIResponsesRefusalContentType$inboundSchema;
13
6
  /** @internal */
14
7
  export const OpenAIResponsesRefusalContent$inboundSchema = z.object({
15
- type: OpenAIResponsesRefusalContentType$inboundSchema,
8
+ type: z.literal("refusal"),
16
9
  refusal: z.string(),
17
10
  });
18
11
  /** @internal */
19
12
  export const OpenAIResponsesRefusalContent$outboundSchema = z.object({
20
- type: OpenAIResponsesRefusalContentType$outboundSchema,
13
+ type: z.literal("refusal"),
21
14
  refusal: z.string(),
22
15
  });
23
16
  export function openAIResponsesRefusalContentToJSON(openAIResponsesRefusalContent) {