@openrouter/sdk 0.12.30 → 0.12.32

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 (68) hide show
  1. package/esm/funcs/betaResponsesSend.js +1 -0
  2. package/esm/funcs/chatSend.js +1 -0
  3. package/esm/lib/config.d.ts +2 -2
  4. package/esm/lib/config.js +2 -2
  5. package/esm/models/chatresult.d.ts +2 -0
  6. package/esm/models/chatresult.js +3 -0
  7. package/esm/models/chatstreamchunk.d.ts +2 -0
  8. package/esm/models/chatstreamchunk.js +3 -0
  9. package/esm/models/endpointinfo.d.ts +14 -0
  10. package/esm/models/endpointinfo.js +25 -0
  11. package/esm/models/endpointsmetadata.d.ts +14 -0
  12. package/esm/models/endpointsmetadata.js +23 -0
  13. package/esm/models/errors/badgatewayresponseerror.d.ts +6 -0
  14. package/esm/models/errors/badgatewayresponseerror.js +6 -0
  15. package/esm/models/errors/badrequestresponseerror.d.ts +6 -0
  16. package/esm/models/errors/badrequestresponseerror.js +6 -0
  17. package/esm/models/errors/conflictresponseerror.d.ts +6 -0
  18. package/esm/models/errors/conflictresponseerror.js +6 -0
  19. package/esm/models/errors/edgenetworktimeoutresponseerror.d.ts +6 -0
  20. package/esm/models/errors/edgenetworktimeoutresponseerror.js +6 -0
  21. package/esm/models/errors/forbiddenresponseerror.d.ts +6 -0
  22. package/esm/models/errors/forbiddenresponseerror.js +6 -0
  23. package/esm/models/errors/internalserverresponseerror.d.ts +6 -0
  24. package/esm/models/errors/internalserverresponseerror.js +6 -0
  25. package/esm/models/errors/notfoundresponseerror.d.ts +6 -0
  26. package/esm/models/errors/notfoundresponseerror.js +6 -0
  27. package/esm/models/errors/payloadtoolargeresponseerror.d.ts +6 -0
  28. package/esm/models/errors/payloadtoolargeresponseerror.js +6 -0
  29. package/esm/models/errors/paymentrequiredresponseerror.d.ts +6 -0
  30. package/esm/models/errors/paymentrequiredresponseerror.js +6 -0
  31. package/esm/models/errors/provideroverloadedresponseerror.d.ts +6 -0
  32. package/esm/models/errors/provideroverloadedresponseerror.js +6 -0
  33. package/esm/models/errors/requesttimeoutresponseerror.d.ts +6 -0
  34. package/esm/models/errors/requesttimeoutresponseerror.js +6 -0
  35. package/esm/models/errors/serviceunavailableresponseerror.d.ts +6 -0
  36. package/esm/models/errors/serviceunavailableresponseerror.js +6 -0
  37. package/esm/models/errors/toomanyrequestsresponseerror.d.ts +6 -0
  38. package/esm/models/errors/toomanyrequestsresponseerror.js +6 -0
  39. package/esm/models/errors/unauthorizedresponseerror.d.ts +6 -0
  40. package/esm/models/errors/unauthorizedresponseerror.js +6 -0
  41. package/esm/models/errors/unprocessableentityresponseerror.d.ts +6 -0
  42. package/esm/models/errors/unprocessableentityresponseerror.js +6 -0
  43. package/esm/models/index.d.ts +10 -0
  44. package/esm/models/index.js +10 -0
  45. package/esm/models/metadatalevel.d.ts +16 -0
  46. package/esm/models/metadatalevel.js +15 -0
  47. package/esm/models/openresponsesresult.d.ts +2 -0
  48. package/esm/models/openresponsesresult.js +3 -0
  49. package/esm/models/openroutermetadata.d.ts +24 -0
  50. package/esm/models/openroutermetadata.js +33 -0
  51. package/esm/models/operations/createresponses.d.ts +4 -11
  52. package/esm/models/operations/createresponses.js +5 -20
  53. package/esm/models/operations/sendchatcompletionrequest.d.ts +5 -0
  54. package/esm/models/operations/sendchatcompletionrequest.js +3 -0
  55. package/esm/models/pipelinestage.d.ts +21 -0
  56. package/esm/models/pipelinestage.js +28 -0
  57. package/esm/models/pipelinestagetype.d.ts +21 -0
  58. package/esm/models/pipelinestagetype.js +20 -0
  59. package/esm/models/responsesstreamingresponse.d.ts +14 -0
  60. package/esm/models/responsesstreamingresponse.js +27 -0
  61. package/esm/models/routerattempt.d.ts +12 -0
  62. package/esm/models/routerattempt.js +17 -0
  63. package/esm/models/routerparams.d.ts +16 -0
  64. package/esm/models/routerparams.js +24 -0
  65. package/esm/models/routingstrategy.d.ts +16 -0
  66. package/esm/models/routingstrategy.js +18 -0
  67. package/jsr.json +1 -1
  68. package/package.json +5 -5
