@openrouter/sdk 0.13.40 → 0.13.41

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.
@@ -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.13.40";
52
+ readonly sdkVersion: "0.13.41";
53
53
  readonly genVersion: "2.884.4";
54
- readonly userAgent: "speakeasy-sdk/typescript 0.13.40 2.884.4 1.0.0 @openrouter/sdk";
54
+ readonly userAgent: "speakeasy-sdk/typescript 0.13.41 2.884.4 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.13.40",
29
+ sdkVersion: "0.13.41",
30
30
  genVersion: "2.884.4",
31
- userAgent: "speakeasy-sdk/typescript 0.13.40 2.884.4 1.0.0 @openrouter/sdk",
31
+ userAgent: "speakeasy-sdk/typescript 0.13.41 2.884.4 1.0.0 @openrouter/sdk",
32
32
  };
33
33
  //# sourceMappingURL=config.js.map
@@ -23,6 +23,49 @@ export type QueryAnalyticsGlobals = {
23
23
  */
24
24
  appCategories?: string | undefined;
25
25
  };
26
+ /**
27
+ * Group results by custom classifier tags, breaking down metrics by the specified dimension values. Requires an active classifier on the workspace.
28
+ */
29
+ export type ClassifierDimensions = {
30
+ /**
31
+ * UUID of the classifier whose tags to group by.
32
+ */
33
+ classifierId: string;
34
+ dimensionNames?: Array<string> | undefined;
35
+ /**
36
+ * When true, also include generations that have no tag from this classifier. Defaults to false, which returns only classified generations.
37
+ */
38
+ includeNulls?: boolean | undefined;
39
+ };
40
+ export type ValueClassifierFilters = string | number;
41
+ /**
42
+ * Filter value. Use a scalar (string or number) for eq/neq, or an array for in/not_in.
43
+ */
44
+ export type ClassifierFiltersValue = string | number | Array<string | number>;
45
+ export type ClassifierFiltersFilter = {
46
+ /**
47
+ * Classifier dimension name to filter on (snake_case identifier, e.g. "department", "work_type").
48
+ */
49
+ field: string;
50
+ /**
51
+ * Filter operator. Only equality/set operators are supported (eq, neq, in, not_in) — ordered comparisons are not available because classification values are strings.
52
+ */
53
+ operator: string;
54
+ /**
55
+ * Filter value. Use a scalar (string or number) for eq/neq, or an array for in/not_in.
56
+ */
57
+ value: string | number | Array<string | number>;
58
+ };
59
+ /**
60
+ * Filter results to generations with specific classifier tag values. Can be combined with classifier_dimensions (must use the same classifier_id) or used independently with standard dimensions.
61
+ */
62
+ export type ClassifierFilters = {
63
+ /**
64
+ * UUID of the classifier whose tags to filter by. Must match classifier_dimensions.classifier_id when both are specified.
65
+ */
66
+ classifierId: string;
67
+ filters: Array<ClassifierFiltersFilter>;
68
+ };
26
69
  export type Value2 = string | number;
27
70
  /**
28
71
  * Filter value (scalar or array depending on operator). Several dimensions are enriched in responses (returned as human-readable labels), but filters must use the underlying ID: `api_key_id` — numeric ID (from generation metadata) or key hash (64-char hex from GET /api/v1/keys, resolved server-side); `user` — Clerk user ID (e.g. "user_abc123"), not the display name; `workspace` — workspace UUID, not the workspace name; `app` — numeric app ID, not the app title; `model` — permaslug (e.g. "openai/gpt-4o"), not the display name. Other dimensions (provider, origin, country, etc.) are not enriched and accept the value as returned.
@@ -59,6 +102,14 @@ export type TimeRange = {
59
102
  start: Date;
60
103
  };
61
104
  export type QueryAnalyticsRequestBody = {
105
+ /**
106
+ * Group results by custom classifier tags, breaking down metrics by the specified dimension values. Requires an active classifier on the workspace.
107
+ */
108
+ classifierDimensions?: ClassifierDimensions | undefined;
109
+ /**
110
+ * Filter results to generations with specific classifier tag values. Can be combined with classifier_dimensions (must use the same classifier_id) or used independently with standard dimensions.
111
+ */
112
+ classifierFilters?: ClassifierFilters | undefined;
62
113
  dimensions?: Array<string> | undefined;
