@openrouter/sdk 1.2.57 → 1.2.60

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.
@@ -12,7 +12,7 @@ import { Result } from "../types/fp.js";
12
12
  * Create a new API key
13
13
  *
14
14
  * @remarks
15
- * Create a new API key for the authenticated user. The plaintext `key` is returned only in this response. Treat it as a write-only, sensitive value; it cannot be retrieved later. [Management key](/docs/guides/overview/auth/management-api-keys) required.
15
+ * Create a new API key for the authenticated user. The plaintext `key` is returned only in this response. Treat it as a write-only, sensitive value; it cannot be retrieved later. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys), or with a Connect client secret. `external_user` and `external_api_key` are accepted only with a client secret, and `external_user` is required there; supplying either field with a management key is rejected with 403.
16
16
  */
17
17
  export declare function apiKeysCreate(client: OpenRouterCore, request: operations.CreateKeysRequest, options?: RequestOptions): APIPromise<Result<operations.CreateKeysResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
18
18
  //# sourceMappingURL=apiKeysCreate.d.ts.map
@@ -16,7 +16,7 @@ import { APIPromise } from "../types/async.js";
16
16
  * Create a new API key
17
17
  *
18
18
  * @remarks
19
- * Create a new API key for the authenticated user. The plaintext `key` is returned only in this response. Treat it as a write-only, sensitive value; it cannot be retrieved later. [Management key](/docs/guides/overview/auth/management-api-keys) required.
19
+ * Create a new API key for the authenticated user. The plaintext `key` is returned only in this response. Treat it as a write-only, sensitive value; it cannot be retrieved later. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys), or with a Connect client secret. `external_user` and `external_api_key` are accepted only with a client secret, and `external_user` is required there; supplying either field with a management key is rejected with 403.
20
20
  */