@@ -28,6 +28,7 @@ async function $do(client, request, options) {
28
28
  ? "text/event-stream"
29
29
  : "application/json",
30
30
  "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
31
+ "X-OpenRouter-Experimental-Metadata": encodeSimple("X-OpenRouter-Experimental-Metadata", payload["X-OpenRouter-Experimental-Metadata"], { explode: false, charEncoding: "none" }),
31
32
  "X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
32
33
  "X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
33
34
  }));
@@ -28,6 +28,7 @@ async function $do(client, request, options) {
28
28
  ? "text/event-stream"
29
29
  : "application/json",
30
30
  "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
31
+ "X-OpenRouter-Experimental-Metadata": encodeSimple("X-OpenRouter-Experimental-Metadata", payload["X-OpenRouter-Experimental-Metadata"], { explode: false, charEncoding: "none" }),
31
32
  "X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
32
33
  "X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
33
34
  }));
@@ -49,8 +49,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
49
49
  export declare const SDK_METADATA: {
50
50
  readonly language: "typescript";
51
51
  readonly openapiDocVersion: "1.0.0";
52
- readonly sdkVersion: "0.12.30";
52
+ readonly sdkVersion: "0.12.32";
53
53
  readonly genVersion: "2.879.1";
54
- readonly userAgent: "speakeasy-sdk/typescript 0.12.30 2.879.1 1.0.0 @openrouter/sdk";
54
+ readonly userAgent: "speakeasy-sdk/typescript 0.12.32 2.879.1 1.0.0 @openrouter/sdk";
55
55
  };
56
56
  //# sourceMappingURL=config.d.ts.map
