Example Usage
import { GetCurrentKeyData } from "@openrouter/sdk/models/operations";
let value: GetCurrentKeyData = {
allowedDataRegions: [
"global",
"europe",
"us",
],
budgets: [
{
budgetId: null,
guardrailId: "0df9e665-d932-5740-b2c7-b52af166bc11",
includeByok: false,
limitUsd: 50,
remainingUsd: 17.5,
resetInterval: "weekly",
resetsAt: new Date("2026-10-12T00:00:00.000Z"),
scope: "member",
spendUsd: 32.5,
},
],
byokUsage: 17.38,
byokUsageDaily: 17.38,
byokUsageMonthly: 17.38,
byokUsageWeekly: 17.38,
creatorUserId: "user_2dHFtVWx2n56w6HkM0000000000",
effectiveBudget: {
budgetId: null,
guardrailId: "0df9e665-d932-5740-b2c7-b52af166bc11",
includeByok: false,
limitUsd: 50,
remainingUsd: 17.5,
resetInterval: "weekly",
resetsAt: new Date("2026-10-12T00:00:00.000Z"),
scope: "member",
spendUsd: 32.5,
},
freeModelDailyRequests: {
limit: 50,
remaining: 38,
used: 12,
},
includeByokInLimit: false,
isFreeTier: false,
isManagementKey: false,
isProvisioningKey: false,
label: "sk-or-v1-au7...890",
limit: 100,
limitRemaining: 74.5,
limitReset: "monthly",
organizationId: null,
rateLimit: {
interval: "1h",
note: "This field is deprecated and safe to ignore.",
requests: 1000,
},
usage: 25.5,
usageDaily: 25.5,
usageMonthly: 25.5,
usageWeekly: 25.5,
workspaceId: "0df9e665-d932-5740-b2c7-b52af166bc11",
};
Fields
| Field | Type | Required | Description | Example |
|---|---|---|---|---|
allowedDataRegions | operations.AllowedDataRegion[] | ✔️ | Data regions permitted for this API key by the guardrail policies on the key and the account regional-routing entitlement. Empty when no region is permitted. Reflects region policy only: other key restrictions, such as management keys being blocked from inference, still apply. | [ “global”, “europe”, “us” ] |
budgets | models.KeyBudget[] | ✔️ | Every budget layer enforcement checks for requests made with this key, in the order it checks them: guardrail budgets, workspace budgets, then the key’s own limit. Empty when nothing is budgeted. effective_budget is the budget that blocks requests first: the entry enforcement rejects on when one is already spent, otherwise the entry with the least remaining_usd; null when nothing is budgeted. limit and limit_remaining above describe only the key’s own limit. | [ { “budget_id”: null, “guardrail_id”: “0df9e665-d932-5740-b2c7-b52af166bc11”, “include_byok”: false, “limit_usd”: 50, “remaining_usd”: 17.5, “reset_interval”: “weekly”, “resets_at”: “2026-10-12T00:00:00.000Z”, “scope”: “member”, “spend_usd”: 32.5 } ] |
byokUsage | number | ✔️ | Total external BYOK usage (in USD) for the API key | 17.38 |
byokUsageDaily | number | ✔️ | External BYOK usage (in USD) for the current UTC day | 17.38 |
byokUsageMonthly | number | ✔️ | External BYOK usage (in USD) for current UTC month | 17.38 |
byokUsageWeekly | number | ✔️ | External BYOK usage (in USD) for the current UTC week (Monday-Sunday) | 17.38 |
creatorUserId | string | ✔️ | 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 |
effectiveBudget | models.KeyBudget | ✔️ | N/A | { “budget_id”: null, “guardrail_id”: “0df9e665-d932-5740-b2c7-b52af166bc11”, “include_byok”: false, “limit_usd”: 50, “remaining_usd”: 17.5, “reset_interval”: “weekly”, “resets_at”: “2026-10-12T00:00:00.000Z”, “scope”: “member”, “spend_usd”: 32.5 } |
expiresAt | Date | ➖ | ISO 8601 UTC timestamp when the API key expires, or null if no expiration | 2027-12-31T23:59:59Z |
freeModelDailyRequests | models.FreeModelDailyRequests | ✔️ | Free-model (:free variant) daily request quota for the account that owns the key. Reports the same counter and tier limit that free-model enforcement reads for accounts subject to the free-model limits; the counter resets at UTC midnight. Accounts and endpoints exempt from free-model limits, and BYOK requests, are not gated by it, so remaining is the tier policy rather than an enforced ceiling for them. | { “limit”: 50, “remaining”: 38, “used”: 12 } |
includeByokInLimit | boolean | ✔️ | Whether to include external BYOK usage in the credit limit | false |
isFreeTier | boolean | ✔️ | Whether this is a free tier API key | false |
isManagementKey | boolean | ✔️ | Whether this is a management key | false |
isProvisioningKey | boolean | ✔️ | ⚠️ 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 |
label | string | ✔️ | Human-readable label for the API key | sk-or-v1-0e6…1c96 |
limit | number | ✔️ | Spending limit for the API key in USD | 100 |
limitRemaining | number | ✔️ | Remaining spending limit in USD | 74.5 |
limitReset | string | ✔️ | Type of limit reset for the API key | monthly |
organizationId | string | ✔️ | The ID of the organization that owns this API key, or null when an individual account owns it. | null |
rateLimit | operations.RateLimit | ✔️ | ⚠️ 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. | { “interval”: “1h”, “note”: “This field is deprecated and safe to ignore.”, “requests”: 1000 } |
usage | number | ✔️ | Total OpenRouter credit usage (in USD) for the API key | 25.5 |
usageDaily | number | ✔️ | OpenRouter credit usage (in USD) for the current UTC day | 25.5 |
usageMonthly | number | ✔️ | OpenRouter credit usage (in USD) for the current UTC month | 25.5 |
usageWeekly | number | ✔️ | OpenRouter credit usage (in USD) for the current UTC week (Monday-Sunday) | 25.5 |
workspaceId | string | ✔️ | The ID of the workspace this API key spends in, or null when no active workspace resolved for it, for example because the key’s workspace was deleted. | 0df9e665-d932-5740-b2c7-b52af166bc11 |