GetCurrentKeyData - TypeScript SDK

GetCurrentKeyData type definition

The TypeScript SDK and docs are currently in beta. Report issues on GitHub.

Current API key information

Example Usage

1import { GetCurrentKeyData } from "@openrouter/sdk/models/operations";
2
3let value: GetCurrentKeyData = {
4 label: "sk-or-v1-au7...890",
5 limit: 100,
6 usage: 25.5,
7 usageDaily: 25.5,
8 usageWeekly: 25.5,
9 usageMonthly: 25.5,
10 byokUsage: 17.38,
11 byokUsageDaily: 17.38,
12 byokUsageWeekly: 17.38,
13 byokUsageMonthly: 17.38,
14 isFreeTier: false,
15 isManagementKey: false,
16 isProvisioningKey: false,
17 limitRemaining: 74.5,
18 limitReset: "monthly",
19 includeByokInLimit: false,
20 creatorUserId: "user_2dHFtVWx2n56w6HkM0000000000",
21 rateLimit: {
22 requests: 1000,
23 interval: "1h",
24 note: "This field is deprecated and safe to ignore.",
25 },
26};

Fields

FieldTypeRequiredDescriptionExample
labelstring✔️Human-readable label for the API keysk-or-v1-0e6…1c96
limitnumber✔️Spending limit for the API key in USD100
usagenumber✔️Total OpenRouter credit usage (in USD) for the API key25.5
usageDailynumber✔️OpenRouter credit usage (in USD) for the current UTC day25.5
usageWeeklynumber✔️OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday)25.5
usageMonthlynumber✔️OpenRouter credit usage (in USD) for the current UTC month25.5
byokUsagenumber✔️Total external BYOK usage (in USD) for the API key17.38
byokUsageDailynumber✔️External BYOK usage (in USD) for the current UTC day17.38
byokUsageWeeklynumber✔️External BYOK usage (in USD) for the current UTC week (Monday-Sunday)17.38
byokUsageMonthlynumber✔️External BYOK usage (in USD) for current UTC month17.38
isFreeTierboolean✔️Whether this is a free tier API keyfalse
isManagementKeyboolean✔️Whether this is a management keyfalse
isProvisioningKeyboolean✔️: warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Whether this is a management key
false
limitRemainingnumber✔️Remaining spending limit in USD74.5
limitResetstring✔️Type of limit reset for the API keymonthly
includeByokInLimitboolean✔️Whether to include external BYOK usage in the credit limitfalse
expiresAtDateISO 8601 UTC timestamp when the API key expires, or null if no expiration2027-12-31T23:59:59Z
creatorUserIdstring✔️The user ID of the key creator. For organization-owned keys, this is the member who created the key. For individual users, this is the user’s own ID.user_2dHFtVWx2n56w6HkM0000000000
rateLimitoperations.RateLimit✔️: warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Legacy rate limit information about a key. Will always return -1.
{"requests": 1000,"interval": "1h","note": "This field is deprecated and safe to ignore."}