package/esm/lib/config.js CHANGED
@@ -26,8 +26,8 @@ export function serverURLFromOptions(options) {
26
26
  export const SDK_METADATA = {
27
27
  language: "typescript",
28
28
  openapiDocVersion: "1.0.0",
29
- sdkVersion: "0.12.30",
29
+ sdkVersion: "0.12.32",
30
30
  genVersion: "2.879.1",
31
- userAgent: "speakeasy-sdk/typescript 0.12.30 2.879.1 1.0.0 @openrouter/sdk",
31
+ userAgent: "speakeasy-sdk/typescript 0.12.32 2.879.1 1.0.0 @openrouter/sdk",
32
32
  };
33
33
  //# sourceMappingURL=config.js.map
@@ -4,6 +4,7 @@ import { Result as SafeParseResult } from "../types/fp.js";
4
4
  import { ChatChoice } from "./chatchoice.js";
5
5
  import { ChatUsage } from "./chatusage.js";
6
6
  import { SDKValidationError } from "./errors/sdkvalidationerror.js";
7
+ import { OpenRouterMetadata } from "./openroutermetadata.js";
7
8
  export declare const ChatResultObject: {
8
9
  readonly ChatCompletion: "chat.completion";
9
10
  };
@@ -29,6 +30,7 @@ export type ChatResult = {
29
30
  */
30
31
  model: string;
31
32
  object: ChatResultObject;
33
+ openrouterMetadata?: OpenRouterMetadata | undefined;
32
34
  /**
33
35
  * The service tier used by the upstream provider for this request
34
36
  */
@@ -7,6 +7,7 @@ import { remap as remap$ } from "../lib/primitives.js";
7
7
  import { safeParse } from "../lib/schemas.js";
8
8
  import { ChatChoice$inboundSchema } from "./chatchoice.js";
9
9
  import { ChatUsage$inboundSchema } from "./chatusage.js";
10
+ import { OpenRouterMetadata$inboundSchema, } from "./openroutermetadata.js";
10
11
  export const ChatResultObject = {
11
12
  ChatCompletion: "chat.completion",
12
13
  };
@@ -20,11 +21,13 @@ export const ChatResult$inboundSchema = z
20
21
  id: z.string(),
21
22
  model: z.string(),
22
23
  object: ChatResultObject$inboundSchema,
24
+ openrouter_metadata: OpenRouterMetadata$inboundSchema.optional(),
23
25
  service_tier: z.nullable(z.string()).optional(),
24
26
  system_fingerprint: z.nullable(z.string()),
25
27
  usage: ChatUsage$inboundSchema.optional(),
26
28
  }).transform((v) => {
27
29
  return remap$(v, {
30
+ "openrouter_metadata": "openrouterMetadata",
28
31
  "service_tier": "serviceTier",
29
32
  "system_fingerprint": "systemFingerprint",
30
33
  });
@@ -4,6 +4,7 @@ import { Result as SafeParseResult } from "../types/fp.js";
4
4
  import { ChatStreamChoice } from "./chatstreamchoice.js";
5
5
  import { ChatUsage } from "./chatusage.js";
6
6
  import { SDKValidationError } from "./errors/sdkvalidationerror.js";
7
+ import { OpenRouterMetadata } from "./openroutermetadata.js";
7
8
  /**
8
9
  * Error information
9
10
  */
@@ -46,6 +47,7 @@ export type ChatStreamChunk = {
46
47
  */
47
48
  model: string;
48
49
  object: ChatStreamChunkObject;
50
+ openrouterMetadata?: OpenRouterMetadata | undefined;
49
51
  /**
50
52
  * The service tier used by the upstream provider for this request
51
53
  */
@@ -7,6 +7,7 @@ import { remap as remap$ } from "../lib/primitives.js";
7
7
  import { safeParse } from "../lib/schemas.js";
8
8
  import { ChatStreamChoice$inboundSchema, } from "./chatstreamchoice.js";
9
9
  import { ChatUsage$inboundSchema } from "./chatusage.js";
10
+ import { OpenRouterMetadata$inboundSchema, } from "./openroutermetadata.js";
10
11
  export const ChatStreamChunkObject = {
11
12
  ChatCompletionChunk: "chat.completion.chunk",
12
13
  };
@@ -28,11 +29,13 @@ export const ChatStreamChunk$inboundSchema = z.object({
28
29
  id: z.string(),
29
30
  model: z.string(),
30
31
  object: ChatStreamChunkObject$inboundSchema,
32
+ openrouter_metadata: OpenRouterMetadata$inboundSchema.optional(),
31
33
  service_tier: z.nullable(z.string()).optional(),
32
34
  system_fingerprint: z.string().optional(),
33
35
  usage: ChatUsage$inboundSchema.optional(),
34
36
  }).transform((v) => {
35
37
  return remap$(v, {
38
+ "openrouter_metadata": "openrouterMetadata",
36
39
  "service_tier": "serviceTier",
37
40
  "system_fingerprint": "systemFingerprint",
38
41
  });
@@ -0,0 +1,14 @@
1
+ import * as z from "zod/v4";
2
+ import { Result as SafeParseResult } from "../types/fp.js";
3
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
4
+ export type EndpointInfo = {
5
+ model: string;
6
+ provider: string;
7
+ selected: boolean;
8
+ sortRank: number;
9
+ sortValue: number | null;
10
+ };
11
+ /** @internal */
12
+ export declare const EndpointInfo$inboundSchema: z.ZodType<EndpointInfo, unknown>;
13
+ export declare function endpointInfoFromJSON(jsonString: string): SafeParseResult<EndpointInfo, SDKValidationError>;
14
+ //# sourceMappingURL=endpointinfo.d.ts.map
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 33effd05ad97
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { remap as remap$ } from "../lib/primitives.js";
7
+ import { safeParse } from "../lib/schemas.js";
8
+ /** @internal */
9
+ export const EndpointInfo$inboundSchema = z
10
+ .object({
11
+ model: z.string(),
12
+ provider: z.string(),
13
+ selected: z.boolean(),
14
+ sort_rank: z.int(),
15
+ sort_value: z.nullable(z.number()),
16
+ }).transform((v) => {
17
+ return remap$(v, {
18
+ "sort_rank": "sortRank",
19
+ "sort_value": "sortValue",
20
+ });
21
+ });
22
+ export function endpointInfoFromJSON(jsonString) {
23
+ return safeParse(jsonString, (x) => EndpointInfo$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EndpointInfo' from JSON`);
24
+ }
25
+ //# sourceMappingURL=endpointinfo.js.map
@@ -0,0 +1,14 @@
1
+ import * as z from "zod/v4";
2
+ import { Result as SafeParseResult } from "../types/fp.js";
3
+ import { EndpointInfo } from "./endpointinfo.js";
4
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
5
+ export type EndpointsMetadata = {
6
+ available: Array<EndpointInfo>;
7
+ sort: string;
8
+ sortValue?: number | null | undefined;
9
+ total: number;
10
+ };
11
+ /** @internal */
12
+ export declare const EndpointsMetadata$inboundSchema: z.ZodType<EndpointsMetadata, unknown>;
13
+ export declare function endpointsMetadataFromJSON(jsonString: string): SafeParseResult<EndpointsMetadata, SDKValidationError>;
14
+ //# sourceMappingURL=endpointsmetadata.d.ts.map
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 43bec63453bf
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { remap as remap$ } from "../lib/primitives.js";
7
+ import { safeParse } from "../lib/schemas.js";
8
+ import { EndpointInfo$inboundSchema } from "./endpointinfo.js";
9
+ /** @internal */
10
+ export const EndpointsMetadata$inboundSchema = z.object({
11
+ available: z.array(EndpointInfo$inboundSchema),
12
+ sort: z.string(),
13
+ sort_value: z.nullable(z.number()).optional(),
14
+ total: z.int(),
15
+ }).transform((v) => {
16
+ return remap$(v, {
17
+ "sort_value": "sortValue",
18
+ });
19
+ });
20
+ export function endpointsMetadataFromJSON(jsonString) {
21
+ return safeParse(jsonString, (x) => EndpointsMetadata$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EndpointsMetadata' from JSON`);
22
+ }
23
+ //# sourceMappingURL=endpointsmetadata.js.map
@@ -9,6 +9,9 @@ export type BadGatewayResponseErrorData = {
9
9
  * Error data for BadGatewayResponse
10
10
  */
11
11
  error: models.BadGatewayResponseErrorData;
12
+ openrouterMetadata?: {
13
+ [k: string]: any | null;
14
+ } | null | undefined;
12
15
  userId?: string | null | undefined;
13
16
  };
14
17
  /**
@@ -19,6 +22,9 @@ export declare class BadGatewayResponseError extends OpenRouterError {
19
22
  * Error data for BadGatewayResponse
20
23
  */
21
24
  error: models.BadGatewayResponseErrorData;
25
+ openrouterMetadata?: {
26
+ [k: string]: any | null;
27
+ } | null | undefined;
22
28
  userId?: string | null | undefined;
23
29
  /** The original data that was passed to this error instance. */
24
30
  data$: BadGatewayResponseErrorData;
@@ -16,6 +16,9 @@ export class BadGatewayResponseError extends OpenRouterError {
16
16
  super(message, httpMeta);
17
17
  this.data$ = err;
18
18
  this.error = err.error;
19
+ if (err.openrouterMetadata != null) {
20
+ this.openrouterMetadata = err.openrouterMetadata;
21
+ }
19
22
  if (err.userId != null)
20
23
  this.userId = err.userId;
21
24
  this.name = "BadGatewayResponseError";
@@ -24,6 +27,8 @@ export class BadGatewayResponseError extends OpenRouterError {
24
27
  /** @internal */
25
28
  export const BadGatewayResponseError$inboundSchema = z.object({
26
29
  error: models.BadGatewayResponseErrorData$inboundSchema,
30
+ openrouter_metadata: z.nullable(z.record(z.string(), z.nullable(z.any())))
31
+ .optional(),
27
32
  user_id: z.nullable(z.string()).optional(),
28
33
  request$: z.custom(x => x instanceof Request),
29
34
  response$: z.custom(x => x instanceof Response),
@@ -31,6 +36,7 @@ export const BadGatewayResponseError$inboundSchema = z.object({
31
36
  })
32
37
  .transform((v) => {
33
38
  const remapped = remap$(v, {
39
+ "openrouter_metadata": "openrouterMetadata",
34
40
  "user_id": "userId",
35
41
  });
36
42
  return new BadGatewayResponseError(remapped, {
@@ -9,6 +9,9 @@ export type BadRequestResponseErrorData = {
9
9
  * Error data for BadRequestResponse
10
10
  */
11
11
  error: models.BadRequestResponseErrorData;
12
+ openrouterMetadata?: {
13
+ [k: string]: any | null;
14
+ } | null | undefined;
12
15
  userId?: string | null | undefined;
13
16
  };
14
17
  /**
@@ -19,6 +22,9 @@ export declare class BadRequestResponseError extends OpenRouterError {
19
22
  * Error data for BadRequestResponse
20
23
  */
21
24
  error: models.BadRequestResponseErrorData;
25
+ openrouterMetadata?: {
26
+ [k: string]: any | null;
27
+ } | null | undefined;
22
28
  userId?: string | null | undefined;
23
29
  /** The original data that was passed to this error instance. */
24
30
  data$: BadRequestResponseErrorData;
@@ -16,6 +16,9 @@ export class BadRequestResponseError extends OpenRouterError {
16
16
  super(message, httpMeta);
17
17
  this.data$ = err;
18
18
  this.error = err.error;
19
+ if (err.openrouterMetadata != null) {
20
+ this.openrouterMetadata = err.openrouterMetadata;
21
+ }
19
22
  if (err.userId != null)
20
23
  this.userId = err.userId;
21
24
  this.name = "BadRequestResponseError";
@@ -24,6 +27,8 @@ export class BadRequestResponseError extends OpenRouterError {
24
27
  /** @internal */
25
28
  export const BadRequestResponseError$inboundSchema = z.object({
26
29
  error: models.BadRequestResponseErrorData$inboundSchema,
30
+ openrouter_metadata: z.nullable(z.record(z.string(), z.nullable(z.any())))
31
+ .optional(),
27
32
  user_id: z.nullable(z.string()).optional(),
28
33
  request$: z.custom(x => x instanceof Request),
29
34
  response$: z.custom(x => x instanceof Response),
@@ -31,6 +36,7 @@ export const BadRequestResponseError$inboundSchema = z.object({
31
36
  })
32
37
  .transform((v) => {
33
38
  const remapped = remap$(v, {
39
+ "openrouter_metadata": "openrouterMetadata",
34
40
  "user_id": "userId",
35
41
  });
36
42
  return new BadRequestResponseError(remapped, {
@@ -9,6 +9,9 @@ export type ConflictResponseErrorData = {
9
9
  * Error data for ConflictResponse
10
10
  */
11
11
  error: models.ConflictResponseErrorData;
12
+ openrouterMetadata?: {
13
+ [k: string]: any | null;
14
+ } | null | undefined;
12
15
  userId?: string | null | undefined;
13
16
  };
14
17
  /**
@@ -19,6 +22,9 @@ export declare class ConflictResponseError extends OpenRouterError {
19
22
  * Error data for ConflictResponse
20
23
  */
21
24
  error: models.ConflictResponseErrorData;
25
+ openrouterMetadata?: {
26
+ [k: string]: any | null;
27
+ } | null | undefined;
22
28
  userId?: string | null | undefined;
23
29
  /** The original data that was passed to this error instance. */
24
30
  data$: ConflictResponseErrorData;
@@ -16,6 +16,9 @@ export class ConflictResponseError extends OpenRouterError {
16
16
  super(message, httpMeta);
17
17
  this.data$ = err;
18
18
  this.error = err.error;
19
+ if (err.openrouterMetadata != null) {
20
+ this.openrouterMetadata = err.openrouterMetadata;
21
+ }
19
22
  if (err.userId != null)
20
23
  this.userId = err.userId;
21
24
  this.name = "ConflictResponseError";
@@ -24,6 +27,8 @@ export class ConflictResponseError extends OpenRouterError {
24
27
  /** @internal */
25
28
  export const ConflictResponseError$inboundSchema = z.object({
26
29
  error: models.ConflictResponseErrorData$inboundSchema,
30
+ openrouter_metadata: z.nullable(z.record(z.string(), z.nullable(z.any())))
31
+ .optional(),
27
32
  user_id: z.nullable(z.string()).optional(),
28
33
  request$: z.custom(x => x instanceof Request),
29
34
  response$: z.custom(x => x instanceof Response),
@@ -31,6 +36,7 @@ export const ConflictResponseError$inboundSchema = z.object({
31
36
  })
32
37
  .transform((v) => {
33
38
  const remapped = remap$(v, {
39
+ "openrouter_metadata": "openrouterMetadata",
34
40
  "user_id": "userId",
35
41
  });
36
42
  return new ConflictResponseError(remapped, {
@@ -9,6 +9,9 @@ export type EdgeNetworkTimeoutResponseErrorData = {
9
9
  * Error data for EdgeNetworkTimeoutResponse
10
10
  */
11
11
  error: models.EdgeNetworkTimeoutResponseErrorData;
12
+ openrouterMetadata?: {
13
+ [k: string]: any | null;
14
+ } | null | undefined;
12
15
  userId?: string | null | undefined;
13
16
  };
14
17
  /**
@@ -19,6 +22,9 @@ export declare class EdgeNetworkTimeoutResponseError extends OpenRouterError {
19
22
  * Error data for EdgeNetworkTimeoutResponse
20
23
  */
21
24
  error: models.EdgeNetworkTimeoutResponseErrorData;
25
+ openrouterMetadata?: {
26
+ [k: string]: any | null;
27
+ } | null | undefined;
22
28
  userId?: string | null | undefined;
23
29
  /** The original data that was passed to this error instance. */
24
30
  data$: EdgeNetworkTimeoutResponseErrorData;
@@ -16,6 +16,9 @@ export class EdgeNetworkTimeoutResponseError extends OpenRouterError {
16
16
  super(message, httpMeta);
17
17
  this.data$ = err;
18
18
  this.error = err.error;
19
+ if (err.openrouterMetadata != null) {
20
+ this.openrouterMetadata = err.openrouterMetadata;
21
+ }
19
22
  if (err.userId != null)
20
23
  this.userId = err.userId;
21
24
  this.name = "EdgeNetworkTimeoutResponseError";
@@ -24,6 +27,8 @@ export class EdgeNetworkTimeoutResponseError extends OpenRouterError {
24
27
  /** @internal */
25
28
  export const EdgeNetworkTimeoutResponseError$inboundSchema = z.object({
26
29
  error: models.EdgeNetworkTimeoutResponseErrorData$inboundSchema,
30
+ openrouter_metadata: z.nullable(z.record(z.string(), z.nullable(z.any())))
31
+ .optional(),
27
32
  user_id: z.nullable(z.string()).optional(),
28
33
  request$: z.custom(x => x instanceof Request),
29
34
  response$: z.custom(x => x instanceof Response),
@@ -31,6 +36,7 @@ export const EdgeNetworkTimeoutResponseError$inboundSchema = z.object({
31
36
  })
32
37
  .transform((v) => {
33
38
  const remapped = remap$(v, {
39
+ "openrouter_metadata": "openrouterMetadata",
34
40
  "user_id": "userId",
35
41
  });
36
42
  return new EdgeNetworkTimeoutResponseError(remapped, {
@@ -9,6 +9,9 @@ export type ForbiddenResponseErrorData = {
9
9
  * Error data for ForbiddenResponse
10
10
  */
11
11
  error: models.ForbiddenResponseErrorData;
12
+ openrouterMetadata?: {
13
+ [k: string]: any | null;
14
+ } | null | undefined;
12
15
  userId?: string | null | undefined;
13
16
  };
14
17
  /**
@@ -19,6 +22,9 @@ export declare class ForbiddenResponseError extends OpenRouterError {
19
22
  * Error data for ForbiddenResponse
20
23
  */
21
24
  error: models.ForbiddenResponseErrorData;
25
+ openrouterMetadata?: {
26
+ [k: string]: any | null;
27
+ } | null | undefined;
22
28
  userId?: string | null | undefined;
23
29
  /** The original data that was passed to this error instance. */
24
30
  data$: ForbiddenResponseErrorData;
@@ -16,6 +16,9 @@ export class ForbiddenResponseError extends OpenRouterError {
16
16
  super(message, httpMeta);
17
17
  this.data$ = err;
18
18
  this.error = err.error;
19
+ if (err.openrouterMetadata != null) {
20
+ this.openrouterMetadata = err.openrouterMetadata;
21
+ }
19
22
  if (err.userId != null)
20
23
  this.userId = err.userId;
21
24
  this.name = "ForbiddenResponseError";
@@ -24,6 +27,8 @@ export class ForbiddenResponseError extends OpenRouterError {
24
27
  /** @internal */
25
28
  export const ForbiddenResponseError$inboundSchema = z.object({
26
29
  error: models.ForbiddenResponseErrorData$inboundSchema,
30
+ openrouter_metadata: z.nullable(z.record(z.string(), z.nullable(z.any())))
31
+ .optional(),
27
32
  user_id: z.nullable(z.string()).optional(),
28
33
  request$: z.custom(x => x instanceof Request),
29
34
  response$: z.custom(x => x instanceof Response),
@@ -31,6 +36,7 @@ export const ForbiddenResponseError$inboundSchema = z.object({
31
36
  })
32
37
  .transform((v) => {
33
38
  const remapped = remap$(v, {
39
+ "openrouter_metadata": "openrouterMetadata",
34
40
  "user_id": "userId",
35
41
  });
36
42
  return new ForbiddenResponseError(remapped, {
@@ -9,6 +9,9 @@ export type InternalServerResponseErrorData = {
9
9
  * Error data for InternalServerResponse
10
10
  */
11
11
  error: models.InternalServerResponseErrorData;
12
+ openrouterMetadata?: {
13
+ [k: string]: any | null;
14
+ } | null | undefined;
12
15
  userId?: string | null | undefined;
13
16
  };
14
17
  /**
@@ -19,6 +22,9 @@ export declare class InternalServerResponseError extends OpenRouterError {
19
22
  * Error data for InternalServerResponse
20
23
  */
21
24
  error: models.InternalServerResponseErrorData;
25
+ openrouterMetadata?: {
26
+ [k: string]: any | null;
27
+ } | null | undefined;
22
28
  userId?: string | null | undefined;
23
29
  /** The original data that was passed to this error instance. */
24
30
  data$: InternalServerResponseErrorData;
@@ -16,6 +16,9 @@ export class InternalServerResponseError extends OpenRouterError {
16
16
  super(message, httpMeta);
17
17
  this.data$ = err;
18
18
  this.error = err.error;
19
+ if (err.openrouterMetadata != null) {
20
+ this.openrouterMetadata = err.openrouterMetadata;
21
+ }
19
22
  if (err.userId != null)
20
23
  this.userId = err.userId;
21
24
  this.name = "InternalServerResponseError";
@@ -24,6 +27,8 @@ export class InternalServerResponseError extends OpenRouterError {
24
27
  /** @internal */
25
28
  export const InternalServerResponseError$inboundSchema = z.object({
26
29
  error: models.InternalServerResponseErrorData$inboundSchema,
30
+ openrouter_metadata: z.nullable(z.record(z.string(), z.nullable(z.any())))
31
+ .optional(),
27
32
  user_id: z.nullable(z.string()).optional(),
28
33
  request$: z.custom(x => x instanceof Request),
29
34
  response$: z.custom(x => x instanceof Response),
@@ -31,6 +36,7 @@ export const InternalServerResponseError$inboundSchema = z.object({
31
36
  })
32
37
  .transform((v) => {
33
38
  const remapped = remap$(v, {
39
+ "openrouter_metadata": "openrouterMetadata",
34
40
  "user_id": "userId",
35
41
  });
36
42
  return new InternalServerResponseError(remapped, {
@@ -9,6 +9,9 @@ export type NotFoundResponseErrorData = {
9
9
  * Error data for NotFoundResponse
10
10
  */
11
11
  error: models.NotFoundResponseErrorData;
12
+ openrouterMetadata?: {
13
+ [k: string]: any | null;
14
+ } | null | undefined;
12
15
  userId?: string | null | undefined;
13
16
  };
14
17
  /**
@@ -19,6 +22,9 @@ export declare class NotFoundResponseError extends OpenRouterError {
19
22
  * Error data for NotFoundResponse
20
23
  */
21
24
  error: models.NotFoundResponseErrorData;
25
+ openrouterMetadata?: {
26
+ [k: string]: any | null;
27
+ } | null | undefined;
22
28
  userId?: string | null | undefined;
23
29
  /** The original data that was passed to this error instance. */
24
30
  data$: NotFoundResponseErrorData;
@@ -16,6 +16,9 @@ export class NotFoundResponseError extends OpenRouterError {
16
16
  super(message, httpMeta);
17
17
  this.data$ = err;
18
18
  this.error = err.error;
19
+ if (err.openrouterMetadata != null) {
20
+ this.openrouterMetadata = err.openrouterMetadata;
21
+ }
19
22
  if (err.userId != null)
20
23
  this.userId = err.userId;
21
24
  this.name = "NotFoundResponseError";
@@ -24,6 +27,8 @@ export class NotFoundResponseError extends OpenRouterError {
24
27
  /** @internal */
25
28
  export const NotFoundResponseError$inboundSchema = z.object({
26
29
  error: models.NotFoundResponseErrorData$inboundSchema,
30
+ openrouter_metadata: z.nullable(z.record(z.string(), z.nullable(z.any())))
31
+ .optional(),
27
32
  user_id: z.nullable(z.string()).optional(),
28
33
  request$: z.custom(x => x instanceof Request),
29
34
  response$: z.custom(x => x instanceof Response),
@@ -31,6 +36,7 @@ export const NotFoundResponseError$inboundSchema = z.object({
31
36
  })
32
37
  .transform((v) => {
33
38
  const remapped = remap$(v, {
39
+ "openrouter_metadata": "openrouterMetadata",
34
40
  "user_id": "userId",
35
41
  });
36
42
  return new NotFoundResponseError(remapped, {
@@ -9,6 +9,9 @@ export type PayloadTooLargeResponseErrorData = {
9
9
  * Error data for PayloadTooLargeResponse
10
10
  */
11
11
  error: models.PayloadTooLargeResponseErrorData;
12
+ openrouterMetadata?: {
13
+ [k: string]: any | null;
14
+ } | null | undefined;
12
15
  userId?: string | null | undefined;
13
16
  };
14
17
  /**
@@ -19,6 +22,9 @@ export declare class PayloadTooLargeResponseError extends OpenRouterError {
19
22
  * Error data for PayloadTooLargeResponse
20
23
  */
21
24
  error: models.PayloadTooLargeResponseErrorData;
25
+ openrouterMetadata?: {
26
+ [k: string]: any | null;
27
+ } | null | undefined;
22
28
  userId?: string | null | undefined;
23
29
  /** The original data that was passed to this error instance. */
24
30
  data$: PayloadTooLargeResponseErrorData;
@@ -16,6 +16,9 @@ export class PayloadTooLargeResponseError extends OpenRouterError {
16
16
  super(message, httpMeta);
17
17
  this.data$ = err;
18
18
  this.error = err.error;
19
+ if (err.openrouterMetadata != null) {
20
+ this.openrouterMetadata = err.openrouterMetadata;
21
+ }
19
22
  if (err.userId != null)
20
23
  this.userId = err.userId;
21
24
  this.name = "PayloadTooLargeResponseError";
@@ -24,6 +27,8 @@ export class PayloadTooLargeResponseError extends OpenRouterError {
24
27
  /** @internal */
25
28
  export const PayloadTooLargeResponseError$inboundSchema = z.object({
26
29
  error: models.PayloadTooLargeResponseErrorData$inboundSchema,
30
+ openrouter_metadata: z.nullable(z.record(z.string(), z.nullable(z.any())))
31
+ .optional(),
27
32
  user_id: z.nullable(z.string()).optional(),
28
33
  request$: z.custom(x => x instanceof Request),
29
34
  response$: z.custom(x => x instanceof Response),
@@ -31,6 +36,7 @@ export const PayloadTooLargeResponseError$inboundSchema = z.object({
31
36
  })
32
37
  .transform((v) => {
33
38
  const remapped = remap$(v, {
39
+ "openrouter_metadata": "openrouterMetadata",
34
40
  "user_id": "userId",
35
41
  });
36
42
  return new PayloadTooLargeResponseError(remapped, {
@@ -9,6 +9,9 @@ export type PaymentRequiredResponseErrorData = {
9
9
  * Error data for PaymentRequiredResponse
10
10
  */
11
11
  error: models.PaymentRequiredResponseErrorData;
12
+ openrouterMetadata?: {
13
+ [k: string]: any | null;
14
+ } | null | undefined;
12
15
  userId?: string | null | undefined;
13
16
  };
14
17
  /**
@@ -19,6 +22,9 @@ export declare class PaymentRequiredResponseError extends OpenRouterError {
19
22
  * Error data for PaymentRequiredResponse
20
23
  */
21
24
  error: models.PaymentRequiredResponseErrorData;
25
+ openrouterMetadata?: {
26
+ [k: string]: any | null;
27
+ } | null | undefined;
22
28
  userId?: string | null | undefined;
23
29
  /** The original data that was passed to this error instance. */
24
30
  data$: PaymentRequiredResponseErrorData;
@@ -16,6 +16,9 @@ export class PaymentRequiredResponseError extends OpenRouterError {
16
16
  super(message, httpMeta);
17
17
  this.data$ = err;
18
18
  this.error = err.error;
19
+ if (err.openrouterMetadata != null) {
20
+ this.openrouterMetadata = err.openrouterMetadata;
21
+ }
19
22
  if (err.userId != null)
20
23
  this.userId = err.userId;
21
24
  this.name = "PaymentRequiredResponseError";
@@ -24,6 +27,8 @@ export class PaymentRequiredResponseError extends OpenRouterError {
24
27
  /** @internal */
25
28
  export const PaymentRequiredResponseError$inboundSchema = z.object({
26
29
  error: models.PaymentRequiredResponseErrorData$inboundSchema,
30
+ openrouter_metadata: z.nullable(z.record(z.string(), z.nullable(z.any())))
31
+ .optional(),
27
32
  user_id: z.nullable(z.string()).optional(),
28
33
  request$: z.custom(x => x instanceof Request),
29
34
  response$: z.custom(x => x instanceof Response),
@@ -31,6 +36,7 @@ export const PaymentRequiredResponseError$inboundSchema = z.object({
31
36
  })
32
37
  .transform((v) => {
33
38
  const remapped = remap$(v, {
39
+ "openrouter_metadata": "openrouterMetadata",
34
40
  "user_id": "userId",
35
41
  });
36
42
  return new PaymentRequiredResponseError(remapped, {
@@ -9,6 +9,9 @@ export type ProviderOverloadedResponseErrorData = {
9
9
  * Error data for ProviderOverloadedResponse
10
10
  */
11
11
  error: models.ProviderOverloadedResponseErrorData;
12
+ openrouterMetadata?: {
13
+ [k: string]: any | null;
14
+ } | null | undefined;
12
15
  userId?: string | null | undefined;
13
16
  };
14
17
  /**
@@ -19,6 +22,9 @@ export declare class ProviderOverloadedResponseError extends OpenRouterError {
19
22
  * Error data for ProviderOverloadedResponse
20
23
  */
21
24
  error: models.ProviderOverloadedResponseErrorData;
25
+ openrouterMetadata?: {
26
+ [k: string]: any | null;
27
+ } | null | undefined;
22
28
  userId?: string | null | undefined;
23
29
  /** The original data that was passed to this error instance. */
24
30
  data$: ProviderOverloadedResponseErrorData;