@openrouter/sdk 0.0.1-beta.12 → 0.0.1-beta.16

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 (51) hide show
  1. package/FUNCTIONS.md +15 -16
  2. package/REACT_QUERY.md +15 -16
  3. package/README.md +138 -110
  4. package/esm/funcs/betaResponsesSend.d.ts +2 -2
  5. package/esm/funcs/betaResponsesSend.js +3 -3
  6. package/esm/funcs/chatSend.d.ts +1 -1
  7. package/esm/funcs/modelsList.d.ts +2 -1
  8. package/esm/funcs/modelsList.js +3 -6
  9. package/esm/funcs/oAuthCreateAuthCode.d.ts +18 -0
  10. package/esm/funcs/oAuthCreateAuthCode.js +82 -0
  11. package/esm/funcs/oAuthCreateAuthorizationUrl.d.ts +2 -2
  12. package/esm/funcs/oAuthExchangeAuthCodeForAPIKey.d.ts +18 -0
  13. package/esm/funcs/oAuthExchangeAuthCodeForAPIKey.js +82 -0
  14. package/esm/lib/config.d.ts +2 -2
  15. package/esm/lib/config.js +2 -2
  16. package/esm/lib/event-streams.d.ts +1 -1
  17. package/esm/models/chatgenerationtokenusage.d.ts +2 -2
  18. package/esm/models/chatgenerationtokenusage.js +2 -4
  19. package/esm/models/operations/createauthkeyscode.d.ts +145 -0
  20. package/esm/models/operations/createauthkeyscode.js +146 -0
  21. package/esm/models/operations/createresponses.d.ts +58 -0
  22. package/esm/models/operations/createresponses.js +80 -0
  23. package/esm/models/operations/exchangeauthcodeforapikey.d.ts +104 -0
  24. package/esm/models/operations/exchangeauthcodeforapikey.js +111 -0
  25. package/esm/models/operations/getmodels.d.ts +0 -26
  26. package/esm/models/operations/getmodels.js +0 -30
  27. package/esm/models/operations/index.d.ts +3 -1
  28. package/esm/models/operations/index.js +3 -1
  29. package/esm/models/operations/sendchatcompletionrequest.d.ts +1 -1
  30. package/esm/models/operations/sendchatcompletionrequest.js +2 -1
  31. package/esm/react-query/betaResponsesSend.d.ts +1 -1
  32. package/esm/react-query/index.d.ts +2 -0
  33. package/esm/react-query/index.js +2 -0
  34. package/esm/react-query/modelsList.d.ts +2 -7
  35. package/esm/react-query/modelsList.js +0 -2
  36. package/esm/react-query/oAuthCreateAuthCode.d.ts +23 -0
  37. package/esm/react-query/oAuthCreateAuthCode.js +42 -0
  38. package/esm/react-query/oAuthExchangeAuthCodeForAPIKey.d.ts +23 -0
  39. package/esm/react-query/oAuthExchangeAuthCodeForAPIKey.js +42 -0
  40. package/esm/sdk/chat.d.ts +1 -1
  41. package/esm/sdk/models.d.ts +1 -1
  42. package/esm/sdk/oauth.d.ts +46 -0
  43. package/esm/sdk/oauth.js +67 -0
  44. package/esm/sdk/responses.d.ts +2 -2
  45. package/esm/sdk/sdk.d.ts +3 -0
  46. package/esm/sdk/sdk.js +4 -0
  47. package/jsr.json +1 -1
  48. package/package.json +3 -1
  49. package/vitest.config.ts +16 -1
  50. package/esm/models/operations/createapialpharesponses.d.ts +0 -58
  51. package/esm/models/operations/createapialpharesponses.js +0 -81