63
114
  filters?: Array<Filter> | undefined;
64
115
  /**
@@ -124,6 +175,42 @@ export type QueryAnalyticsResponse = {
124
175
  data: QueryAnalyticsData2;
125
176
  };
126
177
  /** @internal */
178
+ export type ClassifierDimensions$Outbound = {
179
+ classifier_id: string;
180
+ dimension_names?: Array<string> | undefined;
181
+ include_nulls?: boolean | undefined;
182
+ };
183
+ /** @internal */
184
+ export declare const ClassifierDimensions$outboundSchema: z.ZodType<ClassifierDimensions$Outbound, ClassifierDimensions>;
185
+ export declare function classifierDimensionsToJSON(classifierDimensions: ClassifierDimensions): string;
186
+ /** @internal */
187
+ export type ValueClassifierFilters$Outbound = string | number;
188
+ /** @internal */
189
+ export declare const ValueClassifierFilters$outboundSchema: z.ZodType<ValueClassifierFilters$Outbound, ValueClassifierFilters>;
190
+ export declare function valueClassifierFiltersToJSON(valueClassifierFilters: ValueClassifierFilters): string;
191
+ /** @internal */
192
+ export type ClassifierFiltersValue$Outbound = string | number | Array<string | number>;
193
+ /** @internal */
194
+ export declare const ClassifierFiltersValue$outboundSchema: z.ZodType<ClassifierFiltersValue$Outbound, ClassifierFiltersValue>;
195
+ export declare function classifierFiltersValueToJSON(classifierFiltersValue: ClassifierFiltersValue): string;
196
+ /** @internal */
197
+ export type ClassifierFiltersFilter$Outbound = {
198
+ field: string;
199
+ operator: string;
200
+ value: string | number | Array<string | number>;
201
+ };
202
+ /** @internal */
203
+ export declare const ClassifierFiltersFilter$outboundSchema: z.ZodType<ClassifierFiltersFilter$Outbound, ClassifierFiltersFilter>;
204
+ export declare function classifierFiltersFilterToJSON(classifierFiltersFilter: ClassifierFiltersFilter): string;
205
+ /** @internal */
206
+ export type ClassifierFilters$Outbound = {
207
+ classifier_id: string;
208
+ filters: Array<ClassifierFiltersFilter$Outbound>;
209
+ };
210
+ /** @internal */
211
+ export declare const ClassifierFilters$outboundSchema: z.ZodType<ClassifierFilters$Outbound, ClassifierFilters>;
212
+ export declare function classifierFiltersToJSON(classifierFilters: ClassifierFilters): string;
213
+ /** @internal */
127
214
  export type Value2$Outbound = string | number;
128
215
  /** @internal */
129
216
  export declare const Value2$outboundSchema: z.ZodType<Value2$Outbound, Value2>;
@@ -162,6 +249,8 @@ export declare const TimeRange$outboundSchema: z.ZodType<TimeRange$Outbound, Tim
162
249
  export declare function timeRangeToJSON(timeRange: TimeRange): string;
163
250
  /** @internal */