21
21
  export function apiKeysCreate(client, request, options) {
22
22
  return new APIPromise($do(client, 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.57";
53
+ readonly sdkVersion: "1.2.60";
54
54
  readonly genVersion: "2.914.0";
55
- readonly userAgent: "speakeasy-sdk/typescript 1.2.57 2.914.0 1.0.0 @openrouter/sdk";
55
+ readonly userAgent: "speakeasy-sdk/typescript 1.2.60 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.57",
32
+ sdkVersion: "1.2.60",
33
33
  genVersion: "2.914.0",
34
- userAgent: "speakeasy-sdk/typescript 1.2.57 2.914.0 1.0.0 @openrouter/sdk",
34
+ userAgent: "speakeasy-sdk/typescript 1.2.60 2.914.0 1.0.0 @openrouter/sdk",
35
35
  };
36
36
  //# sourceMappingURL=config.js.map
@@ -18,7 +18,7 @@ export type ObservabilityDatadogDestinationConfig = {
18
18
  */
19
19
  mlApp: string;
20
20
  /**
21
- * Datadog API URL for your region (e.g., https://api.datadoghq.com, https://api.us3.datadoghq.com, https://api.datadoghq.eu)
21
+ * Datadog API URL for your region (e.g., https://api.datadoghq.com, https://api.us3.datadoghq.com, https://api.us5.datadoghq.com, https://api.datadoghq.eu)
22
22
  */
23
23
  url: string;
24
24
  };
@@ -11,7 +11,7 @@ export const ObservabilityDatadogDestinationConfig$inboundSchema = z.object({
11
11
  apiKey: z.string(),
12
12
  headers: z.record(z.string(), z.string()).optional(),
13
13
  mlApp: z.string(),
14
- url: z.string().default("https://api.us5.datadoghq.com"),
14
+ url: z.string().default("https://api.datadoghq.com"),
15
15
  });
16
16
  export function observabilityDatadogDestinationConfigFromJSON(jsonString) {
17
17
  return safeParse(jsonString, (x) => ObservabilityDatadogDestinationConfig$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ObservabilityDatadogDestinationConfig' from JSON`);
@@ -45,9 +45,13 @@ export type CreateKeysRequestBody = {
45
45
  */
46
46
  expiresAt?: Date | null | undefined;
47
47
  /**
48
- * Optional partner-supplied API key. Stored as a SHA-256 hash and never returned. Accepted only when authenticating with a Connect client secret.
48
+ * Optional partner-supplied API key. Stored as a SHA-256 hash and never returned. Accepted only when authenticating with a Connect client secret; supplying it with a management key is rejected with 403.
49
49
  */
50
50
  externalApiKey?: string | undefined;
51
+ /**
52
+ * Partner's end-user identifier for attribution, between 1 and 512 characters. Accepted only when authenticating with a Connect client secret, where it is required; supplying it with a management key is rejected with 403.
53
+ */
54
+ externalUser?: string | undefined;
51
55
  /**
52
56
  * Whether to include BYOK usage in the limit
53
57
  */
@@ -127,6 +131,10 @@ export type CreateKeysData = {
127
131
  * ISO 8601 UTC timestamp when the API key expires, or null if no expiration
128
132
  */
129
133
  expiresAt?: Date | null | undefined;
134
+ /**
135
+ * Partner's end-user identifier used for attribution.
136
+ */
137
+ externalUser: string | null;
130
138
  /**
131
139
  * Unique hash identifier for the API key
132
140
  */
@@ -200,6 +208,7 @@ export type CreateKeysRequestBody$Outbound = {
200
208
  creator_user_id?: string | null | undefined;
201
209
  expires_at?: string | null | undefined;
202
210
  external_api_key?: string | undefined;
211
+ external_user?: string | undefined;
203
212
  include_byok_in_limit?: boolean | undefined;
204
213
  limit?: number | null | undefined;
205
214
  limit_reset?: string | null | undefined;
@@ -21,6 +21,7 @@ export const CreateKeysRequestBody$outboundSchema = z.object({
21
21
  creatorUserId: z.nullable(z.string()).optional(),
22
22
  expiresAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
23
23
  externalApiKey: z.string().optional(),
24
+ externalUser: z.string().optional(),
24
25
  includeByokInLimit: z.boolean().optional(),
25
26
  limit: z.nullable(z.number()).optional(),
26
27
  limitReset: z.nullable(CreateKeysLimitReset$outboundSchema).optional(),
@@ -31,6 +32,7 @@ export const CreateKeysRequestBody$outboundSchema = z.object({
31
32
  creatorUserId: "creator_user_id",
32
33
  expiresAt: "expires_at",
33
34
  externalApiKey: "external_api_key",
35
+ externalUser: "external_user",
34
36
  includeByokInLimit: "include_byok_in_limit",
35
37
  limitReset: "limit_reset",
36
38
  workspaceId: "workspace_id",
@@ -64,6 +66,7 @@ export const CreateKeysData$inboundSchema = z.object({
64
66
  creator_user_id: z.nullable(z.string()),
65
67
  disabled: z.boolean(),
66
68
  expires_at: z.nullable(z.iso.datetime({ offset: true }).transform(v => new Date(v))).optional(),
69
+ external_user: z.nullable(z.string()),
67
70
  hash: z.string(),
68
71
  include_byok_in_limit: z.boolean(),
69
72
  label: z.string(),
@@ -86,6 +89,7 @@ export const CreateKeysData$inboundSchema = z.object({
86
89
  "created_at": "createdAt",
87
90
  "creator_user_id": "creatorUserId",
88
91
  "expires_at": "expiresAt",
92
+ "external_user": "externalUser",
89
93
  "include_byok_in_limit": "includeByokInLimit",
90
94
  "limit_remaining": "limitRemaining",
91
95
  "limit_reset": "limitReset",
@@ -83,6 +83,10 @@ export type GetKeyData = {
83
83
  * ISO 8601 UTC timestamp when the API key expires, or null if no expiration
84
84
  */
85
85
  expiresAt?: Date | null | undefined;
86
+ /**
87
+ * Partner's end-user identifier used for attribution.
88
+ */
89
+ externalUser: string | null;
86
90
  /**
87
91
  * Unique hash identifier for the API key
88
92
  */
@@ -30,6 +30,7 @@ export const GetKeyData$inboundSchema = z
30
30
  creator_user_id: z.nullable(z.string()),
31
31
  disabled: z.boolean(),
32
32
  expires_at: z.nullable(z.iso.datetime({ offset: true }).transform(v => new Date(v))).optional(),
33
+ external_user: z.nullable(z.string()),
33
34
  hash: z.string(),
34
35
  include_byok_in_limit: z.boolean(),
35
36
  label: z.string(),
@@ -52,6 +53,7 @@ export const GetKeyData$inboundSchema = z
52
53
  "created_at": "createdAt",
53
54
  "creator_user_id": "creatorUserId",
54
55
  "expires_at": "expiresAt",
56
+ "external_user": "externalUser",
55
57
  "include_byok_in_limit": "includeByokInLimit",
56
58
  "limit_remaining": "limitRemaining",
57
59
  "limit_reset": "limitReset",
@@ -88,6 +88,10 @@ export type ListData = {
88
88
  * ISO 8601 UTC timestamp when the API key expires, or null if no expiration
89
89
  */
90
90
  expiresAt?: Date | null | undefined;
91
+ /**
92
+ * Partner's end-user identifier used for attribution.
93
+ */
94
+ externalUser: string | null;
91
95
  /**
92
96
  * Unique hash identifier for the API key
93
97
  */
@@ -33,6 +33,7 @@ export const ListData$inboundSchema = z.object({
33
33
  creator_user_id: z.nullable(z.string()),
34
34
  disabled: z.boolean(),
35
35
  expires_at: z.nullable(z.iso.datetime({ offset: true }).transform(v => new Date(v))).optional(),
36
+ external_user: z.nullable(z.string()),
36
37
  hash: z.string(),
37
38
  include_byok_in_limit: z.boolean(),
38
39
  label: z.string(),
@@ -55,6 +56,7 @@ export const ListData$inboundSchema = z.object({
55
56
  "created_at": "createdAt",
56
57
  "creator_user_id": "creatorUserId",
57
58
  "expires_at": "expiresAt",
59
+ "external_user": "externalUser",
58
60
  "include_byok_in_limit": "includeByokInLimit",
59
61
  "limit_remaining": "limitRemaining",
60
62
  "limit_reset": "limitReset",
@@ -119,6 +119,10 @@ export type UpdateKeysData = {
119
119
  * ISO 8601 UTC timestamp when the API key expires, or null if no expiration
120
120
  */
121
121
  expiresAt?: Date | null | undefined;
122
+ /**
123
+ * Partner's end-user identifier used for attribution.
124
+ */
125
+ externalUser: string | null;
122
126
  /**
123
127
  * Unique hash identifier for the API key
124
128
  */
@@ -58,6 +58,7 @@ export const UpdateKeysData$inboundSchema = z.object({
58
58
  creator_user_id: z.nullable(z.string()),
59
59
  disabled: z.boolean(),
60
60
  expires_at: z.nullable(z.iso.datetime({ offset: true }).transform(v => new Date(v))).optional(),
61
+ external_user: z.nullable(z.string()),
61
62
  hash: z.string(),
62
63
  include_byok_in_limit: z.boolean(),
63
64
  label: z.string(),
@@ -80,6 +81,7 @@ export const UpdateKeysData$inboundSchema = z.object({
80
81
  "created_at": "createdAt",
81
82
  "creator_user_id": "creatorUserId",
82
83
  "expires_at": "expiresAt",
84
+ "external_user": "externalUser",
83
85
  "include_byok_in_limit": "includeByokInLimit",
84
86
  "limit_remaining": "limitRemaining",
85
87
  "limit_reset": "limitReset",
@@ -1,6 +1,17 @@
1
1
  import * as z from "zod/v4";
2
+ import { OpenEnum } from "../types/enums.js";
2
3
  import { Result as SafeParseResult } from "../types/fp.js";
3
4
  import { SDKValidationError } from "./errors/sdkvalidationerror.js";
5
+ export declare const UtcDay: {
6
+ readonly Monday: "monday";
7
+ readonly Tuesday: "tuesday";
8
+ readonly Wednesday: "wednesday";
9
+ readonly Thursday: "thursday";
10
+ readonly Friday: "friday";
11
+ readonly Saturday: "saturday";
12
+ readonly Sunday: "sunday";
13
+ };
14
+ export type UtcDay = OpenEnum<typeof UtcDay>;
4
15
  /**
5
16
  * A conditional override of the base pricing. An entry applies only when all of its condition fields (e.g. min_prompt_tokens, or the utc_start/utc_end time window) match the request; among applicable entries, later entries win per price key; price keys absent from an entry inherit the base price.
6
17
  */
@@ -37,6 +48,10 @@ export type PricingOverride = {
37
48
  * Overridden price in USD per token for prompt (input) processing
38
49
  */
39
50
  prompt?: string | undefined;
51
+ /**
52
+ * Condition: UTC weekdays the entry applies on, evaluated at the request instant. Scopes the utc_start/utc_end window (or, without a window, the whole UTC day) to the listed days. Absent means every day.
53
+ */
54
+ utcDays?: Array<UtcDay> | undefined;
40
55
  /**
41
56
  * Condition: exclusive end of a daily UTC time window as an HHMM clock number (e.g. 400 = 04:00)
42
57
  */
@@ -47,6 +62,8 @@ export type PricingOverride = {
47
62
  utcStart?: number | undefined;
48
63
  };
49
64
  /** @internal */
65
+ export declare const UtcDay$inboundSchema: z.ZodType<UtcDay, unknown>;
66
+ /** @internal */
50
67
  export declare const PricingOverride$inboundSchema: z.ZodType<PricingOverride, unknown>;
51
68
  export declare function pricingOverrideFromJSON(jsonString: string): SafeParseResult<PricingOverride, SDKValidationError>;
52
69
  //# sourceMappingURL=pricingoverride.d.ts.map
@@ -5,6 +5,19 @@
5
5
  import * as z from "zod/v4";
6
6
  import { remap as remap$ } from "../lib/primitives.js";
7
7
  import { safeParse } from "../lib/schemas.js";
8
+ import * as openEnums from "../types/enums.js";
9
+ export const UtcDay = {
10
+ Monday: "monday",
11
+ Tuesday: "tuesday",
12
+ Wednesday: "wednesday",
13
+ Thursday: "thursday",
14
+ Friday: "friday",
15
+ Saturday: "saturday",
16
+ Sunday: "sunday",
17
+ };
18
+ /** @internal */
19
+ export const UtcDay$inboundSchema = openEnums
20
+ .inboundSchema(UtcDay);
8
21
  /** @internal */
9
22
  export const PricingOverride$inboundSchema = z.object({
10
23
  audio: z.string().optional(),
@@ -15,6 +28,7 @@ export const PricingOverride$inboundSchema = z.object({
15
28
  input_cache_write_1h: z.string().optional(),
16
29
  min_prompt_tokens: z.number().optional(),
17
30
  prompt: z.string().optional(),
31
+ utc_days: z.array(UtcDay$inboundSchema).optional(),
18
32
  utc_end: z.number().optional(),
19
33
  utc_start: z.number().optional(),
20
34
  }).transform((v) => {
@@ -24,6 +38,7 @@ export const PricingOverride$inboundSchema = z.object({
24
38
  "input_cache_write": "inputCacheWrite",
25
39
  "input_cache_write_1h": "inputCacheWrite1h",
26
40
  "min_prompt_tokens": "minPromptTokens",
41
+ "utc_days": "utcDays",
27
42
  "utc_end": "utcEnd",
28
43
  "utc_start": "utcStart",
29
44
  });
@@ -19,7 +19,7 @@ export declare class APIKeys extends ClientSDK {
19
19
  * Create a new API key
20
20
  *
21
21
  * @remarks
22
- * Create a new API key for the authenticated user. The plaintext `key` is returned only in this response. Treat it as a write-only, sensitive value; it cannot be retrieved later. [Management key](/docs/guides/overview/auth/management-api-keys) required.
22
+ * Create a new API key for the authenticated user. The plaintext `key` is returned only in this response. Treat it as a write-only, sensitive value; it cannot be retrieved later. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys), or with a Connect client secret. `external_user` and `external_api_key` are accepted only with a client secret, and `external_user` is required there; supplying either field with a management key is rejected with 403.
23
23
  */
24
24
  create(request: operations.CreateKeysRequest, options?: RequestOptions): Promise<operations.CreateKeysResponse>;
25
25
  /**
@@ -33,7 +33,7 @@ export class APIKeys extends ClientSDK {
33
33
  * Create a new API key
34
34
  *
35
35
  * @remarks
36
- * Create a new API key for the authenticated user. The plaintext `key` is returned only in this response. Treat it as a write-only, sensitive value; it cannot be retrieved later. [Management key](/docs/guides/overview/auth/management-api-keys) required.
36
+ * Create a new API key for the authenticated user. The plaintext `key` is returned only in this response. Treat it as a write-only, sensitive value; it cannot be retrieved later. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys), or with a Connect client secret. `external_user` and `external_api_key` are accepted only with a client secret, and `external_user` is required there; supplying either field with a management key is rejected with 403.
37
37
  */
38
38
  async create(request, options) {
39
39
  return unwrapAsync(apiKeysCreate(this, request, options));
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@openrouter/sdk",
5
- "version": "1.2.57",
5
+ "version": "1.2.60",
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.57",
3
+ "version": "1.2.60",
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:watch": "vitest --watch --project unit",
77
- "typecheck": "tsc --noEmit",
78
- "prepare": "npm run build",
79
- "test": "vitest --run --project unit",
80
- "test:transit": "exit 0",
81
76
  "typecheck:transit": "exit 0",
82
77
  "compile": "tsc",
78
+ "test": "vitest --run --project unit",
79
+ "test:e2e": "vitest --run --project e2e",
80
+ "typecheck": "tsc --noEmit",
83
81
  "postinstall": "node scripts/check-types.js || true",
84
- "test:e2e": "vitest --run --project e2e"
82
+ "prepare": "npm run build",
83
+ "test:transit": "exit 0",
84
+ "test:watch": "vitest --watch --project unit"
85
85
  },
86
86
  "peerDependencies": {},
87
87
  "devDependencies": {