@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
@@ -5,7 +5,7 @@ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
5
5
  export type GetParametersSecurity = {
6
6
  bearer: string;
7
7
  };
8
- export declare const Provider: {
8
+ export declare const GetParametersProvider: {
9
9
  readonly Ai21: "AI21";
10
10
  readonly AionLabs: "AionLabs";
11
11
  readonly Alibaba: "Alibaba";
@@ -75,11 +75,11 @@ export declare const Provider: {
75
75
  readonly ZAi: "Z.AI";
76
76
  readonly FakeProvider: "FakeProvider";
77
77
  };
78
- export type Provider = OpenEnum<typeof Provider>;
78
+ export type GetParametersProvider = OpenEnum<typeof GetParametersProvider>;
79
79
  export type GetParametersRequest = {
80
80
  author: string;
81
81
  slug: string;
82
- provider?: Provider | undefined;
82
+ provider?: GetParametersProvider | undefined;
83
83
  };
84
84
  export declare const SupportedParameter: {
85
85
  readonly Temperature: "temperature";
@@ -152,18 +152,18 @@ export declare namespace GetParametersSecurity$ {
152
152
  export declare function getParametersSecurityToJSON(getParametersSecurity: GetParametersSecurity): string;
153
153
  export declare function getParametersSecurityFromJSON(jsonString: string): SafeParseResult<GetParametersSecurity, SDKValidationError>;
154
154
  /** @internal */
155
- export declare const Provider$inboundSchema: z.ZodType<Provider, unknown>;
155
+ export declare const GetParametersProvider$inboundSchema: z.ZodType<GetParametersProvider, unknown>;
156
156
  /** @internal */
157
- export declare const Provider$outboundSchema: z.ZodType<Provider, Provider>;
157
+ export declare const GetParametersProvider$outboundSchema: z.ZodType<GetParametersProvider, GetParametersProvider>;
158
158
  /**
159
159
  * @internal
160
160
  * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
161
161
  */
162
- export declare namespace Provider$ {
163
- /** @deprecated use `Provider$inboundSchema` instead. */
164
- const inboundSchema: z.ZodType<Provider, unknown, z.core.$ZodTypeInternals<Provider, unknown>>;
165
- /** @deprecated use `Provider$outboundSchema` instead. */
166
- const outboundSchema: z.ZodType<Provider, Provider, z.core.$ZodTypeInternals<Provider, Provider>>;
162
+ export declare namespace GetParametersProvider$ {
163
+ /** @deprecated use `GetParametersProvider$inboundSchema` instead. */
164
+ const inboundSchema: z.ZodType<GetParametersProvider, unknown, z.core.$ZodTypeInternals<GetParametersProvider, unknown>>;
165
+ /** @deprecated use `GetParametersProvider$outboundSchema` instead. */
166
+ const outboundSchema: z.ZodType<GetParametersProvider, GetParametersProvider, z.core.$ZodTypeInternals<GetParametersProvider, GetParametersProvider>>;
167
167
  }
168
168
  /** @internal */
169
169
  export declare const GetParametersRequest$inboundSchema: z.ZodType<GetParametersRequest, unknown>;
@@ -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 { catchUnrecognizedEnum, } from "../../types/enums.js";
8
- export const Provider = {
8
+ export const GetParametersProvider = {
9
9
  Ai21: "AI21",
10
10
  AionLabs: "AionLabs",
11
11
  Alibaba: "Alibaba",
@@ -126,38 +126,38 @@ export function getParametersSecurityFromJSON(jsonString) {
126
126
  return safeParse(jsonString, (x) => GetParametersSecurity$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetParametersSecurity' from JSON`);
127
127
  }
128
128
  /** @internal */
129
- export const Provider$inboundSchema = z
129
+ export const GetParametersProvider$inboundSchema = z
130
130
  .union([
131
- z.enum(Provider),
131
+ z.enum(GetParametersProvider),
132
132
  z.string().transform(catchUnrecognizedEnum),
133
133
  ]);
134
134
  /** @internal */
135
- export const Provider$outboundSchema = z.union([
136
- z.enum(Provider),
135
+ export const GetParametersProvider$outboundSchema = z.union([
136
+ z.enum(GetParametersProvider),
137
137
  z.string().and(z.custom()),
138
138
  ]);
139
139
  /**
140
140
  * @internal
141
141
  * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
142
142
  */
143
- export var Provider$;
144
- (function (Provider$) {
145
- /** @deprecated use `Provider$inboundSchema` instead. */
146
- Provider$.inboundSchema = Provider$inboundSchema;
147
- /** @deprecated use `Provider$outboundSchema` instead. */
148
- Provider$.outboundSchema = Provider$outboundSchema;
149
- })(Provider$ || (Provider$ = {}));
143
+ export var GetParametersProvider$;
144
+ (function (GetParametersProvider$) {
145
+ /** @deprecated use `GetParametersProvider$inboundSchema` instead. */
146
+ GetParametersProvider$.inboundSchema = GetParametersProvider$inboundSchema;
147
+ /** @deprecated use `GetParametersProvider$outboundSchema` instead. */
148
+ GetParametersProvider$.outboundSchema = GetParametersProvider$outboundSchema;
149
+ })(GetParametersProvider$ || (GetParametersProvider$ = {}));
150
150
  /** @internal */
151
151
  export const GetParametersRequest$inboundSchema = z.object({
152
152
  author: z.string(),
153
153
  slug: z.string(),
154
- provider: Provider$inboundSchema.optional(),
154
+ provider: GetParametersProvider$inboundSchema.optional(),
155
155
  });
156
156
  /** @internal */
157
157
  export const GetParametersRequest$outboundSchema = z.object({
158
158
  author: z.string(),
159
159
  slug: z.string(),
160
- provider: Provider$outboundSchema.optional(),
160
+ provider: GetParametersProvider$outboundSchema.optional(),
161
161
  });
162
162
  /**
163
163
  * @internal
@@ -1,5 +1,6 @@
1
1
  export * from "./createauthkeyscode.js";
2
2
  export * from "./createcoinbasecharge.js";
3
+ export * from "./createembeddings.js";
3
4
  export * from "./createkeys.js";
4
5
  export * from "./createresponses.js";
5
6
  export * from "./deletekeys.js";
@@ -3,6 +3,7 @@
3
3
  */
4
4
  export * from "./createauthkeyscode.js";
5
5
  export * from "./createcoinbasecharge.js";
6
+ export * from "./createembeddings.js";
6
7
  export * from "./createkeys.js";
7
8
  export * from "./createresponses.js";
8
9
  export * from "./deletekeys.js";
@@ -0,0 +1,103 @@
1
+ import * as z from "zod/v4";
2
+ import { ClosedEnum, OpenEnum } from "../types/enums.js";
3
+ import { Result as SafeParseResult } from "../types/fp.js";
4
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
5
+ export declare const ResponseInputAudioType: {
6
+ readonly InputAudio: "input_audio";
7
+ };
8
+ export type ResponseInputAudioType = ClosedEnum<typeof ResponseInputAudioType>;
9
+ export declare const ResponseInputAudioFormat: {
10
+ readonly Mp3: "mp3";
11
+ readonly Wav: "wav";
12
+ };
13
+ export type ResponseInputAudioFormat = OpenEnum<typeof ResponseInputAudioFormat>;
14
+ export type ResponseInputAudioInputAudio = {
15
+ data: string;
16
+ format: ResponseInputAudioFormat;
17
+ };
18
+ /**
19
+ * Audio input content item
20
+ */
21
+ export type ResponseInputAudio = {
22
+ type: ResponseInputAudioType;
23
+ inputAudio: ResponseInputAudioInputAudio;
24
+ };
25
+ /** @internal */
26
+ export declare const ResponseInputAudioType$inboundSchema: z.ZodEnum<typeof ResponseInputAudioType>;
27
+ /** @internal */
28
+ export declare const ResponseInputAudioType$outboundSchema: z.ZodEnum<typeof ResponseInputAudioType>;
29
+ /**
30
+ * @internal
31
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
32
+ */
33
+ export declare namespace ResponseInputAudioType$ {
34
+ /** @deprecated use `ResponseInputAudioType$inboundSchema` instead. */
35
+ const inboundSchema: z.ZodEnum<{
36
+ readonly InputAudio: "input_audio";
37
+ }>;
38
+ /** @deprecated use `ResponseInputAudioType$outboundSchema` instead. */
39
+ const outboundSchema: z.ZodEnum<{
40
+ readonly InputAudio: "input_audio";
41
+ }>;
42
+ }
43
+ /** @internal */
44
+ export declare const ResponseInputAudioFormat$inboundSchema: z.ZodType<ResponseInputAudioFormat, unknown>;
45
+ /** @internal */
46
+ export declare const ResponseInputAudioFormat$outboundSchema: z.ZodType<ResponseInputAudioFormat, ResponseInputAudioFormat>;
47
+ /**
48
+ * @internal
49
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
50
+ */
51
+ export declare namespace ResponseInputAudioFormat$ {
52
+ /** @deprecated use `ResponseInputAudioFormat$inboundSchema` instead. */
53
+ const inboundSchema: z.ZodType<ResponseInputAudioFormat, unknown, z.core.$ZodTypeInternals<ResponseInputAudioFormat, unknown>>;
54
+ /** @deprecated use `ResponseInputAudioFormat$outboundSchema` instead. */
55
+ const outboundSchema: z.ZodType<ResponseInputAudioFormat, ResponseInputAudioFormat, z.core.$ZodTypeInternals<ResponseInputAudioFormat, ResponseInputAudioFormat>>;
56
+ }
57
+ /** @internal */
58
+ export declare const ResponseInputAudioInputAudio$inboundSchema: z.ZodType<ResponseInputAudioInputAudio, unknown>;
59
+ /** @internal */
60
+ export type ResponseInputAudioInputAudio$Outbound = {
61
+ data: string;
62
+ format: string;
63
+ };
64
+ /** @internal */
65
+ export declare const ResponseInputAudioInputAudio$outboundSchema: z.ZodType<ResponseInputAudioInputAudio$Outbound, ResponseInputAudioInputAudio>;
66
+ /**
67
+ * @internal
68
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
69
+ */
70
+ export declare namespace ResponseInputAudioInputAudio$ {
71
+ /** @deprecated use `ResponseInputAudioInputAudio$inboundSchema` instead. */
72
+ const inboundSchema: z.ZodType<ResponseInputAudioInputAudio, unknown, z.core.$ZodTypeInternals<ResponseInputAudioInputAudio, unknown>>;
73
+ /** @deprecated use `ResponseInputAudioInputAudio$outboundSchema` instead. */
74
+ const outboundSchema: z.ZodType<ResponseInputAudioInputAudio$Outbound, ResponseInputAudioInputAudio, z.core.$ZodTypeInternals<ResponseInputAudioInputAudio$Outbound, ResponseInputAudioInputAudio>>;
75
+ /** @deprecated use `ResponseInputAudioInputAudio$Outbound` instead. */
76
+ type Outbound = ResponseInputAudioInputAudio$Outbound;
77
+ }
78
+ export declare function responseInputAudioInputAudioToJSON(responseInputAudioInputAudio: ResponseInputAudioInputAudio): string;
79
+ export declare function responseInputAudioInputAudioFromJSON(jsonString: string): SafeParseResult<ResponseInputAudioInputAudio, SDKValidationError>;
80
+ /** @internal */
81
+ export declare const ResponseInputAudio$inboundSchema: z.ZodType<ResponseInputAudio, unknown>;
82
+ /** @internal */
83
+ export type ResponseInputAudio$Outbound = {
84
+ type: string;
85
+ input_audio: ResponseInputAudioInputAudio$Outbound;
86
+ };
87
+ /** @internal */
88
+ export declare const ResponseInputAudio$outboundSchema: z.ZodType<ResponseInputAudio$Outbound, ResponseInputAudio>;
89
+ /**
90
+ * @internal
91
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
92
+ */
93
+ export declare namespace ResponseInputAudio$ {
94
+ /** @deprecated use `ResponseInputAudio$inboundSchema` instead. */
95
+ const inboundSchema: z.ZodType<ResponseInputAudio, unknown, z.core.$ZodTypeInternals<ResponseInputAudio, unknown>>;
96
+ /** @deprecated use `ResponseInputAudio$outboundSchema` instead. */
97
+ const outboundSchema: z.ZodType<ResponseInputAudio$Outbound, ResponseInputAudio, z.core.$ZodTypeInternals<ResponseInputAudio$Outbound, ResponseInputAudio>>;
98
+ /** @deprecated use `ResponseInputAudio$Outbound` instead. */
99
+ type Outbound = ResponseInputAudio$Outbound;
100
+ }
101
+ export declare function responseInputAudioToJSON(responseInputAudio: ResponseInputAudio): string;
102
+ export declare function responseInputAudioFromJSON(jsonString: string): SafeParseResult<ResponseInputAudio, SDKValidationError>;
103
+ //# sourceMappingURL=responseinputaudio.d.ts.map
@@ -0,0 +1,114 @@
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 { catchUnrecognizedEnum, } from "../types/enums.js";
8
+ export const ResponseInputAudioType = {
9
+ InputAudio: "input_audio",
10
+ };
11
+ export const ResponseInputAudioFormat = {
12
+ Mp3: "mp3",
13
+ Wav: "wav",
14
+ };
15
+ /** @internal */
16
+ export const ResponseInputAudioType$inboundSchema = z.enum(ResponseInputAudioType);
17
+ /** @internal */
18
+ export const ResponseInputAudioType$outboundSchema = ResponseInputAudioType$inboundSchema;
19
+ /**
20
+ * @internal
21
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
22
+ */
23
+ export var ResponseInputAudioType$;
24
+ (function (ResponseInputAudioType$) {
25
+ /** @deprecated use `ResponseInputAudioType$inboundSchema` instead. */
26
+ ResponseInputAudioType$.inboundSchema = ResponseInputAudioType$inboundSchema;
27
+ /** @deprecated use `ResponseInputAudioType$outboundSchema` instead. */
28
+ ResponseInputAudioType$.outboundSchema = ResponseInputAudioType$outboundSchema;
29
+ })(ResponseInputAudioType$ || (ResponseInputAudioType$ = {}));
30
+ /** @internal */
31
+ export const ResponseInputAudioFormat$inboundSchema = z
32
+ .union([
33
+ z.enum(ResponseInputAudioFormat),
34
+ z.string().transform(catchUnrecognizedEnum),
35
+ ]);
36
+ /** @internal */
37
+ export const ResponseInputAudioFormat$outboundSchema = z.union([
38
+ z.enum(ResponseInputAudioFormat),
39
+ z.string().and(z.custom()),
40
+ ]);
41
+ /**
42
+ * @internal
43
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
44
+ */
45
+ export var ResponseInputAudioFormat$;
46
+ (function (ResponseInputAudioFormat$) {
47
+ /** @deprecated use `ResponseInputAudioFormat$inboundSchema` instead. */
48
+ ResponseInputAudioFormat$.inboundSchema = ResponseInputAudioFormat$inboundSchema;
49
+ /** @deprecated use `ResponseInputAudioFormat$outboundSchema` instead. */
50
+ ResponseInputAudioFormat$.outboundSchema = ResponseInputAudioFormat$outboundSchema;
51
+ })(ResponseInputAudioFormat$ || (ResponseInputAudioFormat$ = {}));
52
+ /** @internal */
53
+ export const ResponseInputAudioInputAudio$inboundSchema = z.object({
54
+ data: z.string(),
55
+ format: ResponseInputAudioFormat$inboundSchema,
56
+ });
57
+ /** @internal */
58
+ export const ResponseInputAudioInputAudio$outboundSchema = z.object({
59
+ data: z.string(),
60
+ format: ResponseInputAudioFormat$outboundSchema,
61
+ });
62
+ /**
63
+ * @internal
64
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
65
+ */
66
+ export var ResponseInputAudioInputAudio$;
67
+ (function (ResponseInputAudioInputAudio$) {
68
+ /** @deprecated use `ResponseInputAudioInputAudio$inboundSchema` instead. */
69
+ ResponseInputAudioInputAudio$.inboundSchema = ResponseInputAudioInputAudio$inboundSchema;
70
+ /** @deprecated use `ResponseInputAudioInputAudio$outboundSchema` instead. */
71
+ ResponseInputAudioInputAudio$.outboundSchema = ResponseInputAudioInputAudio$outboundSchema;
72
+ })(ResponseInputAudioInputAudio$ || (ResponseInputAudioInputAudio$ = {}));
73
+ export function responseInputAudioInputAudioToJSON(responseInputAudioInputAudio) {
74
+ return JSON.stringify(ResponseInputAudioInputAudio$outboundSchema.parse(responseInputAudioInputAudio));
75
+ }
76
+ export function responseInputAudioInputAudioFromJSON(jsonString) {
77
+ return safeParse(jsonString, (x) => ResponseInputAudioInputAudio$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseInputAudioInputAudio' from JSON`);
78
+ }
79
+ /** @internal */
80
+ export const ResponseInputAudio$inboundSchema = z.object({
81
+ type: ResponseInputAudioType$inboundSchema,
82
+ input_audio: z.lazy(() => ResponseInputAudioInputAudio$inboundSchema),
83
+ }).transform((v) => {
84
+ return remap$(v, {
85
+ "input_audio": "inputAudio",
86
+ });
87
+ });
88
+ /** @internal */
89
+ export const ResponseInputAudio$outboundSchema = z.object({
90
+ type: ResponseInputAudioType$outboundSchema,
91
+ inputAudio: z.lazy(() => ResponseInputAudioInputAudio$outboundSchema),
92
+ }).transform((v) => {
93
+ return remap$(v, {
94
+ inputAudio: "input_audio",
95
+ });
96
+ });
97
+ /**
98
+ * @internal
99
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
100
+ */
101
+ export var ResponseInputAudio$;
102
+ (function (ResponseInputAudio$) {
103
+ /** @deprecated use `ResponseInputAudio$inboundSchema` instead. */
104
+ ResponseInputAudio$.inboundSchema = ResponseInputAudio$inboundSchema;
105
+ /** @deprecated use `ResponseInputAudio$outboundSchema` instead. */
106
+ ResponseInputAudio$.outboundSchema = ResponseInputAudio$outboundSchema;
107
+ })(ResponseInputAudio$ || (ResponseInputAudio$ = {}));
108
+ export function responseInputAudioToJSON(responseInputAudio) {
109
+ return JSON.stringify(ResponseInputAudio$outboundSchema.parse(responseInputAudio));
110
+ }
111
+ export function responseInputAudioFromJSON(jsonString) {
112
+ return safeParse(jsonString, (x) => ResponseInputAudio$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseInputAudio' from JSON`);
113
+ }
114
+ //# sourceMappingURL=responseinputaudio.js.map
@@ -0,0 +1,23 @@
1
+ import { MutationKey, UseMutationResult } from "@tanstack/react-query";
2
+ import { OpenRouterCore } from "../core.js";
3
+ import { RequestOptions } from "../lib/sdks.js";
4
+ import * as operations from "../models/operations/index.js";
5
+ import { MutationHookOptions } from "./_types.js";
6
+ export type EmbeddingsGenerateMutationVariables = {
7
+ request: operations.CreateEmbeddingsRequest;
8
+ options?: RequestOptions;
9
+ };
10
+ export type EmbeddingsGenerateMutationData = operations.CreateEmbeddingsResponse;
11
+ /**
12
+ * Submit an embedding request
13
+ *
14
+ * @remarks
15
+ * Submits an embedding request to the embeddings router
16
+ */
17
+ export declare function useEmbeddingsGenerateMutation(options?: MutationHookOptions<EmbeddingsGenerateMutationData, Error, EmbeddingsGenerateMutationVariables>): UseMutationResult<EmbeddingsGenerateMutationData, Error, EmbeddingsGenerateMutationVariables>;
18
+ export declare function mutationKeyEmbeddingsGenerate(): MutationKey;
19
+ export declare function buildEmbeddingsGenerateMutation(client$: OpenRouterCore, hookOptions?: RequestOptions): {
20
+ mutationKey: MutationKey;
21
+ mutationFn: (variables: EmbeddingsGenerateMutationVariables) => Promise<EmbeddingsGenerateMutationData>;
22
+ };
23
+ //# sourceMappingURL=embeddingsGenerate.d.ts.map
@@ -0,0 +1,42 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+ import { useMutation, } from "@tanstack/react-query";
5
+ import { embeddingsGenerate } from "../funcs/embeddingsGenerate.js";
6
+ import { combineSignals } from "../lib/primitives.js";
7
+ import { unwrapAsync } from "../types/fp.js";
8
+ import { useOpenRouterContext } from "./_context.js";
9
+ /**
10
+ * Submit an embedding request
11
+ *
12
+ * @remarks
13
+ * Submits an embedding request to the embeddings router
14
+ */
15
+ export function useEmbeddingsGenerateMutation(options) {
16
+ const client = useOpenRouterContext();
17
+ return useMutation({
18
+ ...buildEmbeddingsGenerateMutation(client, options),
19
+ ...options,
20
+ });
21
+ }
22
+ export function mutationKeyEmbeddingsGenerate() {
23
+ return ["@openrouter/sdk", "Embeddings", "generate"];
24
+ }
25
+ export function buildEmbeddingsGenerateMutation(client$, hookOptions) {
26
+ return {
27
+ mutationKey: mutationKeyEmbeddingsGenerate(),
28
+ mutationFn: function embeddingsGenerateMutationFn({ request, options, }) {
29
+ const mergedOptions = {
30
+ ...hookOptions,
31
+ ...options,
32
+ fetchOptions: {
33
+ ...hookOptions?.fetchOptions,
34
+ ...options?.fetchOptions,
35
+ signal: combineSignals(hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal),
36
+ },
37
+ };
38
+ return unwrapAsync(embeddingsGenerate(client$, request, mergedOptions));
39
+ },
40
+ };
41
+ }
42
+ //# sourceMappingURL=embeddingsGenerate.js.map
@@ -12,6 +12,7 @@ export * from "./chatSend.js";
12
12
  export * from "./completionsGenerate.js";
13
13
  export * from "./creditsCreateCoinbaseCharge.js";
14
14
  export * from "./creditsGetCredits.js";
15
+ export * from "./embeddingsGenerate.js";
15
16
  export * from "./endpointsList.js";
16
17
  export * from "./endpointsListZdrEndpoints.js";
17
18
  export * from "./generationsGetGeneration.js";
@@ -15,6 +15,7 @@ export * from "./chatSend.js";
15
15
  export * from "./completionsGenerate.js";
16
16
  export * from "./creditsCreateCoinbaseCharge.js";
17
17
  export * from "./creditsGetCredits.js";
18
+ export * from "./embeddingsGenerate.js";
18
19
  export * from "./endpointsList.js";
19
20
  export * from "./endpointsListZdrEndpoints.js";
20
21
  export * from "./generationsGetGeneration.js";
@@ -17,14 +17,14 @@ export declare function setParametersGetParametersData(client: QueryClient, quer
17
17
  author: string,
18
18
  slug: string,
19
19
  parameters: {
20
- provider?: operations.Provider | undefined;
20
+ provider?: operations.GetParametersProvider | undefined;
21
21
  }
22
22
  ], data: ParametersGetParametersQueryData): ParametersGetParametersQueryData | undefined;
23
23
  export declare function invalidateParametersGetParameters(client: QueryClient, queryKeyBase: TupleToPrefixes<[
24
24
  author: string,
25
25
  slug: string,
26
26
  parameters: {
27
- provider?: operations.Provider | undefined;
27
+ provider?: operations.GetParametersProvider | undefined;
28
28
  }
29
29
  ]>, filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">): Promise<void>;
30
30
  export declare function invalidateAllParametersGetParameters(client: QueryClient, filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">): Promise<void>;
@@ -33,6 +33,6 @@ export declare function buildParametersGetParametersQuery(client$: OpenRouterCor
33
33
  queryFn: (context: QueryFunctionContext) => Promise<ParametersGetParametersQueryData>;
34
34
  };
35
35
  export declare function queryKeyParametersGetParameters(author: string, slug: string, parameters: {
36
- provider?: operations.Provider | undefined;
36
+ provider?: operations.GetParametersProvider | undefined;
37
37
  }): QueryKey;
38
38
  //# sourceMappingURL=parametersGetParameters.d.ts.map
@@ -0,0 +1,12 @@
1
+ import { ClientSDK, RequestOptions } from "../lib/sdks.js";
2
+ import * as operations from "../models/operations/index.js";
3
+ export declare class Embeddings extends ClientSDK {
4
+ /**
5
+ * Submit an embedding request
6
+ *
7
+ * @remarks
8
+ * Submits an embedding request to the embeddings router
9
+ */
10
+ generate(request: operations.CreateEmbeddingsRequest, options?: RequestOptions): Promise<operations.CreateEmbeddingsResponse>;
11
+ }
12
+ //# sourceMappingURL=embeddings.d.ts.map
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+ import { embeddingsGenerate } from "../funcs/embeddingsGenerate.js";
5
+ import { ClientSDK } from "../lib/sdks.js";
6
+ import { unwrapAsync } from "../types/fp.js";
7
+ export class Embeddings extends ClientSDK {
8
+ /**
9
+ * Submit an embedding request
10
+ *
11
+ * @remarks
12
+ * Submits an embedding request to the embeddings router
13
+ */
14
+ async generate(request, options) {
15
+ return unwrapAsync(embeddingsGenerate(this, request, options));
16
+ }
17
+ }
18
+ //# sourceMappingURL=embeddings.js.map
package/esm/sdk/sdk.d.ts CHANGED
@@ -5,6 +5,7 @@ import { Beta } from "./beta.js";
5
5
  import { Chat } from "./chat.js";
6
6
  import { Completions } from "./completions.js";
7
7
  import { Credits } from "./credits.js";
8
+ import { Embeddings } from "./embeddings.js";
8
9
  import { Endpoints } from "./endpoints.js";
9
10
  import { Generations } from "./generations.js";
10
11
  import { Models } from "./models.js";
@@ -18,6 +19,8 @@ export declare class OpenRouter extends ClientSDK {
18
19
  get analytics(): Analytics;
19
20
  private _credits?;
20
21
  get credits(): Credits;
22
+ private _embeddings?;
23
+ get embeddings(): Embeddings;
21
24
  private _generations?;
22
25
  get generations(): Generations;
23
26
  private _models?;
package/esm/sdk/sdk.js CHANGED
@@ -8,6 +8,7 @@ import { Beta } from "./beta.js";
8
8
  import { Chat } from "./chat.js";
9
9
  import { Completions } from "./completions.js";
10
10
  import { Credits } from "./credits.js";
11
+ import { Embeddings } from "./embeddings.js";
11
12
  import { Endpoints } from "./endpoints.js";
12
13
  import { Generations } from "./generations.js";
13
14
  import { Models } from "./models.js";
@@ -24,6 +25,9 @@ export class OpenRouter extends ClientSDK {
24
25
  get credits() {
25
26
  return (this._credits ?? (this._credits = new Credits(this._options)));
26
27
  }
28
+ get embeddings() {
29
+ return (this._embeddings ?? (this._embeddings = new Embeddings(this._options)));
30
+ }
27
31
  get generations() {
28
32
  return (this._generations ?? (this._generations = new Generations(this._options)));
29
33
  }
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "0.1.0",
5
+ "version": "0.1.2",
6
6
  "exports": {
7
7
  ".": "./src/index.ts",
8
8
  "./models/errors": "./src/models/errors/index.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openrouter/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "author": "OpenRouter",
5
5
  "type": "module",
6
6
  "main": "./esm/index.js",