@openrouter/sdk 1.5.43 → 1.5.45

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 (34) hide show
  1. package/esm/funcs/providersListProviderEndpoints.d.ts +19 -0
  2. package/esm/funcs/providersListProviderEndpoints.js +108 -0
  3. package/esm/lib/config.d.ts +2 -2
  4. package/esm/lib/config.js +2 -2
  5. package/esm/models/endpointsummary.d.ts +65 -0
  6. package/esm/models/endpointsummary.js +48 -0
  7. package/esm/models/endpointtestprofile.d.ts +271 -0
  8. package/esm/models/endpointtestprofile.js +252 -0
  9. package/esm/models/extractions.d.ts +16 -0
  10. package/esm/models/extractions.js +23 -0
  11. package/esm/models/index.d.ts +8 -0
  12. package/esm/models/index.js +8 -0
  13. package/esm/models/operations/gettaskclassifications.d.ts +4 -4
  14. package/esm/models/operations/gettaskclassifications.js +3 -3
  15. package/esm/models/operations/index.d.ts +1 -0
  16. package/esm/models/operations/index.js +1 -0
  17. package/esm/models/operations/listproviderendpoints.d.ts +106 -0
  18. package/esm/models/operations/listproviderendpoints.js +55 -0
  19. package/esm/models/perflast30mbyworkload.d.ts +2 -0
  20. package/esm/models/perflast30mbyworkload.js +2 -0
  21. package/esm/models/providerendpoints.d.ts +34 -0
  22. package/esm/models/providerendpoints.js +32 -0
  23. package/esm/models/providerendpointsresponse.d.ts +11 -0
  24. package/esm/models/providerendpointsresponse.js +15 -0
  25. package/esm/models/providerendpointstats.d.ts +11 -0
  26. package/esm/models/providerendpointstats.js +17 -0
  27. package/esm/models/providerendpointstatsavailable.d.ts +66 -0
  28. package/esm/models/providerendpointstatsavailable.js +51 -0
  29. package/esm/models/providerendpointstatsunavailable.d.ts +10 -0
  30. package/esm/models/providerendpointstatsunavailable.js +14 -0
  31. package/esm/sdk/providers.d.ts +8 -0
  32. package/esm/sdk/providers.js +10 -0
  33. package/jsr.json +1 -1
  34. package/package.json +6 -6
