@openrouter/sdk 0.1.0 → 0.1.2

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 (43) hide show
  1. package/esm/funcs/embeddingsGenerate.d.ts +18 -0
  2. package/esm/funcs/embeddingsGenerate.js +97 -0
  3. package/esm/lib/config.d.ts +2 -2
  4. package/esm/lib/config.js +2 -2
  5. package/esm/models/chaterror.d.ts +4 -4
  6. package/esm/models/chaterror.js +4 -4
  7. package/esm/models/chatgenerationparams.d.ts +4 -2
  8. package/esm/models/chatgenerationparams.js +4 -2
  9. package/esm/models/chatmessagecontentitemaudio.d.ts +15 -15
  10. package/esm/models/chatmessagecontentitemaudio.js +15 -16
  11. package/esm/models/completioncreateparams.d.ts +4 -2
  12. package/esm/models/completioncreateparams.js +4 -2
  13. package/esm/models/index.d.ts +1 -0
  14. package/esm/models/index.js +1 -0
  15. package/esm/models/openairesponsesinputunion.d.ts +21 -0
  16. package/esm/models/openairesponsesinputunion.js +31 -0
  17. package/esm/models/openairesponsesprompt.d.ts +4 -28
  18. package/esm/models/openairesponsesprompt.js +16 -36
  19. package/esm/models/openresponseseasyinputmessage.d.ts +13 -0
  20. package/esm/models/openresponseseasyinputmessage.js +19 -0
  21. package/esm/models/openresponsesinputmessageitem.d.ts +9 -0
  22. package/esm/models/openresponsesinputmessageitem.js +13 -0
  23. package/esm/models/operations/createembeddings.d.ts +582 -0
  24. package/esm/models/operations/createembeddings.js +608 -0
  25. package/esm/models/operations/getgeneration.d.ts +5 -0
  26. package/esm/models/operations/getgeneration.js +4 -0
  27. package/esm/models/operations/getparameters.d.ts +10 -10
  28. package/esm/models/operations/getparameters.js +14 -14
  29. package/esm/models/operations/index.d.ts +1 -0
  30. package/esm/models/operations/index.js +1 -0
  31. package/esm/models/responseinputaudio.d.ts +103 -0
  32. package/esm/models/responseinputaudio.js +114 -0
  33. package/esm/react-query/embeddingsGenerate.d.ts +23 -0
  34. package/esm/react-query/embeddingsGenerate.js +42 -0
  35. package/esm/react-query/index.d.ts +1 -0
  36. package/esm/react-query/index.js +1 -0
  37. package/esm/react-query/parametersGetParameters.d.ts +3 -3
  38. package/esm/sdk/embeddings.d.ts +12 -0
  39. package/esm/sdk/embeddings.js +18 -0
  40. package/esm/sdk/sdk.d.ts +3 -0
  41. package/esm/sdk/sdk.js +4 -0
  42. package/jsr.json +1 -1
  43. package/package.json +1 -1
@@ -4,35 +4,17 @@ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
4
4
  import { ResponseInputFile, ResponseInputFile$Outbound } from "./responseinputfile.js";
5
5
  import { ResponseInputImage, ResponseInputImage$Outbound } from "./responseinputimage.js";
6
6
  import { ResponseInputText, ResponseInputText$Outbound } from "./responseinputtext.js";
7
- export type Variables = (ResponseInputText & {
8
- type: "input_text";
9
- }) | (ResponseInputImage & {
10
- type: "input_image";
11
- }) | (ResponseInputFile & {
12
- type: "input_file";
13
- });
7
+ export type Variables = ResponseInputText | ResponseInputImage | ResponseInputFile | string;
14
8
  export type OpenAIResponsesPrompt = {
15
9
  id: string;
16
10
  variables?: {
17
- [k: string]: (ResponseInputText & {
18
- type: "input_text";
19
- }) | (ResponseInputImage & {
20
- type: "input_image";
21
- }) | (ResponseInputFile & {
22
- type: "input_file";
23
- });
11
+ [k: string]: ResponseInputText | ResponseInputImage | ResponseInputFile | string;
24
12
  } | null | undefined;
25
13
  };
26
14
  /** @internal */
27
15
  export declare const Variables$inboundSchema: z.ZodType<Variables, unknown>;