@@ -0,0 +1,58 @@
1
+ import * as z from "zod/v4";
2
+ import { EventStream } from "../../lib/event-streams.js";
3
+ import { Result as SafeParseResult } from "../../types/fp.js";
4
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
5
+ import * as models from "../index.js";
6
+ /**
7
+ * Successful response
8
+ */
9
+ export type CreateResponsesResponseBody = {
10
+ /**
11
+ * Union of all possible event types emitted during response streaming
12
+ */
13
+ data: models.OpenResponsesStreamEvent;
14
+ };
15
+ export type CreateResponsesResponse = models.OpenResponsesNonStreamingResponse | EventStream<models.OpenResponsesStreamEvent>;
16
+ /** @internal */
17
+ export declare const CreateResponsesResponseBody$inboundSchema: z.ZodType<CreateResponsesResponseBody, unknown>;
18
+ /** @internal */
19
+ export type CreateResponsesResponseBody$Outbound = {
20
+ data: models.OpenResponsesStreamEvent$Outbound;
21
+ };
22
+ /** @internal */
23
+ export declare const CreateResponsesResponseBody$outboundSchema: z.ZodType<CreateResponsesResponseBody$Outbound, CreateResponsesResponseBody>;
24
+ /**
25
+ * @internal
26
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
27
+ */
28
+ export declare namespace CreateResponsesResponseBody$ {
29
+ /** @deprecated use `CreateResponsesResponseBody$inboundSchema` instead. */
30
+ const inboundSchema: z.ZodType<CreateResponsesResponseBody, unknown, z.core.$ZodTypeInternals<CreateResponsesResponseBody, unknown>>;
31
+ /** @deprecated use `CreateResponsesResponseBody$outboundSchema` instead. */
32
+ const outboundSchema: z.ZodType<CreateResponsesResponseBody$Outbound, CreateResponsesResponseBody, z.core.$ZodTypeInternals<CreateResponsesResponseBody$Outbound, CreateResponsesResponseBody>>;
33
+ /** @deprecated use `CreateResponsesResponseBody$Outbound` instead. */
34
+ type Outbound = CreateResponsesResponseBody$Outbound;
35
+ }
36
+ export declare function createResponsesResponseBodyToJSON(createResponsesResponseBody: CreateResponsesResponseBody): string;
37
+ export declare function createResponsesResponseBodyFromJSON(jsonString: string): SafeParseResult<CreateResponsesResponseBody, SDKValidationError>;
38
+ /** @internal */
39
+ export declare const CreateResponsesResponse$inboundSchema: z.ZodType<CreateResponsesResponse, unknown>;
40
+ /** @internal */
41
+ export type CreateResponsesResponse$Outbound = models.OpenResponsesNonStreamingResponse$Outbound | never;
42
+ /** @internal */
43
+ export declare const CreateResponsesResponse$outboundSchema: z.ZodType<CreateResponsesResponse$Outbound, CreateResponsesResponse>;
44
+ /**
45
+ * @internal
46
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
47
+ */
48
+ export declare namespace CreateResponsesResponse$ {
49
+ /** @deprecated use `CreateResponsesResponse$inboundSchema` instead. */
50
+ const inboundSchema: z.ZodType<CreateResponsesResponse, unknown, z.core.$ZodTypeInternals<CreateResponsesResponse, unknown>>;
51
+ /** @deprecated use `CreateResponsesResponse$outboundSchema` instead. */
52
+ const outboundSchema: z.ZodType<models.OpenResponsesNonStreamingResponse$Outbound, CreateResponsesResponse, z.core.$ZodTypeInternals<models.OpenResponsesNonStreamingResponse$Outbound, CreateResponsesResponse>>;
53
+ /** @deprecated use `CreateResponsesResponse$Outbound` instead. */
54
+ type Outbound = CreateResponsesResponse$Outbound;
55
+ }
56
+ export declare function createResponsesResponseToJSON(createResponsesResponse: CreateResponsesResponse): string;
57
+ export declare function createResponsesResponseFromJSON(jsonString: string): SafeParseResult<CreateResponsesResponse, SDKValidationError>;
58
+ //# sourceMappingURL=createresponses.d.ts.map
@@ -0,0 +1,80 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+ import * as z from "zod/v4";
5
+ import { EventStream } from "../../lib/event-streams.js";
6
+ import { safeParse } from "../../lib/schemas.js";
7
+ import * as models from "../index.js";
8
+ /** @internal */
9
+ export const CreateResponsesResponseBody$inboundSchema = z.object({
10
+ data: z.string().transform((v, ctx) => {
11
+ try {
12
+ return JSON.parse(v);
13
+ }
14
+ catch (err) {
15
+ ctx.addIssue({
16
+ code: z.ZodIssueCode.custom,
17
+ message: `malformed json: ${err}`,
18
+ });
19
+ return z.NEVER;
20
+ }
21
+ }).pipe(models.OpenResponsesStreamEvent$inboundSchema),
22
+ });
23
+ /** @internal */
24
+ export const CreateResponsesResponseBody$outboundSchema = z.object({
25
+ data: models.OpenResponsesStreamEvent$outboundSchema,
26
+ });
27
+ /**
28
+ * @internal
29
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
30
+ */
31
+ export var CreateResponsesResponseBody$;
32
+ (function (CreateResponsesResponseBody$) {
33
+ /** @deprecated use `CreateResponsesResponseBody$inboundSchema` instead. */
34
+ CreateResponsesResponseBody$.inboundSchema = CreateResponsesResponseBody$inboundSchema;
35
+ /** @deprecated use `CreateResponsesResponseBody$outboundSchema` instead. */
36
+ CreateResponsesResponseBody$.outboundSchema = CreateResponsesResponseBody$outboundSchema;
37
+ })(CreateResponsesResponseBody$ || (CreateResponsesResponseBody$ = {}));
38
+ export function createResponsesResponseBodyToJSON(createResponsesResponseBody) {
39
+ return JSON.stringify(CreateResponsesResponseBody$outboundSchema.parse(createResponsesResponseBody));
40
+ }
41
+ export function createResponsesResponseBodyFromJSON(jsonString) {
42
+ return safeParse(jsonString, (x) => CreateResponsesResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateResponsesResponseBody' from JSON`);
43
+ }
44
+ /** @internal */
45
+ export const CreateResponsesResponse$inboundSchema = z.union([
46
+ models.OpenResponsesNonStreamingResponse$inboundSchema,
47
+ z.custom(x => x instanceof ReadableStream)
48
+ .transform(stream => {
49
+ return new EventStream(stream, rawEvent => {
50
+ if (rawEvent.data === "[DONE]")
51
+ return { done: true };
52
+ return {
53
+ value: z.lazy(() => CreateResponsesResponseBody$inboundSchema).parse(rawEvent)?.data,
54
+ };
55
+ });
56
+ }),
57
+ ]);
58
+ /** @internal */
59
+ export const CreateResponsesResponse$outboundSchema = z.union([
60
+ models.OpenResponsesNonStreamingResponse$outboundSchema,
61
+ z.never(),
62
+ ]);
63
+ /**
64
+ * @internal
65
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
66
+ */
67
+ export var CreateResponsesResponse$;
68
+ (function (CreateResponsesResponse$) {
69
+ /** @deprecated use `CreateResponsesResponse$inboundSchema` instead. */
70
+ CreateResponsesResponse$.inboundSchema = CreateResponsesResponse$inboundSchema;
71
+ /** @deprecated use `CreateResponsesResponse$outboundSchema` instead. */
72
+ CreateResponsesResponse$.outboundSchema = CreateResponsesResponse$outboundSchema;
73
+ })(CreateResponsesResponse$ || (CreateResponsesResponse$ = {}));
74
+ export function createResponsesResponseToJSON(createResponsesResponse) {
75
+ return JSON.stringify(CreateResponsesResponse$outboundSchema.parse(createResponsesResponse));
76
+ }
77
+ export function createResponsesResponseFromJSON(jsonString) {
78
+ return safeParse(jsonString, (x) => CreateResponsesResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateResponsesResponse' from JSON`);
79
+ }
80
+ //# sourceMappingURL=createresponses.js.map
@@ -0,0 +1,104 @@
1
+ import * as z from "zod/v4";
2
+ import { OpenEnum } from "../../types/enums.js";
3
+ import { Result as SafeParseResult } from "../../types/fp.js";
4
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
5
+ /**
6
+ * The method used to generate the code challenge
7
+ */
8
+ export declare const ExchangeAuthCodeForAPIKeyCodeChallengeMethod: {
9
+ readonly S256: "S256";
10
+ readonly Plain: "plain";
11
+ };
12
+ /**
13
+ * The method used to generate the code challenge
14
+ */
15
+ export type ExchangeAuthCodeForAPIKeyCodeChallengeMethod = OpenEnum<typeof ExchangeAuthCodeForAPIKeyCodeChallengeMethod>;
16
+ export type ExchangeAuthCodeForAPIKeyRequest = {
17
+ /**
18
+ * The authorization code received from the OAuth redirect
19
+ */
20
+ code: string;
21
+ /**
22
+ * The code verifier if code_challenge was used in the authorization request
23
+ */
24
+ codeVerifier?: string | undefined;
25
+ /**
26
+ * The method used to generate the code challenge
27
+ */
28
+ codeChallengeMethod?: ExchangeAuthCodeForAPIKeyCodeChallengeMethod | null | undefined;
29
+ };
30
+ /**
31
+ * Successfully exchanged code for an API key
32
+ */
33
+ export type ExchangeAuthCodeForAPIKeyResponse = {
34
+ /**
35
+ * The API key to use for OpenRouter requests
36
+ */
37
+ key: string;
38
+ /**
39
+ * User ID associated with the API key
40
+ */
41
+ userId: string | null;
42
+ };
43
+ /** @internal */
44
+ export declare const ExchangeAuthCodeForAPIKeyCodeChallengeMethod$inboundSchema: z.ZodType<ExchangeAuthCodeForAPIKeyCodeChallengeMethod, unknown>;
45
+ /** @internal */
46
+ export declare const ExchangeAuthCodeForAPIKeyCodeChallengeMethod$outboundSchema: z.ZodType<ExchangeAuthCodeForAPIKeyCodeChallengeMethod, ExchangeAuthCodeForAPIKeyCodeChallengeMethod>;
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 ExchangeAuthCodeForAPIKeyCodeChallengeMethod$ {
52
+ /** @deprecated use `ExchangeAuthCodeForAPIKeyCodeChallengeMethod$inboundSchema` instead. */
53
+ const inboundSchema: z.ZodType<ExchangeAuthCodeForAPIKeyCodeChallengeMethod, unknown, z.core.$ZodTypeInternals<ExchangeAuthCodeForAPIKeyCodeChallengeMethod, unknown>>;
54
+ /** @deprecated use `ExchangeAuthCodeForAPIKeyCodeChallengeMethod$outboundSchema` instead. */
55
+ const outboundSchema: z.ZodType<ExchangeAuthCodeForAPIKeyCodeChallengeMethod, ExchangeAuthCodeForAPIKeyCodeChallengeMethod, z.core.$ZodTypeInternals<ExchangeAuthCodeForAPIKeyCodeChallengeMethod, ExchangeAuthCodeForAPIKeyCodeChallengeMethod>>;
56
+ }
57
+ /** @internal */
58
+ export declare const ExchangeAuthCodeForAPIKeyRequest$inboundSchema: z.ZodType<ExchangeAuthCodeForAPIKeyRequest, unknown>;
59
+ /** @internal */
60
+ export type ExchangeAuthCodeForAPIKeyRequest$Outbound = {
61
+ code: string;
62
+ code_verifier?: string | undefined;
63
+ code_challenge_method?: string | null | undefined;
64
+ };
65
+ /** @internal */
66
+ export declare const ExchangeAuthCodeForAPIKeyRequest$outboundSchema: z.ZodType<ExchangeAuthCodeForAPIKeyRequest$Outbound, ExchangeAuthCodeForAPIKeyRequest>;
67
+ /**
68
+ * @internal
69
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
70
+ */
71
+ export declare namespace ExchangeAuthCodeForAPIKeyRequest$ {
72
+ /** @deprecated use `ExchangeAuthCodeForAPIKeyRequest$inboundSchema` instead. */
73
+ const inboundSchema: z.ZodType<ExchangeAuthCodeForAPIKeyRequest, unknown, z.core.$ZodTypeInternals<ExchangeAuthCodeForAPIKeyRequest, unknown>>;
74
+ /** @deprecated use `ExchangeAuthCodeForAPIKeyRequest$outboundSchema` instead. */
75
+ const outboundSchema: z.ZodType<ExchangeAuthCodeForAPIKeyRequest$Outbound, ExchangeAuthCodeForAPIKeyRequest, z.core.$ZodTypeInternals<ExchangeAuthCodeForAPIKeyRequest$Outbound, ExchangeAuthCodeForAPIKeyRequest>>;
76
+ /** @deprecated use `ExchangeAuthCodeForAPIKeyRequest$Outbound` instead. */
77
+ type Outbound = ExchangeAuthCodeForAPIKeyRequest$Outbound;
78
+ }
79
+ export declare function exchangeAuthCodeForAPIKeyRequestToJSON(exchangeAuthCodeForAPIKeyRequest: ExchangeAuthCodeForAPIKeyRequest): string;
80
+ export declare function exchangeAuthCodeForAPIKeyRequestFromJSON(jsonString: string): SafeParseResult<ExchangeAuthCodeForAPIKeyRequest, SDKValidationError>;
81
+ /** @internal */
82
+ export declare const ExchangeAuthCodeForAPIKeyResponse$inboundSchema: z.ZodType<ExchangeAuthCodeForAPIKeyResponse, unknown>;
83
+ /** @internal */
84
+ export type ExchangeAuthCodeForAPIKeyResponse$Outbound = {
85
+ key: string;
86
+ user_id: string | null;
87
+ };
88
+ /** @internal */
89
+ export declare const ExchangeAuthCodeForAPIKeyResponse$outboundSchema: z.ZodType<ExchangeAuthCodeForAPIKeyResponse$Outbound, ExchangeAuthCodeForAPIKeyResponse>;
90
+ /**
91
+ * @internal
92
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
93
+ */
94
+ export declare namespace ExchangeAuthCodeForAPIKeyResponse$ {
95
+ /** @deprecated use `ExchangeAuthCodeForAPIKeyResponse$inboundSchema` instead. */
96
+ const inboundSchema: z.ZodType<ExchangeAuthCodeForAPIKeyResponse, unknown, z.core.$ZodTypeInternals<ExchangeAuthCodeForAPIKeyResponse, unknown>>;
97
+ /** @deprecated use `ExchangeAuthCodeForAPIKeyResponse$outboundSchema` instead. */
98
+ const outboundSchema: z.ZodType<ExchangeAuthCodeForAPIKeyResponse$Outbound, ExchangeAuthCodeForAPIKeyResponse, z.core.$ZodTypeInternals<ExchangeAuthCodeForAPIKeyResponse$Outbound, ExchangeAuthCodeForAPIKeyResponse>>;
99
+ /** @deprecated use `ExchangeAuthCodeForAPIKeyResponse$Outbound` instead. */
100
+ type Outbound = ExchangeAuthCodeForAPIKeyResponse$Outbound;
101
+ }
102
+ export declare function exchangeAuthCodeForAPIKeyResponseToJSON(exchangeAuthCodeForAPIKeyResponse: ExchangeAuthCodeForAPIKeyResponse): string;
103
+ export declare function exchangeAuthCodeForAPIKeyResponseFromJSON(jsonString: string): SafeParseResult<ExchangeAuthCodeForAPIKeyResponse, SDKValidationError>;
104
+ //# sourceMappingURL=exchangeauthcodeforapikey.d.ts.map
@@ -0,0 +1,111 @@
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
+ /**
9
+ * The method used to generate the code challenge
10
+ */
11
+ export const ExchangeAuthCodeForAPIKeyCodeChallengeMethod = {
12
+ S256: "S256",
13
+ Plain: "plain",
14
+ };
15
+ /** @internal */
16
+ export const ExchangeAuthCodeForAPIKeyCodeChallengeMethod$inboundSchema = z
17
+ .union([
18
+ z.enum(ExchangeAuthCodeForAPIKeyCodeChallengeMethod),
19
+ z.string().transform(catchUnrecognizedEnum),
20
+ ]);
21
+ /** @internal */
22
+ export const ExchangeAuthCodeForAPIKeyCodeChallengeMethod$outboundSchema = z.union([
23
+ z.enum(ExchangeAuthCodeForAPIKeyCodeChallengeMethod),
24
+ z.string().and(z.custom()),
25
+ ]);
26
+ /**
27
+ * @internal
28
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
29
+ */
30
+ export var ExchangeAuthCodeForAPIKeyCodeChallengeMethod$;
31
+ (function (ExchangeAuthCodeForAPIKeyCodeChallengeMethod$) {
32
+ /** @deprecated use `ExchangeAuthCodeForAPIKeyCodeChallengeMethod$inboundSchema` instead. */
33
+ ExchangeAuthCodeForAPIKeyCodeChallengeMethod$.inboundSchema = ExchangeAuthCodeForAPIKeyCodeChallengeMethod$inboundSchema;
34
+ /** @deprecated use `ExchangeAuthCodeForAPIKeyCodeChallengeMethod$outboundSchema` instead. */
35
+ ExchangeAuthCodeForAPIKeyCodeChallengeMethod$.outboundSchema = ExchangeAuthCodeForAPIKeyCodeChallengeMethod$outboundSchema;
36
+ })(ExchangeAuthCodeForAPIKeyCodeChallengeMethod$ || (ExchangeAuthCodeForAPIKeyCodeChallengeMethod$ = {}));
37
+ /** @internal */
38
+ export const ExchangeAuthCodeForAPIKeyRequest$inboundSchema = z.object({
39
+ code: z.string(),
40
+ code_verifier: z.string().optional(),
41
+ code_challenge_method: z.nullable(ExchangeAuthCodeForAPIKeyCodeChallengeMethod$inboundSchema).optional(),
42
+ }).transform((v) => {
43
+ return remap$(v, {
44
+ "code_verifier": "codeVerifier",
45
+ "code_challenge_method": "codeChallengeMethod",
46
+ });
47
+ });
48
+ /** @internal */
49
+ export const ExchangeAuthCodeForAPIKeyRequest$outboundSchema = z.object({
50
+ code: z.string(),
51
+ codeVerifier: z.string().optional(),
52
+ codeChallengeMethod: z.nullable(ExchangeAuthCodeForAPIKeyCodeChallengeMethod$outboundSchema).optional(),
53
+ }).transform((v) => {
54
+ return remap$(v, {
55
+ codeVerifier: "code_verifier",
56
+ codeChallengeMethod: "code_challenge_method",
57
+ });
58
+ });
59
+ /**
60
+ * @internal
61
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
62
+ */
63
+ export var ExchangeAuthCodeForAPIKeyRequest$;
64
+ (function (ExchangeAuthCodeForAPIKeyRequest$) {
65
+ /** @deprecated use `ExchangeAuthCodeForAPIKeyRequest$inboundSchema` instead. */
66
+ ExchangeAuthCodeForAPIKeyRequest$.inboundSchema = ExchangeAuthCodeForAPIKeyRequest$inboundSchema;
67
+ /** @deprecated use `ExchangeAuthCodeForAPIKeyRequest$outboundSchema` instead. */
68
+ ExchangeAuthCodeForAPIKeyRequest$.outboundSchema = ExchangeAuthCodeForAPIKeyRequest$outboundSchema;
69
+ })(ExchangeAuthCodeForAPIKeyRequest$ || (ExchangeAuthCodeForAPIKeyRequest$ = {}));
70
+ export function exchangeAuthCodeForAPIKeyRequestToJSON(exchangeAuthCodeForAPIKeyRequest) {
71
+ return JSON.stringify(ExchangeAuthCodeForAPIKeyRequest$outboundSchema.parse(exchangeAuthCodeForAPIKeyRequest));
72
+ }
73
+ export function exchangeAuthCodeForAPIKeyRequestFromJSON(jsonString) {
74
+ return safeParse(jsonString, (x) => ExchangeAuthCodeForAPIKeyRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExchangeAuthCodeForAPIKeyRequest' from JSON`);
75
+ }
76
+ /** @internal */
77
+ export const ExchangeAuthCodeForAPIKeyResponse$inboundSchema = z.object({
78
+ key: z.string(),
79
+ user_id: z.nullable(z.string()),
80
+ }).transform((v) => {
81
+ return remap$(v, {
82
+ "user_id": "userId",
83
+ });
84
+ });
85
+ /** @internal */
86
+ export const ExchangeAuthCodeForAPIKeyResponse$outboundSchema = z.object({
87
+ key: z.string(),
88
+ userId: z.nullable(z.string()),
89
+ }).transform((v) => {
90
+ return remap$(v, {
91
+ userId: "user_id",
92
+ });
93
+ });
94
+ /**
95
+ * @internal
96
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
97
+ */
98
+ export var ExchangeAuthCodeForAPIKeyResponse$;
99
+ (function (ExchangeAuthCodeForAPIKeyResponse$) {
100
+ /** @deprecated use `ExchangeAuthCodeForAPIKeyResponse$inboundSchema` instead. */
101
+ ExchangeAuthCodeForAPIKeyResponse$.inboundSchema = ExchangeAuthCodeForAPIKeyResponse$inboundSchema;
102
+ /** @deprecated use `ExchangeAuthCodeForAPIKeyResponse$outboundSchema` instead. */
103
+ ExchangeAuthCodeForAPIKeyResponse$.outboundSchema = ExchangeAuthCodeForAPIKeyResponse$outboundSchema;
104
+ })(ExchangeAuthCodeForAPIKeyResponse$ || (ExchangeAuthCodeForAPIKeyResponse$ = {}));
105
+ export function exchangeAuthCodeForAPIKeyResponseToJSON(exchangeAuthCodeForAPIKeyResponse) {
106
+ return JSON.stringify(ExchangeAuthCodeForAPIKeyResponse$outboundSchema.parse(exchangeAuthCodeForAPIKeyResponse));
107
+ }
108
+ export function exchangeAuthCodeForAPIKeyResponseFromJSON(jsonString) {
109
+ return safeParse(jsonString, (x) => ExchangeAuthCodeForAPIKeyResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExchangeAuthCodeForAPIKeyResponse' from JSON`);
110
+ }
111
+ //# sourceMappingURL=exchangeauthcodeforapikey.js.map
@@ -1,22 +1,16 @@
1
1
  import * as z from "zod/v4";
2
2
  import { Result as SafeParseResult } from "../../types/fp.js";
3
3
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
4
- import * as models from "../index.js";
5
4
  export type GetModelsRequest = {
6
5
  category?: string | undefined;
7
6
  supportedParameters?: string | undefined;
8
- useRss?: string | undefined;
9
- useRssChatLinks?: string | undefined;
10
7
  };
11
- export type GetModelsResponse = models.ModelsListResponse | string;
12
8
  /** @internal */
13
9
  export declare const GetModelsRequest$inboundSchema: z.ZodType<GetModelsRequest, unknown>;
14
10
  /** @internal */
15
11
  export type GetModelsRequest$Outbound = {
16
12
  category?: string | undefined;
17
13
  supported_parameters?: string | undefined;
18
- use_rss?: string | undefined;
19
- use_rss_chat_links?: string | undefined;
20
14
  };
21
15
  /** @internal */
22
16
  export declare const GetModelsRequest$outboundSchema: z.ZodType<GetModelsRequest$Outbound, GetModelsRequest>;
@@ -34,24 +28,4 @@ export declare namespace GetModelsRequest$ {
34
28
  }
35
29
  export declare function getModelsRequestToJSON(getModelsRequest: GetModelsRequest): string;
36
30
  export declare function getModelsRequestFromJSON(jsonString: string): SafeParseResult<GetModelsRequest, SDKValidationError>;
37
- /** @internal */
38
- export declare const GetModelsResponse$inboundSchema: z.ZodType<GetModelsResponse, unknown>;
39
- /** @internal */
40
- export type GetModelsResponse$Outbound = models.ModelsListResponse$Outbound | string;
41
- /** @internal */
42
- export declare const GetModelsResponse$outboundSchema: z.ZodType<GetModelsResponse$Outbound, GetModelsResponse>;
43
- /**
44
- * @internal
45
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
46
- */
47
- export declare namespace GetModelsResponse$ {
48
- /** @deprecated use `GetModelsResponse$inboundSchema` instead. */
49
- const inboundSchema: z.ZodType<GetModelsResponse, unknown, z.core.$ZodTypeInternals<GetModelsResponse, unknown>>;
50
- /** @deprecated use `GetModelsResponse$outboundSchema` instead. */
51
- const outboundSchema: z.ZodType<GetModelsResponse$Outbound, GetModelsResponse, z.core.$ZodTypeInternals<GetModelsResponse$Outbound, GetModelsResponse>>;
52
- /** @deprecated use `GetModelsResponse$Outbound` instead. */
53
- type Outbound = GetModelsResponse$Outbound;
54
- }
55
- export declare function getModelsResponseToJSON(getModelsResponse: GetModelsResponse): string;
56
- export declare function getModelsResponseFromJSON(jsonString: string): SafeParseResult<GetModelsResponse, SDKValidationError>;
57
31
  //# sourceMappingURL=getmodels.d.ts.map
@@ -4,31 +4,22 @@
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
- import * as models from "../index.js";
8
7
  /** @internal */
9
8
  export const GetModelsRequest$inboundSchema = z.object({
10
9
  category: z.string().optional(),
11
10
  supported_parameters: z.string().optional(),
12
- use_rss: z.string().optional(),
13
- use_rss_chat_links: z.string().optional(),
14
11
  }).transform((v) => {
15
12
  return remap$(v, {
16
13
  "supported_parameters": "supportedParameters",
17
- "use_rss": "useRss",
18
- "use_rss_chat_links": "useRssChatLinks",
19
14
  });
20
15
  });
21
16
  /** @internal */
22
17
  export const GetModelsRequest$outboundSchema = z.object({
23
18
  category: z.string().optional(),
24
19
  supportedParameters: z.string().optional(),
25
- useRss: z.string().optional(),
26
- useRssChatLinks: z.string().optional(),
27
20
  }).transform((v) => {
28
21
  return remap$(v, {
29
22
  supportedParameters: "supported_parameters",
30
- useRss: "use_rss",
31
- useRssChatLinks: "use_rss_chat_links",
32
23
  });
33
24
  });
34
25
  /**
@@ -48,25 +39,4 @@ export function getModelsRequestToJSON(getModelsRequest) {
48
39
  export function getModelsRequestFromJSON(jsonString) {
49
40
  return safeParse(jsonString, (x) => GetModelsRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetModelsRequest' from JSON`);
50
41
  }
51
- /** @internal */
52
- export const GetModelsResponse$inboundSchema = z.union([models.ModelsListResponse$inboundSchema, z.string()]);
53
- /** @internal */
54
- export const GetModelsResponse$outboundSchema = z.union([models.ModelsListResponse$outboundSchema, z.string()]);
55
- /**
56
- * @internal
57
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
58
- */
59
- export var GetModelsResponse$;
60
- (function (GetModelsResponse$) {
61
- /** @deprecated use `GetModelsResponse$inboundSchema` instead. */
62
- GetModelsResponse$.inboundSchema = GetModelsResponse$inboundSchema;
63
- /** @deprecated use `GetModelsResponse$outboundSchema` instead. */
64
- GetModelsResponse$.outboundSchema = GetModelsResponse$outboundSchema;
65
- })(GetModelsResponse$ || (GetModelsResponse$ = {}));
66
- export function getModelsResponseToJSON(getModelsResponse) {
67
- return JSON.stringify(GetModelsResponse$outboundSchema.parse(getModelsResponse));
68
- }
69
- export function getModelsResponseFromJSON(jsonString) {
70
- return safeParse(jsonString, (x) => GetModelsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetModelsResponse' from JSON`);
71
- }
72
42
  //# sourceMappingURL=getmodels.js.map
@@ -1,7 +1,9 @@
1
- export * from "./createapialpharesponses.js";
1
+ export * from "./createauthkeyscode.js";
2
2
  export * from "./createcoinbasecharge.js";
3
3
  export * from "./createkeys.js";
4
+ export * from "./createresponses.js";
4
5
  export * from "./deletekeys.js";
6
+ export * from "./exchangeauthcodeforapikey.js";
5
7
  export * from "./getcredits.js";
6
8
  export * from "./getcurrentkey.js";
7
9
  export * from "./getgeneration.js";
@@ -1,10 +1,12 @@
1
1
  /*
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  */
4
- export * from "./createapialpharesponses.js";
4
+ export * from "./createauthkeyscode.js";
5
5
  export * from "./createcoinbasecharge.js";
6
6
  export * from "./createkeys.js";
7
+ export * from "./createresponses.js";
7
8
  export * from "./deletekeys.js";
9
+ export * from "./exchangeauthcodeforapikey.js";
8
10
  export * from "./getcredits.js";
9
11
  export * from "./getcurrentkey.js";
10
12
  export * from "./getgeneration.js";
@@ -3,7 +3,7 @@ import { EventStream } from "../../lib/event-streams.js";
3
3
  import { Result as SafeParseResult } from "../../types/fp.js";
4
4
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
5
5
  import * as models from "../index.js";
6
- export type SendChatCompletionRequestResponse = models.ChatResponse | EventStream<models.ChatStreamingResponseChunk>;
6
+ export type SendChatCompletionRequestResponse = models.ChatResponse | EventStream<models.ChatStreamingResponseChunkData>;
7
7
  /** @internal */
8
8
  export declare const SendChatCompletionRequestResponse$inboundSchema: z.ZodType<SendChatCompletionRequestResponse, unknown>;
9
9
  /** @internal */
@@ -14,7 +14,8 @@ export const SendChatCompletionRequestResponse$inboundSchema = z.union([
14
14
  if (rawEvent.data === "[DONE]")
15
15
  return { done: true };
16
16
  return {
17
- value: models.ChatStreamingResponseChunk$inboundSchema.parse(rawEvent),
17
+ value: models.ChatStreamingResponseChunk$inboundSchema.parse(rawEvent)
18
+ ?.data,
18
19
  };
19
20
  });
20
21
  }),
@@ -8,7 +8,7 @@ export type BetaResponsesSendMutationVariables = {
8
8
  request: models.OpenResponsesRequest;
9
9
  options?: RequestOptions;
10
10
  };
11
- export type BetaResponsesSendMutationData = operations.CreateApiAlphaResponsesResponse;
11
+ export type BetaResponsesSendMutationData = operations.CreateResponsesResponse;
12
12
  /**
13
13
  * Create a response
14
14
  *
@@ -18,6 +18,8 @@ export * from "./generationsGetGeneration.js";
18
18
  export * from "./modelsCount.js";
19
19
  export * from "./modelsList.js";
20
20
  export * from "./modelsListForUser.js";
21
+ export * from "./oAuthCreateAuthCode.js";
22
+ export * from "./oAuthExchangeAuthCodeForAPIKey.js";
21
23
  export * from "./parametersGetParameters.js";
22
24
  export * from "./providersList.js";
23
25
  //# sourceMappingURL=index.d.ts.map
@@ -21,6 +21,8 @@ export * from "./generationsGetGeneration.js";
21
21
  export * from "./modelsCount.js";
22
22
  export * from "./modelsList.js";
23
23
  export * from "./modelsListForUser.js";
24
+ export * from "./oAuthCreateAuthCode.js";
25
+ export * from "./oAuthExchangeAuthCodeForAPIKey.js";
24
26
  export * from "./parametersGetParameters.js";
25
27
  export * from "./providersList.js";
26
28
  //# sourceMappingURL=index.js.map
@@ -1,9 +1,10 @@
1
1
  import { InvalidateQueryFilters, QueryClient, QueryFunctionContext, QueryKey, UseQueryResult, UseSuspenseQueryResult } from "@tanstack/react-query";
2
2
  import { OpenRouterCore } from "../core.js";
3
3
  import { RequestOptions } from "../lib/sdks.js";
4
+ import * as models from "../models/index.js";
4
5
  import * as operations from "../models/operations/index.js";
5
6
  import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes } from "./_types.js";
6
- export type ModelsListQueryData = operations.GetModelsResponse;
7
+ export type ModelsListQueryData = models.ModelsListResponse;
7
8
  /**
8
9
  * List all models and their properties
9
10
  */
@@ -17,16 +18,12 @@ export declare function setModelsListData(client: QueryClient, queryKeyBase: [
17
18
  parameters: {
18
19
  category?: string | undefined;
19
20
  supportedParameters?: string | undefined;
20
- useRss?: string | undefined;
21
- useRssChatLinks?: string | undefined;
22
21
  }
23
22
  ], data: ModelsListQueryData): ModelsListQueryData | undefined;
24
23
  export declare function invalidateModelsList(client: QueryClient, queryKeyBase: TupleToPrefixes<[
25
24
  parameters: {
26
25
  category?: string | undefined;
27
26
  supportedParameters?: string | undefined;
28
- useRss?: string | undefined;
29
- useRssChatLinks?: string | undefined;
30
27
  }
31
28
  ]>, filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">): Promise<void>;
32
29
  export declare function invalidateAllModelsList(client: QueryClient, filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">): Promise<void>;
@@ -37,7 +34,5 @@ export declare function buildModelsListQuery(client$: OpenRouterCore, request?:
37
34
  export declare function queryKeyModelsList(parameters: {
38
35
  category?: string | undefined;
39
36
  supportedParameters?: string | undefined;
40
- useRss?: string | undefined;
41
- useRssChatLinks?: string | undefined;
42
37
  }): QueryKey;
43
38
  //# sourceMappingURL=modelsList.d.ts.map
@@ -52,8 +52,6 @@ export function buildModelsListQuery(client$, request, options) {
52
52
  queryKey: queryKeyModelsList({
53
53
  category: request?.category,
54
54
  supportedParameters: request?.supportedParameters,
55
- useRss: request?.useRss,
56
- useRssChatLinks: request?.useRssChatLinks,
57
55
  }),
58
56
  queryFn: async function modelsListQueryFn(ctx) {
59
57
  const sig = combineSignals(ctx.signal, options?.fetchOptions?.signal);
@@ -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 OAuthCreateAuthCodeMutationVariables = {
7
+ request: operations.CreateAuthKeysCodeRequest;
8
+ options?: RequestOptions;
9
+ };
10
+ export type OAuthCreateAuthCodeMutationData = operations.CreateAuthKeysCodeResponse;
11
+ /**
12
+ * Create authorization code
13
+ *
14
+ * @remarks
15
+ * Create an authorization code for the PKCE flow to generate a user-controlled API key
16
+ */
17
+ export declare function useOAuthCreateAuthCodeMutation(options?: MutationHookOptions<OAuthCreateAuthCodeMutationData, Error, OAuthCreateAuthCodeMutationVariables>): UseMutationResult<OAuthCreateAuthCodeMutationData, Error, OAuthCreateAuthCodeMutationVariables>;
18
+ export declare function mutationKeyOAuthCreateAuthCode(): MutationKey;
19
+ export declare function buildOAuthCreateAuthCodeMutation(client$: OpenRouterCore, hookOptions?: RequestOptions): {
20
+ mutationKey: MutationKey;
21
+ mutationFn: (variables: OAuthCreateAuthCodeMutationVariables) => Promise<OAuthCreateAuthCodeMutationData>;
22
+ };
23
+ //# sourceMappingURL=oAuthCreateAuthCode.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 { oAuthCreateAuthCode } from "../funcs/oAuthCreateAuthCode.js";
6
+ import { combineSignals } from "../lib/primitives.js";
7
+ import { unwrapAsync } from "../types/fp.js";
8
+ import { useOpenRouterContext } from "./_context.js";
9
+ /**
10
+ * Create authorization code
11
+ *
12
+ * @remarks
13
+ * Create an authorization code for the PKCE flow to generate a user-controlled API key
14
+ */
15
+ export function useOAuthCreateAuthCodeMutation(options) {
16
+ const client = useOpenRouterContext();
17
+ return useMutation({
18
+ ...buildOAuthCreateAuthCodeMutation(client, options),
19
+ ...options,
20
+ });
21
+ }
22
+ export function mutationKeyOAuthCreateAuthCode() {
23
+ return ["@openrouter/sdk", "OAuth", "createAuthCode"];
24
+ }
25
+ export function buildOAuthCreateAuthCodeMutation(client$, hookOptions) {
26
+ return {
27
+ mutationKey: mutationKeyOAuthCreateAuthCode(),
28
+ mutationFn: function oAuthCreateAuthCodeMutationFn({ 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(oAuthCreateAuthCode(client$, request, mergedOptions));
39
+ },
40
+ };
41
+ }
42
+ //# sourceMappingURL=oAuthCreateAuthCode.js.map