@@ -0,0 +1,32 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 248051591265
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { safeParse } from "../lib/schemas.js";
7
+ import * as openEnums from "../types/enums.js";
8
+ import { EndpointSummary$inboundSchema, } from "./endpointsummary.js";
9
+ import { ProviderEndpointStats$inboundSchema, } from "./providerendpointstats.js";
10
+ /**
11
+ * Time window the provider-wide stats cover
12
+ */
13
+ export const Window = {
14
+ Onehr: "1hr",
15
+ Oned: "1d",
16
+ Onew: "1w",
17
+ Onemo: "1mo",
18
+ Oney: "1y",
19
+ };
20
+ /** @internal */
21
+ export const Window$inboundSchema = openEnums
22
+ .inboundSchema(Window);
23
+ /** @internal */
24
+ export const ProviderEndpoints$inboundSchema = z.object({
25
+ endpoints: z.array(EndpointSummary$inboundSchema),
26
+ stats: ProviderEndpointStats$inboundSchema,
27
+ window: Window$inboundSchema,
28
+ });
29
+ export function providerEndpointsFromJSON(jsonString) {
30
+ return safeParse(jsonString, (x) => ProviderEndpoints$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ProviderEndpoints' from JSON`);
31
+ }
32
+ //# sourceMappingURL=providerendpoints.js.map
@@ -0,0 +1,11 @@
1
+ import * as z from "zod/v4";
2
+ import { Result as SafeParseResult } from "../types/fp.js";
3
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
4
+ import { ProviderEndpoints } from "./providerendpoints.js";
5
+ export type ProviderEndpointsResponse = {
6
+ data: ProviderEndpoints;
7
+ };
8
+ /** @internal */
9
+ export declare const ProviderEndpointsResponse$inboundSchema: z.ZodType<ProviderEndpointsResponse, unknown>;
10
+ export declare function providerEndpointsResponseFromJSON(jsonString: string): SafeParseResult<ProviderEndpointsResponse, SDKValidationError>;
11
+ //# sourceMappingURL=providerendpointsresponse.d.ts.map
@@ -0,0 +1,15 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 7e6b90e2ebc2
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { safeParse } from "../lib/schemas.js";
7
+ import { ProviderEndpoints$inboundSchema, } from "./providerendpoints.js";
8
+ /** @internal */
9
+ export const ProviderEndpointsResponse$inboundSchema = z.object({
10
+ data: ProviderEndpoints$inboundSchema,
11
+ });
12
+ export function providerEndpointsResponseFromJSON(jsonString) {
13
+ return safeParse(jsonString, (x) => ProviderEndpointsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ProviderEndpointsResponse' from JSON`);
14
+ }
15
+ //# sourceMappingURL=providerendpointsresponse.js.map
@@ -0,0 +1,11 @@
1
+ import * as z from "zod/v4";
2
+ import * as discriminatedUnionTypes from "../types/discriminatedUnion.js";
3
+ import { Result as SafeParseResult } from "../types/fp.js";
4
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
5
+ import { ProviderEndpointStatsAvailable } from "./providerendpointstatsavailable.js";
6
+ import { ProviderEndpointStatsUnavailable } from "./providerendpointstatsunavailable.js";
7
+ export type ProviderEndpointStats = ProviderEndpointStatsAvailable | ProviderEndpointStatsUnavailable | discriminatedUnionTypes.Unknown<"status">;
8
+ /** @internal */
9
+ export declare const ProviderEndpointStats$inboundSchema: z.ZodType<ProviderEndpointStats, unknown>;
10
+ export declare function providerEndpointStatsFromJSON(jsonString: string): SafeParseResult<ProviderEndpointStats, SDKValidationError>;
11
+ //# sourceMappingURL=providerendpointstats.d.ts.map
@@ -0,0 +1,17 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 0c878b38826c
4
+ */
5
+ import { safeParse } from "../lib/schemas.js";
6
+ import { discriminatedUnion } from "../types/discriminatedUnion.js";
7
+ import { ProviderEndpointStatsAvailable$inboundSchema, } from "./providerendpointstatsavailable.js";
8
+ import { ProviderEndpointStatsUnavailable$inboundSchema, } from "./providerendpointstatsunavailable.js";
9
+ /** @internal */
10
+ export const ProviderEndpointStats$inboundSchema = discriminatedUnion("status", {
11
+ available: ProviderEndpointStatsAvailable$inboundSchema,
12
+ unavailable: ProviderEndpointStatsUnavailable$inboundSchema,
13
+ });
14
+ export function providerEndpointStatsFromJSON(jsonString) {
15
+ return safeParse(jsonString, (x) => ProviderEndpointStats$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ProviderEndpointStats' from JSON`);
16
+ }
17
+ //# sourceMappingURL=providerendpointstats.js.map
@@ -0,0 +1,66 @@
1
+ import * as z from "zod/v4";
2
+ import { Result as SafeParseResult } from "../types/fp.js";
3
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
4
+ /**
5
+ * Request latency, milliseconds
6
+ */
7
+ export type LatencyMs = {
8
+ p50: number | null;
9
+ p90: number | null;
10
+ };
11
+ /**
12
+ * Output tokens per second
13
+ */
14
+ export type ThroughputTokensPerSecond = {
15
+ p50: number | null;
16
+ p90: number | null;
17
+ };
18
+ export type ProviderEndpointStatsAvailable = {
19
+ /**
20
+ * Endpoints the stats cover
21
+ */
22
+ endpointCount: number;
23
+ /**
24
+ * Errored share of requests that count toward uptime, 0-100
25
+ */
26
+ errorRatePercent: number;
27
+ /**
28
+ * Request latency, milliseconds
29
+ */
30
+ latencyMs: LatencyMs;
31
+ /**
32
+ * Routing quality, 0-100
33
+ */
34
+ qualityPercent: number | null;
35
+ /**
36
+ * Rate-limited share of routed requests, 0-100
37
+ */
38
+ rateLimitedPercent: number | null;
39
+ /**
40
+ * Routing reliability, 0-100
41
+ */
42
+ reliabilityPercent: number | null;
43
+ /**
44
+ * Requests in the window
45
+ */
46
+ requests: number;
47
+ status: "available";
48
+ /**
49
+ * Output tokens per second
50
+ */
51
+ throughputTokensPerSecond: ThroughputTokensPerSecond;
52
+ /**
53
+ * Successful share of requests that count toward uptime, 0-100
54
+ */
55
+ uptimePercent: number | null;
56
+ };
57
+ /** @internal */
58
+ export declare const LatencyMs$inboundSchema: z.ZodType<LatencyMs, unknown>;
59
+ export declare function latencyMsFromJSON(jsonString: string): SafeParseResult<LatencyMs, SDKValidationError>;
60
+ /** @internal */
61
+ export declare const ThroughputTokensPerSecond$inboundSchema: z.ZodType<ThroughputTokensPerSecond, unknown>;
62
+ export declare function throughputTokensPerSecondFromJSON(jsonString: string): SafeParseResult<ThroughputTokensPerSecond, SDKValidationError>;
63
+ /** @internal */
64
+ export declare const ProviderEndpointStatsAvailable$inboundSchema: z.ZodType<ProviderEndpointStatsAvailable, unknown>;
65
+ export declare function providerEndpointStatsAvailableFromJSON(jsonString: string): SafeParseResult<ProviderEndpointStatsAvailable, SDKValidationError>;
66
+ //# sourceMappingURL=providerendpointstatsavailable.d.ts.map
@@ -0,0 +1,51 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 2d30fafcb067
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 LatencyMs$inboundSchema = z.object({
10
+ p50: z.nullable(z.number()),
11
+ p90: z.nullable(z.number()),
12
+ });
13
+ export function latencyMsFromJSON(jsonString) {
14
+ return safeParse(jsonString, (x) => LatencyMs$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LatencyMs' from JSON`);
15
+ }
16
+ /** @internal */
17
+ export const ThroughputTokensPerSecond$inboundSchema = z.object({
18
+ p50: z.nullable(z.number()),
19
+ p90: z.nullable(z.number()),
20
+ });
21
+ export function throughputTokensPerSecondFromJSON(jsonString) {
22
+ return safeParse(jsonString, (x) => ThroughputTokensPerSecond$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ThroughputTokensPerSecond' from JSON`);
23
+ }
24
+ /** @internal */
25
+ export const ProviderEndpointStatsAvailable$inboundSchema = z.object({
26
+ endpoint_count: z.int(),
27
+ error_rate_percent: z.number(),
28
+ latency_ms: z.lazy(() => LatencyMs$inboundSchema),
29
+ quality_percent: z.nullable(z.number()),
30
+ rate_limited_percent: z.nullable(z.number()),
31
+ reliability_percent: z.nullable(z.number()),
32
+ requests: z.int(),
33
+ status: z.literal("available"),
34
+ throughput_tokens_per_second: z.lazy(() => ThroughputTokensPerSecond$inboundSchema),
35
+ uptime_percent: z.nullable(z.number()),
36
+ }).transform((v) => {
37
+ return remap$(v, {
38
+ "endpoint_count": "endpointCount",
39
+ "error_rate_percent": "errorRatePercent",
40
+ "latency_ms": "latencyMs",
41
+ "quality_percent": "qualityPercent",
42
+ "rate_limited_percent": "rateLimitedPercent",
43
+ "reliability_percent": "reliabilityPercent",
44
+ "throughput_tokens_per_second": "throughputTokensPerSecond",
45
+ "uptime_percent": "uptimePercent",
46
+ });
47
+ });
48
+ export function providerEndpointStatsAvailableFromJSON(jsonString) {
49
+ return safeParse(jsonString, (x) => ProviderEndpointStatsAvailable$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ProviderEndpointStatsAvailable' from JSON`);
50
+ }
51
+ //# sourceMappingURL=providerendpointstatsavailable.js.map
@@ -0,0 +1,10 @@
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 ProviderEndpointStatsUnavailable = {
5
+ status: "unavailable";
6
+ };
7
+ /** @internal */
8
+ export declare const ProviderEndpointStatsUnavailable$inboundSchema: z.ZodType<ProviderEndpointStatsUnavailable, unknown>;
9
+ export declare function providerEndpointStatsUnavailableFromJSON(jsonString: string): SafeParseResult<ProviderEndpointStatsUnavailable, SDKValidationError>;
10
+ //# sourceMappingURL=providerendpointstatsunavailable.d.ts.map
@@ -0,0 +1,14 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: f8a0fc50ae42
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { safeParse } from "../lib/schemas.js";
7
+ /** @internal */
8
+ export const ProviderEndpointStatsUnavailable$inboundSchema = z.object({
9
+ status: z.literal("unavailable"),
10
+ });
11
+ export function providerEndpointStatsUnavailableFromJSON(jsonString) {
12
+ return safeParse(jsonString, (x) => ProviderEndpointStatsUnavailable$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ProviderEndpointStatsUnavailable' from JSON`);
13
+ }
14
+ //# sourceMappingURL=providerendpointstatsunavailable.js.map
@@ -1,9 +1,17 @@
1
1
  import { ClientSDK, RequestOptions } from "../lib/sdks.js";
2
+ import * as models from "../models/index.js";
2
3
  import * as operations from "../models/operations/index.js";
3
4
  export declare class Providers extends ClientSDK {
4
5
  /**
5
6
  * List all providers
6
7
  */
7
8
  list(request?: operations.ListProvidersRequest | undefined, options?: RequestOptions): Promise<operations.ListProvidersResponse>;
9
+ /**
10
+ * List a provider's endpoints with provider-wide stats
11
+ *
12
+ * @remarks
13
+ * Returns every endpoint the provider serves, hidden ones included, with the provider-wide uptime, routing, latency and throughput stats over the window. Requires provider ownership, membership, or admin access.
14
+ */
15
+ listProviderEndpoints(request: operations.ListProviderEndpointsRequest, options?: RequestOptions): Promise<models.ProviderEndpointsResponse>;
8
16
  }
9
17
  //# sourceMappingURL=providers.d.ts.map
@@ -3,6 +3,7 @@
3
3
  * @generated-id: fb8faa7013d0
4
4
  */
5
5
  import { providersList } from "../funcs/providersList.js";
6
+ import { providersListProviderEndpoints } from "../funcs/providersListProviderEndpoints.js";
6
7
  import { ClientSDK } from "../lib/sdks.js";
7
8
  import { unwrapAsync } from "../types/fp.js";
8
9
  export class Providers extends ClientSDK {
@@ -12,5 +13,14 @@ export class Providers extends ClientSDK {
12
13
  async list(request, options) {
13
14
  return unwrapAsync(providersList(this, request, options));
14
15
  }
16
+ /**
17
+ * List a provider's endpoints with provider-wide stats
18
+ *
19
+ * @remarks
20
+ * Returns every endpoint the provider serves, hidden ones included, with the provider-wide uptime, routing, latency and throughput stats over the window. Requires provider ownership, membership, or admin access.
21
+ */
22
+ async listProviderEndpoints(request, options) {
23
+ return unwrapAsync(providersListProviderEndpoints(this, request, options));
24
+ }
15
25
  }
16
26
  //# sourceMappingURL=providers.js.map
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "1.5.43",
5
+ "version": "1.5.45",
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": "1.5.43",
3
+ "version": "1.5.45",
4
4
  "author": "OpenRouter",
5
5
  "description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 400+ language models through a unified API.",
6
6
  "keywords": [
@@ -73,15 +73,15 @@
73
73
  "lint": "eslint --cache --max-warnings=0 src",
74
74
  "build": "tsc && node scripts/unbarrel-imports.js",
75
75
  "prepublishOnly": "npm run build",
76
+ "compile": "tsc && node scripts/unbarrel-imports.js",
76
77
  "prepare": "npm run build",
77
78
  "test": "vitest --run --project unit",
78
- "test:watch": "vitest --watch --project unit",
79
- "typecheck:transit": "exit 0",
80
- "compile": "tsc && node scripts/unbarrel-imports.js",
81
- "postinstall": "node scripts/check-types.js || true",
82
79
  "test:e2e": "vitest --run --project e2e",
80
+ "typecheck": "tsc --noEmit",
81
+ "postinstall": "node scripts/check-types.js || true",
83
82
  "test:transit": "exit 0",
84
- "typecheck": "tsc --noEmit"
83
+ "test:watch": "vitest --watch --project unit",
84
+ "typecheck:transit": "exit 0"
85
85
  },
86
86
  "peerDependencies": {
87
87