@openrouter/sdk 1.2.86 → 1.2.88

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.
@@ -13,7 +13,7 @@ import { PageIterator } from "../types/operations.js";
13
13
  * List models filtered by user provider preferences, privacy settings, and guardrails
14
14
  *
15
15
  * @remarks
16
- * List models filtered by user provider preferences, [privacy settings](https://openrouter.ai/docs/guides/privacy/provider-logging), and [guardrails](https://openrouter.ai/docs/guides/features/guardrails). Returns text-output models by default; pass `output_modalities` (e.g. `image,audio,embeddings` or `all`) to include other modalities. If requesting through a regional hostname, the results will be filtered to models that satisfy in-region routing for that region.
16
+ * List models filtered by user provider preferences, [privacy settings](https://openrouter.ai/docs/guides/privacy/provider-logging), and [guardrails](https://openrouter.ai/docs/guides/features/guardrails). Returns text-output models by default; pass `output_modalities` (a comma-separated list of `text`, `image`, `embeddings`, `audio`, `video`, `rerank`, `speech`, `transcription`, or `all`) to include other modalities. If requesting through a regional hostname, the results will be filtered to models that satisfy in-region routing for that region.
17
17
  */
18
18
  export declare function modelsListForUser(client: OpenRouterCore, security: operations.ListModelsUserSecurity, request?: operations.ListModelsUserRequest | undefined, options?: RequestOptions): APIPromise<PageIterator<Result<operations.ListModelsUserResponse, errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>, {
19
19
  offset: number;
@@ -17,7 +17,7 @@ import { createPageIterator, haltIterator, } from "../types/operations.js";
17
17
  * List models filtered by user provider preferences, privacy settings, and guardrails
18
18
  *
19
19
  * @remarks
20
- * List models filtered by user provider preferences, [privacy settings](https://openrouter.ai/docs/guides/privacy/provider-logging), and [guardrails](https://openrouter.ai/docs/guides/features/guardrails). Returns text-output models by default; pass `output_modalities` (e.g. `image,audio,embeddings` or `all`) to include other modalities. If requesting through a regional hostname, the results will be filtered to models that satisfy in-region routing for that region.
20
+ * List models filtered by user provider preferences, [privacy settings](https://openrouter.ai/docs/guides/privacy/provider-logging), and [guardrails](https://openrouter.ai/docs/guides/features/guardrails). Returns text-output models by default; pass `output_modalities` (a comma-separated list of `text`, `image`, `embeddings`, `audio`, `video`, `rerank`, `speech`, `transcription`, or `all`) to include other modalities. If requesting through a regional hostname, the results will be filtered to models that satisfy in-region routing for that region.
21
21
  */
22
22
  export function modelsListForUser(client, security, request, options) {
23
23
  return new APIPromise($do(client, security, request, options));
@@ -50,8 +50,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
50
50
  export declare const SDK_METADATA: {
51
51
  readonly language: "typescript";
52
52
  readonly openapiDocVersion: "1.0.0";
53
- readonly sdkVersion: "1.2.86";
53
+ readonly sdkVersion: "1.2.88";
54
54
  readonly genVersion: "2.914.0";
55
- readonly userAgent: "speakeasy-sdk/typescript 1.2.86 2.914.0 1.0.0 @openrouter/sdk";
55
+ readonly userAgent: "speakeasy-sdk/typescript 1.2.88 2.914.0 1.0.0 @openrouter/sdk";
56
56
  };
57
57
  //# sourceMappingURL=config.d.ts.map
package/esm/lib/config.js CHANGED
@@ -29,8 +29,8 @@ export function serverURLFromOptions(options) {
29
29
  export const SDK_METADATA = {
30
30
  language: "typescript",
31
31
  openapiDocVersion: "1.0.0",
32
- sdkVersion: "1.2.86",
32
+ sdkVersion: "1.2.88",
33
33
  genVersion: "2.914.0",
34
- userAgent: "speakeasy-sdk/typescript 1.2.86 2.914.0 1.0.0 @openrouter/sdk",
34
+ userAgent: "speakeasy-sdk/typescript 1.2.88 2.914.0 1.0.0 @openrouter/sdk",
35
35
  };
36
36
  //# sourceMappingURL=config.js.map
@@ -135,7 +135,7 @@ export type GetModelsRequest = {
135
135
  */
136
136
  supportedParameters?: string | undefined;
137
137
  /**
138
- * Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or "all" to include all models. Defaults to "text".
138
+ * Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, speech, transcription) or "all" to include all models. Defaults to "text".
139
139
  */
140
140
  outputModalities?: string | undefined;
141
141
  /**
@@ -41,7 +41,7 @@ export type ListModelsCountRequest = {
41
41
  */
42
42
  appCategories?: string | undefined;
43
43
  /**
44
- * Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or "all" to include all models. Defaults to "text".
44
+ * Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, speech, transcription) or "all" to include all models. Defaults to "text".
45
45
  */
46
46
  outputModalities?: string | undefined;
47
47
  };
@@ -55,7 +55,7 @@ export type ListModelsUserRequest = {
55
55
  */
56
56
  limit?: number | undefined;
57
57
  /**
58
- * Filter models by output modality. Accepts a comma-separated list of modalities (text, image, audio, embeddings) or "all" to include all models. Defaults to "text".
58
+ * Filter models by output modality. Accepts a comma-separated list of modalities (text, image, embeddings, audio, video, rerank, speech, transcription) or "all" to include all models. Defaults to "text".
59
59
  */
60
60
  outputModalities?: string | undefined;
61
61
  };
@@ -8,6 +8,83 @@ import { PricingOverride } from "./pricingoverride.js";
8
8
  import { ProviderName } from "./providername.js";
9
9
  import { Quantization } from "./quantization.js";
10
10
  import { ToolChoiceSupport } from "./toolchoicesupport.js";
11
+ export type Embeddings = {
12
+ latency: PercentileStats | null;
13
+ /**
14
+ * Total requests admitted for this workload in the window.
15
+ */
16
+ requestCount: number | null;
17
+ throughput: PercentileStats | null;
18
+ };
19
+ export type ImageGeneration = {
20
+ latency: PercentileStats | null;
21
+ /**
22
+ * Total requests admitted for this workload in the window.
23
+ */
24
+ requestCount: number | null;
25
+ throughput: PercentileStats | null;
26
+ };
27
+ export type Rerank = {
28
+ latency: PercentileStats | null;
29
+ /**
30
+ * Total requests admitted for this workload in the window.
31
+ */
32
+ requestCount: number | null;
33
+ throughput: PercentileStats | null;
34
+ };
35
+ export type STT = {
36
+ latency: PercentileStats | null;
37
+ /**
38
+ * Total requests admitted for this workload in the window.
39
+ */
40
+ requestCount: number | null;
41
+ throughput: PercentileStats | null;
42
+ };
43
+ export type TextGeneration = {
44
+ latency: PercentileStats | null;
45
+ /**
46
+ * Total requests admitted for this workload in the window.
47
+ */
48
+ requestCount: number | null;
49
+ throughput: PercentileStats | null;
50
+ };
51
+ export type TTS = {
52
+ latency: PercentileStats | null;
53
+ /**
54
+ * Total requests admitted for this workload in the window.
55
+ */
56
+ requestCount: number | null;
57
+ throughput: PercentileStats | null;
58
+ };
59
+ export type Unknown = {
60
+ latency: PercentileStats | null;
61
+ /**
62
+ * Total requests admitted for this workload in the window.
63
+ */
64
+ requestCount: number | null;
65
+ throughput: PercentileStats | null;
66
+ };
67
+ export type VideoGeneration = {
68
+ latency: PercentileStats | null;
69
+ /**
70
+ * Total requests admitted for this workload in the window.
71
+ */
72
+ requestCount: number | null;
73
+ throughput: PercentileStats | null;
74
+ };
75
+ /**
76
+ * Endpoint performance over the last 30 minutes, keyed by the kind of request served (e.g. `text_generation`, `image_generation`). Additive to the legacy singular latency and throughput fields; image and video generation report end-to-end latency. Only visible when authenticated with an API key or cookie.
77
+ */
78
+ export type PerfLast30mByWorkload = {
79
+ embeddings?: Embeddings | undefined;
80
+ imageGeneration?: ImageGeneration | undefined;
81
+ rerank?: Rerank | undefined;
82
+ stt?: STT | undefined;
83
+ textGeneration?: TextGeneration | undefined;
84
+ tts?: TTS | undefined;
85
+ unknown?: Unknown | undefined;
86
+ videoGeneration?: VideoGeneration | undefined;
87
+ };
11
88
  export type Pricing = {
12
89
  /**
13
90
  * Price in USD per audio input token
@@ -94,6 +171,10 @@ export type PublicEndpoint = {
94
171
  modelId: string;
95
172
  modelName: string;
96
173
  name: string;
174
+ /**
175
+ * Endpoint performance over the last 30 minutes, keyed by the kind of request served (e.g. `text_generation`, `image_generation`). Additive to the legacy singular latency and throughput fields; image and video generation report end-to-end latency. Only visible when authenticated with an API key or cookie.
176
+ */
177
+ perfLast30mByWorkload?: PerfLast30mByWorkload | undefined;
97
178
  pricing: Pricing;
98
179
  providerName: ProviderName;
99
180
  quantization: Quantization | null;
@@ -121,6 +202,33 @@ export type PublicEndpoint = {
121
202
  uptimeLast5m: number | null;
122
203
  };
123
204
  /** @internal */
205
+ export declare const Embeddings$inboundSchema: z.ZodType<Embeddings, unknown>;
206
+ export declare function embeddingsFromJSON(jsonString: string): SafeParseResult<Embeddings, SDKValidationError>;
207
+ /** @internal */
208
+ export declare const ImageGeneration$inboundSchema: z.ZodType<ImageGeneration, unknown>;
209
+ export declare function imageGenerationFromJSON(jsonString: string): SafeParseResult<ImageGeneration, SDKValidationError>;
210
+ /** @internal */
211
+ export declare const Rerank$inboundSchema: z.ZodType<Rerank, unknown>;
212
+ export declare function rerankFromJSON(jsonString: string): SafeParseResult<Rerank, SDKValidationError>;
213
+ /** @internal */
214
+ export declare const STT$inboundSchema: z.ZodType<STT, unknown>;
215
+ export declare function sttFromJSON(jsonString: string): SafeParseResult<STT, SDKValidationError>;
216
+ /** @internal */
217
+ export declare const TextGeneration$inboundSchema: z.ZodType<TextGeneration, unknown>;
218
+ export declare function textGenerationFromJSON(jsonString: string): SafeParseResult<TextGeneration, SDKValidationError>;
219
+ /** @internal */
220
+ export declare const TTS$inboundSchema: z.ZodType<TTS, unknown>;
221
+ export declare function ttsFromJSON(jsonString: string): SafeParseResult<TTS, SDKValidationError>;
222
+ /** @internal */
223
+ export declare const Unknown$inboundSchema: z.ZodType<Unknown, unknown>;
224
+ export declare function unknownFromJSON(jsonString: string): SafeParseResult<Unknown, SDKValidationError>;
225
+ /** @internal */
226
+ export declare const VideoGeneration$inboundSchema: z.ZodType<VideoGeneration, unknown>;
227
+ export declare function videoGenerationFromJSON(jsonString: string): SafeParseResult<VideoGeneration, SDKValidationError>;
228
+ /** @internal */
229
+ export declare const PerfLast30mByWorkload$inboundSchema: z.ZodType<PerfLast30mByWorkload, unknown>;
230
+ export declare function perfLast30mByWorkloadFromJSON(jsonString: string): SafeParseResult<PerfLast30mByWorkload, SDKValidationError>;
231
+ /** @internal */
124
232
  export declare const Pricing$inboundSchema: z.ZodType<Pricing, unknown>;
125
233
  export declare function pricingFromJSON(jsonString: string): SafeParseResult<Pricing, SDKValidationError>;
126
234
  /** @internal */
@@ -13,6 +13,131 @@ import { ProviderName$inboundSchema } from "./providername.js";
13
13
  import { Quantization$inboundSchema } from "./quantization.js";
14
14
  import { ToolChoiceSupport$inboundSchema, } from "./toolchoicesupport.js";
15
15
  /** @internal */
16
+ export const Embeddings$inboundSchema = z
17
+ .object({
18
+ latency: z.nullable(PercentileStats$inboundSchema),
19
+ request_count: z.nullable(z.int()),
20
+ throughput: z.nullable(PercentileStats$inboundSchema),
21
+ }).transform((v) => {
22
+ return remap$(v, {
23
+ "request_count": "requestCount",
24
+ });
25
+ });
26
+ export function embeddingsFromJSON(jsonString) {
27
+ return safeParse(jsonString, (x) => Embeddings$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Embeddings' from JSON`);
28
+ }
29
+ /** @internal */
30
+ export const ImageGeneration$inboundSchema = z.object({
31
+ latency: z.nullable(PercentileStats$inboundSchema),
32
+ request_count: z.nullable(z.int()),
33
+ throughput: z.nullable(PercentileStats$inboundSchema),
34
+ }).transform((v) => {
35
+ return remap$(v, {
36
+ "request_count": "requestCount",
37
+ });
38
+ });
39
+ export function imageGenerationFromJSON(jsonString) {
40
+ return safeParse(jsonString, (x) => ImageGeneration$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ImageGeneration' from JSON`);
41
+ }
42
+ /** @internal */
43
+ export const Rerank$inboundSchema = z.object({
44
+ latency: z.nullable(PercentileStats$inboundSchema),
45
+ request_count: z.nullable(z.int()),
46
+ throughput: z.nullable(PercentileStats$inboundSchema),
47
+ }).transform((v) => {
48
+ return remap$(v, {
49
+ "request_count": "requestCount",
50
+ });
51
+ });
52
+ export function rerankFromJSON(jsonString) {
53
+ return safeParse(jsonString, (x) => Rerank$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Rerank' from JSON`);
54
+ }
55
+ /** @internal */
56
+ export const STT$inboundSchema = z.object({
57
+ latency: z.nullable(PercentileStats$inboundSchema),
58
+ request_count: z.nullable(z.int()),
59
+ throughput: z.nullable(PercentileStats$inboundSchema),
60
+ }).transform((v) => {
61
+ return remap$(v, {
62
+ "request_count": "requestCount",
63
+ });
64
+ });
65
+ export function sttFromJSON(jsonString) {
66
+ return safeParse(jsonString, (x) => STT$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'STT' from JSON`);
67
+ }
68
+ /** @internal */
69
+ export const TextGeneration$inboundSchema = z.object({
70
+ latency: z.nullable(PercentileStats$inboundSchema),
71
+ request_count: z.nullable(z.int()),
72
+ throughput: z.nullable(PercentileStats$inboundSchema),
73
+ }).transform((v) => {
74
+ return remap$(v, {
75
+ "request_count": "requestCount",
76
+ });
77
+ });
78
+ export function textGenerationFromJSON(jsonString) {
79
+ return safeParse(jsonString, (x) => TextGeneration$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TextGeneration' from JSON`);
80
+ }
81
+ /** @internal */
82
+ export const TTS$inboundSchema = z.object({
83
+ latency: z.nullable(PercentileStats$inboundSchema),
84
+ request_count: z.nullable(z.int()),
85
+ throughput: z.nullable(PercentileStats$inboundSchema),
86
+ }).transform((v) => {
87
+ return remap$(v, {
88
+ "request_count": "requestCount",
89
+ });
90
+ });
91
+ export function ttsFromJSON(jsonString) {
92
+ return safeParse(jsonString, (x) => TTS$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TTS' from JSON`);
93
+ }
94
+ /** @internal */
95
+ export const Unknown$inboundSchema = z.object({
96
+ latency: z.nullable(PercentileStats$inboundSchema),
97
+ request_count: z.nullable(z.int()),
98
+ throughput: z.nullable(PercentileStats$inboundSchema),
99
+ }).transform((v) => {
100
+ return remap$(v, {
101
+ "request_count": "requestCount",
102
+ });
103
+ });
104
+ export function unknownFromJSON(jsonString) {
105
+ return safeParse(jsonString, (x) => Unknown$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Unknown' from JSON`);
106
+ }
107
+ /** @internal */
108
+ export const VideoGeneration$inboundSchema = z.object({
109
+ latency: z.nullable(PercentileStats$inboundSchema),
110
+ request_count: z.nullable(z.int()),
111
+ throughput: z.nullable(PercentileStats$inboundSchema),
112
+ }).transform((v) => {
113
+ return remap$(v, {
114
+ "request_count": "requestCount",
115
+ });
116
+ });
117
+ export function videoGenerationFromJSON(jsonString) {
118
+ return safeParse(jsonString, (x) => VideoGeneration$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'VideoGeneration' from JSON`);
119
+ }
120
+ /** @internal */
121
+ export const PerfLast30mByWorkload$inboundSchema = z.object({
122
+ embeddings: z.lazy(() => Embeddings$inboundSchema).optional(),
123
+ image_generation: z.lazy(() => ImageGeneration$inboundSchema).optional(),
124
+ rerank: z.lazy(() => Rerank$inboundSchema).optional(),
125
+ stt: z.lazy(() => STT$inboundSchema).optional(),
126
+ text_generation: z.lazy(() => TextGeneration$inboundSchema).optional(),
127
+ tts: z.lazy(() => TTS$inboundSchema).optional(),
128
+ unknown: z.lazy(() => Unknown$inboundSchema).optional(),
129
+ video_generation: z.lazy(() => VideoGeneration$inboundSchema).optional(),
130
+ }).transform((v) => {
131
+ return remap$(v, {
132
+ "image_generation": "imageGeneration",
133
+ "text_generation": "textGeneration",
134
+ "video_generation": "videoGeneration",
135
+ });
136
+ });
137
+ export function perfLast30mByWorkloadFromJSON(jsonString) {
138
+ return safeParse(jsonString, (x) => PerfLast30mByWorkload$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PerfLast30mByWorkload' from JSON`);
139
+ }
140
+ /** @internal */
16
141
  export const Pricing$inboundSchema = z.object({
17
142
  audio: z.string().optional(),
18
143
  audio_output: z.string().optional(),
@@ -55,6 +180,8 @@ export const PublicEndpoint$inboundSchema = z.object({
55
180
  model_id: z.string(),
56
181
  model_name: z.string(),
57
182
  name: z.string(),
183
+ perf_last_30m_by_workload: z.lazy(() => PerfLast30mByWorkload$inboundSchema)
184
+ .optional(),
58
185
  pricing: z.lazy(() => Pricing$inboundSchema),
59
186
  provider_name: ProviderName$inboundSchema,
60
187
  quantization: z.nullable(Quantization$inboundSchema),
@@ -76,6 +203,7 @@ export const PublicEndpoint$inboundSchema = z.object({
76
203
  "max_prompt_tokens": "maxPromptTokens",
77
204
  "model_id": "modelId",
78
205
  "model_name": "modelName",
206
+ "perf_last_30m_by_workload": "perfLast30mByWorkload",
79
207
  "provider_name": "providerName",
80
208
  "supported_parameters": "supportedParameters",
81
209
  "supports_implicit_caching": "supportsImplicitCaching",
@@ -24,7 +24,7 @@ export declare class Models extends ClientSDK {
24
24
  * List models filtered by user provider preferences, privacy settings, and guardrails
25
25
  *
26
26
  * @remarks
27
- * List models filtered by user provider preferences, [privacy settings](https://openrouter.ai/docs/guides/privacy/provider-logging), and [guardrails](https://openrouter.ai/docs/guides/features/guardrails). Returns text-output models by default; pass `output_modalities` (e.g. `image,audio,embeddings` or `all`) to include other modalities. If requesting through a regional hostname, the results will be filtered to models that satisfy in-region routing for that region.
27
+ * List models filtered by user provider preferences, [privacy settings](https://openrouter.ai/docs/guides/privacy/provider-logging), and [guardrails](https://openrouter.ai/docs/guides/features/guardrails). Returns text-output models by default; pass `output_modalities` (a comma-separated list of `text`, `image`, `embeddings`, `audio`, `video`, `rerank`, `speech`, `transcription`, or `all`) to include other modalities. If requesting through a regional hostname, the results will be filtered to models that satisfy in-region routing for that region.
28
28
  */
29
29
  listForUser(security: operations.ListModelsUserSecurity, request?: operations.ListModelsUserRequest | undefined, options?: RequestOptions): Promise<PageIterator<operations.ListModelsUserResponse, {
30
30
  offset: number;
package/esm/sdk/models.js CHANGED
@@ -35,7 +35,7 @@ export class Models extends ClientSDK {
35
35
  * List models filtered by user provider preferences, privacy settings, and guardrails
36
36
  *
37
37
  * @remarks
38
- * List models filtered by user provider preferences, [privacy settings](https://openrouter.ai/docs/guides/privacy/provider-logging), and [guardrails](https://openrouter.ai/docs/guides/features/guardrails). Returns text-output models by default; pass `output_modalities` (e.g. `image,audio,embeddings` or `all`) to include other modalities. If requesting through a regional hostname, the results will be filtered to models that satisfy in-region routing for that region.
38
+ * List models filtered by user provider preferences, [privacy settings](https://openrouter.ai/docs/guides/privacy/provider-logging), and [guardrails](https://openrouter.ai/docs/guides/features/guardrails). Returns text-output models by default; pass `output_modalities` (a comma-separated list of `text`, `image`, `embeddings`, `audio`, `video`, `rerank`, `speech`, `transcription`, or `all`) to include other modalities. If requesting through a regional hostname, the results will be filtered to models that satisfy in-region routing for that region.
39
39
  */
40
40
  async listForUser(security, request, options) {
41
41
  return unwrapResultIterator(modelsListForUser(this, security, request, options));
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "1.2.86",
5
+ "version": "1.2.88",
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.2.86",
3
+ "version": "1.2.88",
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",
75
75
  "prepublishOnly": "npm run build",
76
- "test": "vitest --run --project unit",
76
+ "prepare": "npm run build",
77
77
  "test:e2e": "vitest --run --project e2e",
78
+ "test:transit": "exit 0",
78
79
  "test:watch": "vitest --watch --project unit",
79
- "typecheck": "tsc --noEmit",
80
80
  "typecheck:transit": "exit 0",
81
+ "test": "vitest --run --project unit",
82
+ "typecheck": "tsc --noEmit",
81
83
  "compile": "tsc",
82
- "test:transit": "exit 0",
83
- "postinstall": "node scripts/check-types.js || true",
84
- "prepare": "npm run build"
84
+ "postinstall": "node scripts/check-types.js || true"
85
85
  },
86
86
  "peerDependencies": {},
87
87
  "devDependencies": {