28
16
  /** @internal */
29
- export type Variables$Outbound = (ResponseInputText$Outbound & {
30
- type: "input_text";
31
- }) | (ResponseInputImage$Outbound & {
32
- type: "input_image";
33
- }) | (ResponseInputFile$Outbound & {
34
- type: "input_file";
35
- });
17
+ export type Variables$Outbound = ResponseInputText$Outbound | ResponseInputImage$Outbound | ResponseInputFile$Outbound | string;
36
18
  /** @internal */
37
19
  export declare const Variables$outboundSchema: z.ZodType<Variables$Outbound, Variables>;
38
20
  /**
@@ -55,13 +37,7 @@ export declare const OpenAIResponsesPrompt$inboundSchema: z.ZodType<OpenAIRespon
55
37
  export type OpenAIResponsesPrompt$Outbound = {
56
38
  id: string;
57
39
  variables?: {
58
- [k: string]: (ResponseInputText$Outbound & {
59
- type: "input_text";
60
- }) | (ResponseInputImage$Outbound & {
61
- type: "input_image";
62
- }) | (ResponseInputFile$Outbound & {
63
- type: "input_file";
64
- });
40
+ [k: string]: ResponseInputText$Outbound | ResponseInputImage$Outbound | ResponseInputFile$Outbound | string;
65
41
  } | null | undefined;
66
42
  };
67
43
  /** @internal */
@@ -8,27 +8,17 @@ import { ResponseInputImage$inboundSchema, ResponseInputImage$outboundSchema, }
8
8
  import { ResponseInputText$inboundSchema, ResponseInputText$outboundSchema, } from "./responseinputtext.js";
9
9
  /** @internal */
10
10
  export const Variables$inboundSchema = z.union([
11
- ResponseInputText$inboundSchema.and(z.object({ type: z.literal("input_text") }).transform((v) => ({
12
- type: v.type,
13
- }))),
14
- ResponseInputImage$inboundSchema.and(z.object({ type: z.literal("input_image") }).transform((v) => ({
15
- type: v.type,
16
- }))),
17
- ResponseInputFile$inboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
18
- type: v.type,
19
- }))),
11
+ ResponseInputText$inboundSchema,
12
+ ResponseInputImage$inboundSchema,
13
+ ResponseInputFile$inboundSchema,
14
+ z.string(),
20
15
  ]);
21
16
  /** @internal */
22
17
  export const Variables$outboundSchema = z.union([
23
- ResponseInputText$outboundSchema.and(z.object({ type: z.literal("input_text") }).transform((v) => ({
24
- type: v.type,
25
- }))),
26
- ResponseInputImage$outboundSchema.and(z.object({ type: z.literal("input_image") }).transform((v) => ({
27
- type: v.type,
28
- }))),
29
- ResponseInputFile$outboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
30
- type: v.type,
31
- }))),
18
+ ResponseInputText$outboundSchema,
19
+ ResponseInputImage$outboundSchema,
20
+ ResponseInputFile$outboundSchema,
21
+ z.string(),
32
22
  ]);
33
23
  /**
34
24
  * @internal
@@ -51,30 +41,20 @@ export function variablesFromJSON(jsonString) {
51
41
  export const OpenAIResponsesPrompt$inboundSchema = z.object({
52
42
  id: z.string(),
53
43
  variables: z.nullable(z.record(z.string(), z.union([
54
- ResponseInputText$inboundSchema.and(z.object({ type: z.literal("input_text") }).transform((v) => ({
55
- type: v.type,
56
- }))),
57
- ResponseInputImage$inboundSchema.and(z.object({ type: z.literal("input_image") }).transform((v) => ({
58
- type: v.type,
59
- }))),
60
- ResponseInputFile$inboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
61
- type: v.type,
62
- }))),
44
+ ResponseInputText$inboundSchema,
45
+ ResponseInputImage$inboundSchema,
46
+ ResponseInputFile$inboundSchema,
47
+ z.string(),
63
48
  ]))).optional(),
64
49
  });
65
50
  /** @internal */