164
251
  export type QueryAnalyticsRequestBody$Outbound = {
252
+ classifier_dimensions?: ClassifierDimensions$Outbound | undefined;
253
+ classifier_filters?: ClassifierFilters$Outbound | undefined;
165
254
  dimensions?: Array<string> | undefined;
166
255
  filters?: Array<Filter$Outbound> | undefined;
167
256
  granularity?: string | undefined;
@@ -11,6 +11,60 @@ export const Direction = {
11
11
  Desc: "desc",
12
12
  };
13
13
  /** @internal */
14
+ export const ClassifierDimensions$outboundSchema = z.object({
15
+ classifierId: z.string(),
16
+ dimensionNames: z.array(z.string()).optional(),
17
+ includeNulls: z.boolean().optional(),
18
+ }).transform((v) => {
19
+ return remap$(v, {
20
+ classifierId: "classifier_id",
21
+ dimensionNames: "dimension_names",
22
+ includeNulls: "include_nulls",
23
+ });
24
+ });
25
+ export function classifierDimensionsToJSON(classifierDimensions) {
26
+ return JSON.stringify(ClassifierDimensions$outboundSchema.parse(classifierDimensions));
27
+ }
28
+ /** @internal */
29
+ export const ValueClassifierFilters$outboundSchema = z.union([z.string(), z.number()]);
30
+ export function valueClassifierFiltersToJSON(valueClassifierFilters) {
31
+ return JSON.stringify(ValueClassifierFilters$outboundSchema.parse(valueClassifierFilters));
32
+ }
33
+ /** @internal */
34
+ export const ClassifierFiltersValue$outboundSchema = z.union([
35
+ z.string(),
36
+ z.number(),
37
+ z.array(z.union([z.string(), z.number()])),
38
+ ]);
39
+ export function classifierFiltersValueToJSON(classifierFiltersValue) {
40
+ return JSON.stringify(ClassifierFiltersValue$outboundSchema.parse(classifierFiltersValue));
41
+ }
42
+ /** @internal */
43
+ export const ClassifierFiltersFilter$outboundSchema = z.object({
44
+ field: z.string(),
45
+ operator: z.string(),
46
+ value: z.union([
47
+ z.string(),
48
+ z.number(),
49
+ z.array(z.union([z.string(), z.number()])),
50
+ ]),
51
+ });
52
+ export function classifierFiltersFilterToJSON(classifierFiltersFilter) {
53
+ return JSON.stringify(ClassifierFiltersFilter$outboundSchema.parse(classifierFiltersFilter));
54
+ }
55
+ /** @internal */
56
+ export const ClassifierFilters$outboundSchema = z.object({
57
+ classifierId: z.string(),
58
+ filters: z.array(z.lazy(() => ClassifierFiltersFilter$outboundSchema)),
59
+ }).transform((v) => {
60
+ return remap$(v, {
61
+ classifierId: "classifier_id",
62
+ });
63
+ });
64
+ export function classifierFiltersToJSON(classifierFilters) {
65
+ return JSON.stringify(ClassifierFilters$outboundSchema.parse(classifierFilters));
66
+ }
67
+ /** @internal */
14
68
  export const Value2$outboundSchema = z
15
69
  .union([z.string(), z.number()]);
16
70
  export function value2ToJSON(value2) {
@@ -58,6 +112,9 @@ export function timeRangeToJSON(timeRange) {
58
112
  }
59
113
  /** @internal */
60
114
  export const QueryAnalyticsRequestBody$outboundSchema = z.object({
115
+ classifierDimensions: z.lazy(() => ClassifierDimensions$outboundSchema)
116
+ .optional(),
117
+ classifierFilters: z.lazy(() => ClassifierFilters$outboundSchema).optional(),
61
118
  dimensions: z.array(z.string()).optional(),
62
119
  filters: z.array(z.lazy(() => Filter$outboundSchema)).optional(),
63
120
  granularity: z.string().optional(),
@@ -68,6 +125,8 @@ export const QueryAnalyticsRequestBody$outboundSchema = z.object({
68
125
  timeRange: z.lazy(() => TimeRange$outboundSchema).optional(),
69
126
  }).transform((v) => {
70
127
  return remap$(v, {
128
+ classifierDimensions: "classifier_dimensions",
129
+ classifierFilters: "classifier_filters",
71
130
  groupLimit: "group_limit",
72
131
  orderBy: "order_by",
73
132
  timeRange: "time_range",
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "0.13.40",
5
+ "version": "0.13.41",
6
6
  "exports": {
7
7
  ".": "./src/index.ts",
8
8
  "./models/errors": "./src/models/errors/index.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openrouter/sdk",
3
- "version": "0.13.40",
3
+ "version": "0.13.41",
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
- "postinstall": "node scripts/check-types.js || true",
77
76
  "prepare": "npm run build",
78
- "test": "vitest --run --project unit",
79
77
  "test:e2e": "vitest --run --project e2e",
80
78
  "test:transit": "exit 0",
81
- "typecheck": "tsc --noEmit",
82
79
  "typecheck:transit": "exit 0",
83
80
  "compile": "tsc",
84
- "test:watch": "vitest --watch --project unit"
81
+ "postinstall": "node scripts/check-types.js || true",
82
+ "test": "vitest --run --project unit",
83
+ "test:watch": "vitest --watch --project unit",
84
+ "typecheck": "tsc --noEmit"
85
85
  },
86
86
  "peerDependencies": {},
87
87
  "devDependencies": {