@openrouter/sdk 1.2.99 → 1.2.100
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.
- package/esm/funcs/apiKeysCreate.d.ts +1 -1
- package/esm/funcs/apiKeysCreate.js +1 -1
- package/esm/funcs/apiKeysDelete.d.ts +1 -1
- package/esm/funcs/apiKeysDelete.js +1 -1
- package/esm/funcs/apiKeysUpdate.d.ts +1 -1
- package/esm/funcs/apiKeysUpdate.js +1 -1
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/operations/createkeys.d.ts +26 -0
- package/esm/models/operations/createkeys.js +14 -0
- package/esm/sdk/apikeys.d.ts +3 -3
- package/esm/sdk/apikeys.js +3 -3
- package/jsr.json +1 -1
- package/package.json +7 -7
|
@@ -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. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys)
|
|
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). The optional `external` object associates the key with a partner-defined user and lookup key.
|
|
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. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys)
|
|
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). The optional `external` object associates the key with a partner-defined user and lookup key.
|
|
20
20
|
*/
|
|
21
21
|
export function apiKeysCreate(client, request, options) {
|
|
22
22
|
return new APIPromise($do(client, request, options));
|
|
@@ -12,7 +12,7 @@ import { Result } from "../types/fp.js";
|
|
|
12
12
|
* Delete an API key
|
|
13
13
|
*
|
|
14
14
|
* @remarks
|
|
15
|
-
* Delete an existing API key. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys)
|
|
15
|
+
* Delete an existing API key. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys).
|
|
16
16
|
*/
|
|
17
17
|
export declare function apiKeysDelete(client: OpenRouterCore, request: operations.DeleteKeysRequest, options?: RequestOptions): APIPromise<Result<operations.DeleteKeysResponse, errors.UnauthorizedResponseError | errors.NotFoundResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
18
18
|
//# sourceMappingURL=apiKeysDelete.d.ts.map
|
|
@@ -16,7 +16,7 @@ import { APIPromise } from "../types/async.js";
|
|
|
16
16
|
* Delete an API key
|
|
17
17
|
*
|
|
18
18
|
* @remarks
|
|
19
|
-
* Delete an existing API key. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys)
|
|
19
|
+
* Delete an existing API key. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys).
|
|
20
20
|
*/
|
|
21
21
|
export function apiKeysDelete(client, request, options) {
|
|
22
22
|
return new APIPromise($do(client, request, options));
|
|
@@ -12,7 +12,7 @@ import { Result } from "../types/fp.js";
|
|
|
12
12
|
* Update an API key
|
|
13
13
|
*
|
|
14
14
|
* @remarks
|
|
15
|
-
* Update an existing API key. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys)
|
|
15
|
+
* Update an existing API key. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys).
|
|
16
16
|
*/
|
|
17
17
|
export declare function apiKeysUpdate(client: OpenRouterCore, request: operations.UpdateKeysRequest, options?: RequestOptions): APIPromise<Result<operations.UpdateKeysResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.NotFoundResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
18
18
|
//# sourceMappingURL=apiKeysUpdate.d.ts.map
|
|
@@ -16,7 +16,7 @@ import { APIPromise } from "../types/async.js";
|
|
|
16
16
|
* Update an API key
|
|
17
17
|
*
|
|
18
18
|
* @remarks
|
|
19
|
-
* Update an existing API key. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys)
|
|
19
|
+
* Update an existing API key. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys).
|
|
20
20
|
*/
|
|
21
21
|
export function apiKeysUpdate(client, request, options) {
|
|
22
22
|
return new APIPromise($do(client, request, options));
|
package/esm/lib/config.d.ts
CHANGED
|
@@ -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.
|
|
53
|
+
readonly sdkVersion: "1.2.100";
|
|
54
54
|
readonly genVersion: "2.914.0";
|
|
55
|
-
readonly userAgent: "speakeasy-sdk/typescript 1.2.
|
|
55
|
+
readonly userAgent: "speakeasy-sdk/typescript 1.2.100 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.
|
|
32
|
+
sdkVersion: "1.2.100",
|
|
33
33
|
genVersion: "2.914.0",
|
|
34
|
-
userAgent: "speakeasy-sdk/typescript 1.2.
|
|
34
|
+
userAgent: "speakeasy-sdk/typescript 1.2.100 2.914.0 1.0.0 @openrouter/sdk",
|
|
35
35
|
};
|
|
36
36
|
//# sourceMappingURL=config.js.map
|
|
@@ -23,6 +23,19 @@ export type CreateKeysGlobals = {
|
|
|
23
23
|
*/
|
|
24
24
|
appCategories?: string | undefined;
|
|
25
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* Optional partner-defined identity associated with the created API key.
|
|
28
|
+
*/
|
|
29
|
+
export type External = {
|
|
30
|
+
/**
|
|
31
|
+
* Optional partner-supplied API key with a minimum length of 32 characters and sufficient entropy. Stored as a SHA-256 hash and never returned.
|
|
32
|
+
*/
|
|
33
|
+
apiKey?: string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Partner's end-user identifier for attribution.
|
|
36
|
+
*/
|
|
37
|
+
user: string;
|
|
38
|
+
};
|
|
26
39
|
/**
|
|
27
40
|
* Type of limit reset for the API key (daily, weekly, monthly, or null for no reset). Resets happen automatically at midnight UTC, and weeks are Monday through Sunday.
|
|
28
41
|
*/
|
|
@@ -44,6 +57,10 @@ export type CreateKeysRequestBody = {
|
|
|
44
57
|
* Optional ISO 8601 UTC expiration timestamp. Must include seconds (YYYY-MM-DDTHH:MM:SSZ; fractional seconds allowed); minute-precision timestamps are rejected.
|
|
45
58
|
*/
|
|
46
59
|
expiresAt?: Date | null | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Optional partner-defined identity associated with the created API key.
|
|
62
|
+
*/
|
|
63
|
+
external?: External | undefined;
|
|
47
64
|
/**
|
|
48
65
|
* Whether to include BYOK usage in the limit
|
|
49
66
|
*/
|
|
@@ -194,11 +211,20 @@ export type CreateKeysResponse = {
|
|
|
194
211
|
key: string;
|
|
195
212
|
};
|
|
196
213
|
/** @internal */
|
|
214
|
+
export type External$Outbound = {
|
|
215
|
+
api_key?: string | undefined;
|
|
216
|
+
user: string;
|
|
217
|
+
};
|
|
218
|
+
/** @internal */
|
|
219
|
+
export declare const External$outboundSchema: z.ZodType<External$Outbound, External>;
|
|
220
|
+
export declare function externalToJSON(external: External): string;
|
|
221
|
+
/** @internal */
|
|
197
222
|
export declare const CreateKeysLimitReset$outboundSchema: z.ZodType<string, CreateKeysLimitReset>;
|
|
198
223
|
/** @internal */
|
|
199
224
|
export type CreateKeysRequestBody$Outbound = {
|
|
200
225
|
creator_user_id?: string | null | undefined;
|
|
201
226
|
expires_at?: string | null | undefined;
|
|
227
|
+
external?: External$Outbound | undefined;
|
|
202
228
|
include_byok_in_limit?: boolean | undefined;
|
|
203
229
|
limit?: number | null | undefined;
|
|
204
230
|
limit_reset?: string | null | undefined;
|
|
@@ -15,11 +15,25 @@ export const CreateKeysLimitReset = {
|
|
|
15
15
|
Monthly: "monthly",
|
|
16
16
|
};
|
|
17
17
|
/** @internal */
|
|
18
|
+
export const External$outboundSchema = z
|
|
19
|
+
.object({
|
|
20
|
+
apiKey: z.string().optional(),
|
|
21
|
+
user: z.string(),
|
|
22
|
+
}).transform((v) => {
|
|
23
|
+
return remap$(v, {
|
|
24
|
+
apiKey: "api_key",
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
export function externalToJSON(external) {
|
|
28
|
+
return JSON.stringify(External$outboundSchema.parse(external));
|
|
29
|
+
}
|
|
30
|
+
/** @internal */
|
|
18
31
|
export const CreateKeysLimitReset$outboundSchema = openEnums.outboundSchema(CreateKeysLimitReset);
|
|
19
32
|
/** @internal */
|
|
20
33
|
export const CreateKeysRequestBody$outboundSchema = z.object({
|
|
21
34
|
creatorUserId: z.nullable(z.string()).optional(),
|
|
22
35
|
expiresAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
|
|
36
|
+
external: z.lazy(() => External$outboundSchema).optional(),
|
|
23
37
|
includeByokInLimit: z.boolean().optional(),
|
|
24
38
|
limit: z.nullable(z.number()).optional(),
|
|
25
39
|
limitReset: z.nullable(CreateKeysLimitReset$outboundSchema).optional(),
|
package/esm/sdk/apikeys.d.ts
CHANGED
|
@@ -19,14 +19,14 @@ 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. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys)
|
|
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). The optional `external` object associates the key with a partner-defined user and lookup key.
|
|
23
23
|
*/
|
|
24
24
|
create(request: operations.CreateKeysRequest, options?: RequestOptions): Promise<operations.CreateKeysResponse>;
|
|
25
25
|
/**
|
|
26
26
|
* Delete an API key
|
|
27
27
|
*
|
|
28
28
|
* @remarks
|
|
29
|
-
* Delete an existing API key. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys)
|
|
29
|
+
* Delete an existing API key. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys).
|
|
30
30
|
*/
|
|
31
31
|
delete(request: operations.DeleteKeysRequest, options?: RequestOptions): Promise<operations.DeleteKeysResponse>;
|
|
32
32
|
/**
|
|
@@ -40,7 +40,7 @@ export declare class APIKeys extends ClientSDK {
|
|
|
40
40
|
* Update an API key
|
|
41
41
|
*
|
|
42
42
|
* @remarks
|
|
43
|
-
* Update an existing API key. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys)
|
|
43
|
+
* Update an existing API key. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys).
|
|
44
44
|
*/
|
|
45
45
|
update(request: operations.UpdateKeysRequest, options?: RequestOptions): Promise<operations.UpdateKeysResponse>;
|
|
46
46
|
}
|
package/esm/sdk/apikeys.js
CHANGED
|
@@ -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. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys)
|
|
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). The optional `external` object associates the key with a partner-defined user and lookup key.
|
|
37
37
|
*/
|
|
38
38
|
async create(request, options) {
|
|
39
39
|
return unwrapAsync(apiKeysCreate(this, request, options));
|
|
@@ -42,7 +42,7 @@ export class APIKeys extends ClientSDK {
|
|
|
42
42
|
* Delete an API key
|
|
43
43
|
*
|
|
44
44
|
* @remarks
|
|
45
|
-
* Delete an existing API key. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys)
|
|
45
|
+
* Delete an existing API key. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys).
|
|
46
46
|
*/
|
|
47
47
|
async delete(request, options) {
|
|
48
48
|
return unwrapAsync(apiKeysDelete(this, request, options));
|
|
@@ -60,7 +60,7 @@ export class APIKeys extends ClientSDK {
|
|
|
60
60
|
* Update an API key
|
|
61
61
|
*
|
|
62
62
|
* @remarks
|
|
63
|
-
* Update an existing API key. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys)
|
|
63
|
+
* Update an existing API key. Authenticate with a [management key](/docs/guides/overview/auth/management-api-keys).
|
|
64
64
|
*/
|
|
65
65
|
async update(request, options) {
|
|
66
66
|
return unwrapAsync(apiKeysUpdate(this, request, options));
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.100",
|
|
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
|
-
"
|
|
76
|
+
"prepare": "npm run build",
|
|
77
|
+
"test": "vitest --run --project unit",
|
|
77
78
|
"typecheck": "tsc --noEmit",
|
|
78
|
-
"test:transit": "exit 0",
|
|
79
79
|
"typecheck:transit": "exit 0",
|
|
80
80
|
"compile": "tsc",
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"test": "vitest --
|
|
84
|
-
"
|
|
81
|
+
"test:e2e": "vitest --run --project e2e",
|
|
82
|
+
"test:transit": "exit 0",
|
|
83
|
+
"test:watch": "vitest --watch --project unit",
|
|
84
|
+
"postinstall": "node scripts/check-types.js || true"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {},
|
|
87
87
|
"devDependencies": {
|