66
51
  export const OpenAIResponsesPrompt$outboundSchema = z.object({
67
52
  id: z.string(),
68
53
  variables: z.nullable(z.record(z.string(), z.union([
69
- ResponseInputText$outboundSchema.and(z.object({ type: z.literal("input_text") }).transform((v) => ({
70
- type: v.type,
71
- }))),
72
- ResponseInputImage$outboundSchema.and(z.object({ type: z.literal("input_image") }).transform((v) => ({
73
- type: v.type,
74
- }))),
75
- ResponseInputFile$outboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
76
- type: v.type,
77
- }))),
54
+ ResponseInputText$outboundSchema,
55
+ ResponseInputImage$outboundSchema,
56
+ ResponseInputFile$outboundSchema,
57
+ z.string(),
78
58
  ]))).optional(),
79
59
  });
80
60
  /**
@@ -2,6 +2,7 @@ import * as z from "zod/v4";
2
2
  import { ClosedEnum } from "../types/enums.js";
3
3
  import { Result as SafeParseResult } from "../types/fp.js";
4
4
  import { SDKValidationError } from "./errors/sdkvalidationerror.js";
5
+ import { ResponseInputAudio, ResponseInputAudio$Outbound } from "./responseinputaudio.js";
5
6
  import { ResponseInputFile, ResponseInputFile$Outbound } from "./responseinputfile.js";
6
7
  import { ResponseInputImage, ResponseInputImage$Outbound } from "./responseinputimage.js";
7
8
  import { ResponseInputText, ResponseInputText$Outbound } from "./responseinputtext.js";
@@ -30,6 +31,8 @@ export type OpenResponsesEasyInputMessageContent1 = (ResponseInputText & {
30
31
  type: "input_text";
31
32
  }) | (ResponseInputImage & {
32
33
  type: "input_image";
34
+ }) | (ResponseInputAudio & {
35
+ type: "input_audio";
33
36
  }) | (ResponseInputFile & {
34
37
  type: "input_file";
35
38
  });
@@ -37,6 +40,8 @@ export type OpenResponsesEasyInputMessageContent2 = Array<(ResponseInputText & {
37
40
  type: "input_text";
38
41
  }) | (ResponseInputImage & {
39
42
  type: "input_image";
43
+ }) | (ResponseInputAudio & {
44
+ type: "input_audio";
40
45
  }) | (ResponseInputFile & {
41
46
  type: "input_file";
42
47
  })> | string;
@@ -47,6 +52,8 @@ export type OpenResponsesEasyInputMessage = {
47
52
  type: "input_text";
48
53
  }) | (ResponseInputImage & {
49
54
  type: "input_image";
55
+ }) | (ResponseInputAudio & {
56
+ type: "input_audio";
50
57
  }) | (ResponseInputFile & {
51
58
  type: "input_file";
52
59
  })> | string;
@@ -168,6 +175,8 @@ export type OpenResponsesEasyInputMessageContent1$Outbound = (ResponseInputText$
168
175
  type: "input_text";
169
176
  }) | (ResponseInputImage$Outbound & {
170
177
  type: "input_image";
178
+ }) | (ResponseInputAudio$Outbound & {
179
+ type: "input_audio";
171
180
  }) | (ResponseInputFile$Outbound & {
172
181
  type: "input_file";
173
182
  });
@@ -194,6 +203,8 @@ export type OpenResponsesEasyInputMessageContent2$Outbound = Array<(ResponseInpu
194
203
  type: "input_text";
195
204
  }) | (ResponseInputImage$Outbound & {
196
205
  type: "input_image";
206
+ }) | (ResponseInputAudio$Outbound & {
207
+ type: "input_audio";
197
208
  }) | (ResponseInputFile$Outbound & {
198
209
  type: "input_file";
199
210
  })> | string;
@@ -223,6 +234,8 @@ export type OpenResponsesEasyInputMessage$Outbound = {
223
234
  type: "input_text";
224
235
  }) | (ResponseInputImage$Outbound & {
225
236
  type: "input_image";
237
+ }) | (ResponseInputAudio$Outbound & {
238
+ type: "input_audio";
226
239
  }) | (ResponseInputFile$Outbound & {
227
240
  type: "input_file";
228
241
  })> | string;
@@ -3,6 +3,7 @@
3
3
  */
4
4
  import * as z from "zod/v4";
5
5
  import { safeParse } from "../lib/schemas.js";
6
+ import { ResponseInputAudio$inboundSchema, ResponseInputAudio$outboundSchema, } from "./responseinputaudio.js";
6
7
  import { ResponseInputFile$inboundSchema, ResponseInputFile$outboundSchema, } from "./responseinputfile.js";
7
8
  import { ResponseInputImage$inboundSchema, ResponseInputImage$outboundSchema, } from "./responseinputimage.js";
8
9
  import { ResponseInputText$inboundSchema, ResponseInputText$outboundSchema, } from "./responseinputtext.js";
@@ -135,6 +136,9 @@ export const OpenResponsesEasyInputMessageContent1$inboundSchema = z.union([
135
136
  ResponseInputImage$inboundSchema.and(z.object({ type: z.literal("input_image") }).transform((v) => ({
136
137
  type: v.type,
137
138
  }))),
139
+ ResponseInputAudio$inboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
140
+ type: v.type,
141
+ }))),
138
142
  ResponseInputFile$inboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
139
143
  type: v.type,
140
144
  }))),
@@ -147,6 +151,9 @@ export const OpenResponsesEasyInputMessageContent1$outboundSchema = z.union([
147
151
  ResponseInputImage$outboundSchema.and(z.object({ type: z.literal("input_image") }).transform((v) => ({
148
152
  type: v.type,
149
153
  }))),
154
+ ResponseInputAudio$outboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
155
+ type: v.type,
156
+ }))),
150
157
  ResponseInputFile$outboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
151
158
  type: v.type,
152
159
  }))),
@@ -177,6 +184,9 @@ export const OpenResponsesEasyInputMessageContent2$inboundSchema = z.union([
177
184
  ResponseInputImage$inboundSchema.and(z.object({ type: z.literal("input_image") }).transform((v) => ({
178
185
  type: v.type,
179
186
  }))),
187
+ ResponseInputAudio$inboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
188
+ type: v.type,
189
+ }))),
180
190
  ResponseInputFile$inboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
181
191
  type: v.type,
182
192
  }))),
@@ -192,6 +202,9 @@ export const OpenResponsesEasyInputMessageContent2$outboundSchema = z.union([
192
202
  ResponseInputImage$outboundSchema.and(z.object({ type: z.literal("input_image") }).transform((v) => ({
193
203
  type: v.type,
194
204
  }))),
205
+ ResponseInputAudio$outboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
206
+ type: v.type,
207
+ }))),
195
208
  ResponseInputFile$outboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
196
209
  type: v.type,
197
210
  }))),
@@ -232,6 +245,9 @@ export const OpenResponsesEasyInputMessage$inboundSchema = z.object({
232
245
  ResponseInputImage$inboundSchema.and(z.object({ type: z.literal("input_image") }).transform((v) => ({
233
246
  type: v.type,
234
247
  }))),
248
+ ResponseInputAudio$inboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
249
+ type: v.type,
250
+ }))),
235
251
  ResponseInputFile$inboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
236
252
  type: v.type,
237
253
  }))),
@@ -256,6 +272,9 @@ export const OpenResponsesEasyInputMessage$outboundSchema = z.object({
256
272
  ResponseInputImage$outboundSchema.and(z.object({ type: z.literal("input_image") }).transform((v) => ({
257
273
  type: v.type,
258
274
  }))),
275
+ ResponseInputAudio$outboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
276
+ type: v.type,
277
+ }))),
259
278
  ResponseInputFile$outboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
260
279
  type: v.type,
261
280
  }))),
@@ -2,6 +2,7 @@ import * as z from "zod/v4";
2
2
  import { ClosedEnum } from "../types/enums.js";
3
3
  import { Result as SafeParseResult } from "../types/fp.js";
4
4
  import { SDKValidationError } from "./errors/sdkvalidationerror.js";
5
+ import { ResponseInputAudio, ResponseInputAudio$Outbound } from "./responseinputaudio.js";
5
6
  import { ResponseInputFile, ResponseInputFile$Outbound } from "./responseinputfile.js";
6
7
  import { ResponseInputImage, ResponseInputImage$Outbound } from "./responseinputimage.js";
7
8
  import { ResponseInputText, ResponseInputText$Outbound } from "./responseinputtext.js";
@@ -26,6 +27,8 @@ export type OpenResponsesInputMessageItemContent = (ResponseInputText & {
26
27
  type: "input_text";
27
28
  }) | (ResponseInputImage & {
28
29
  type: "input_image";
30
+ }) | (ResponseInputAudio & {
31
+ type: "input_audio";
29
32
  }) | (ResponseInputFile & {
30
33
  type: "input_file";
31
34
  });
@@ -37,6 +40,8 @@ export type OpenResponsesInputMessageItem = {
37
40
  type: "input_text";
38
41
  }) | (ResponseInputImage & {
39
42
  type: "input_image";
43
+ }) | (ResponseInputAudio & {
44
+ type: "input_audio";
40
45
  }) | (ResponseInputFile & {
41
46
  type: "input_file";
42
47
  })>;
@@ -140,6 +145,8 @@ export type OpenResponsesInputMessageItemContent$Outbound = (ResponseInputText$O
140
145
  type: "input_text";
141
146
  }) | (ResponseInputImage$Outbound & {
142
147
  type: "input_image";
148
+ }) | (ResponseInputAudio$Outbound & {
149
+ type: "input_audio";
143
150
  }) | (ResponseInputFile$Outbound & {
144
151
  type: "input_file";
145
152
  });
@@ -170,6 +177,8 @@ export type OpenResponsesInputMessageItem$Outbound = {
170
177
  type: "input_text";
171
178
  }) | (ResponseInputImage$Outbound & {
172
179
  type: "input_image";
180
+ }) | (ResponseInputAudio$Outbound & {
181
+ type: "input_audio";
173
182
  }) | (ResponseInputFile$Outbound & {
174
183
  type: "input_file";
175
184
  })>;
@@ -3,6 +3,7 @@
3
3
  */
4
4
  import * as z from "zod/v4";
5
5
  import { safeParse } from "../lib/schemas.js";
6
+ import { ResponseInputAudio$inboundSchema, ResponseInputAudio$outboundSchema, } from "./responseinputaudio.js";
6
7
  import { ResponseInputFile$inboundSchema, ResponseInputFile$outboundSchema, } from "./responseinputfile.js";
7
8
  import { ResponseInputImage$inboundSchema, ResponseInputImage$outboundSchema, } from "./responseinputimage.js";
8
9
  import { ResponseInputText$inboundSchema, ResponseInputText$outboundSchema, } from "./responseinputtext.js";
@@ -115,6 +116,9 @@ export const OpenResponsesInputMessageItemContent$inboundSchema = z.union([
115
116
  ResponseInputImage$inboundSchema.and(z.object({ type: z.literal("input_image") }).transform((v) => ({
116
117
  type: v.type,
117
118
  }))),
119
+ ResponseInputAudio$inboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
120
+ type: v.type,
121
+ }))),
118
122
  ResponseInputFile$inboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
119
123
  type: v.type,
120
124
  }))),
@@ -127,6 +131,9 @@ export const OpenResponsesInputMessageItemContent$outboundSchema = z.union([
127
131
  ResponseInputImage$outboundSchema.and(z.object({ type: z.literal("input_image") }).transform((v) => ({
128
132
  type: v.type,
129
133
  }))),
134
+ ResponseInputAudio$outboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
135
+ type: v.type,
136
+ }))),
130
137
  ResponseInputFile$outboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
131
138
  type: v.type,
132
139
  }))),
@@ -164,6 +171,9 @@ export const OpenResponsesInputMessageItem$inboundSchema = z.object({
164
171
  ResponseInputImage$inboundSchema.and(z.object({ type: z.literal("input_image") }).transform((v) => ({
165
172
  type: v.type,
166
173
  }))),
174
+ ResponseInputAudio$inboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
175
+ type: v.type,
176
+ }))),
167
177
  ResponseInputFile$inboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
168
178
  type: v.type,
169
179
  }))),
@@ -185,6 +195,9 @@ export const OpenResponsesInputMessageItem$outboundSchema = z.object({
185
195
  ResponseInputImage$outboundSchema.and(z.object({ type: z.literal("input_image") }).transform((v) => ({
186
196
  type: v.type,
187
197
  }))),
198
+ ResponseInputAudio$outboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
199
+ type: v.type,
200
+ }))),
188
201
  ResponseInputFile$outboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
189
202
  type: v.type,
190
203
  }))),