Skip to main content

Overview

The Management API lets you retrieve organization balance totals, manage organization API keys, and retrieve usage and billing for a specific key without using a standard inference API key. Use a management token from your Dashboard Settings page:
Authorization: Bearer mt-your-management-token
Management tokens are different from inference API keys. Use mt-... for /v1/management/*, and use sk-... for model inference endpoints such as /v1/responses.

Available Endpoints

EndpointMethodDescription
/v1/management/balanceGETRetrieve current organization balance totals
/v1/management/api-keysGETList user-managed API keys in the current organization
/v1/management/api-keysPOSTCreate a new user API key
/v1/management/api-keys/{keyId}PATCHUpdate name, usage limit, allowed models, expiry, or status
/v1/management/api-keys/{keyId}/usageGETRetrieve paginated usage details for a specific key
/v1/management/api-keys/{keyId}/billingGETRetrieve aggregated billing breakdowns for a specific key

Usage Filter Contract

GET /v1/management/api-keys/{keyId}/usage supports the following query parameters:
ParameterTypeDefault / LimitsNotes
pageintegerdefault 1, min 11-based page number
limitintegerdefault 50, min 1, max 100Page size
logicalModelstringmax length 100Requested logical model name
modelVendorstringmax length 100Public model vendor
sceneenum-chat, image, audio, video, embedding, rerank, translation, music, 3d
accessChannelenum-platform or byok
startDatestring-Inclusive lower bound; accepts RFC3339 with timezone or YYYY-MM-DD
endDatestring-Inclusive upper bound; accepts RFC3339 with timezone or YYYY-MM-DD
If both startDate and endDate are present, startDate must be earlier than or equal to endDate.

API Key Body Contract

POST /v1/management/api-keys

FieldTypeDefault / LimitsNotes
namestringrequired, default Default Key, length 1-50Display name, trimmed server-side
limitAmountnumber | nullmin 0, input max 1000000null or omitted = unlimited, 0 = zero quota. Positive values are normalized to a stored cap that cannot exceed 100000 USD equivalent.
limitCurrencyenumdefault USDUSD only. Sending CNY returns 400 currency_retired.
modelsstring[]default []Optional logical model allowlist
expiresAtstring | nullRFC3339 datetimenull means no expiry

PATCH /v1/management/api-keys/

FieldTypeDefault / LimitsNotes
statusenum-active, inactive, suspended, revoked
namestringlength 1-50Updated display name
limitAmountnumber | nullmin 0, input max 1000000null means unlimited, 0 means zero quota. Positive values are normalized to a stored cap that cannot exceed 100000 USD equivalent.
limitCurrencyenumdefault USDUSD only. Sending CNY returns 400 currency_retired.
modelsstring[]-Updated logical model allowlist
expiresAtstring | nullRFC3339 datetimenull clears the expiry
At least one PATCH field must be provided.

Monetary Contract

  • Management API monetary request and response fields are USD-only.
  • limitCurrency defaults to USD; sending CNY returns 400 with currency_retired.

Reporting Semantics

  • logicalModel refers to the public logical model requested by the caller.
  • modelVendor refers to the public model vendor, not the hidden physical route.
  • scene is the public request scene derived from the endpoint or task type.
  • accessChannel=platform means the request was billed via TokenLab’s platform channel.
  • accessChannel=byok means the request used your own upstream provider key.
Responses expose public billing and reporting fields only. Internal routing details and physical provider metadata remain hidden.
  • /usage line items can include billing_transaction_id once the underlying request has reached settled billing state. Use request_id + billing_transaction_id for request-level reconciliation.

Billing Pagination Note

/usage is paginated. /billing is currently an aggregated breakdown endpoint and does not return page / limit style pagination metadata. If you need line-level records, use /usage.

Quick Example

First check the current organization balance with the management token:
curl -X GET "https://api.tokenlab.sh/v1/management/balance" \
  -H "Authorization: Bearer mt-your-management-token"
Then list the API keys available to the same management token:
curl "https://api.tokenlab.sh/v1/management/api-keys" \
  -H "Authorization: Bearer mt-your-management-token"
{
  "object": "list",
  "data": [
    {
      "id": "key_abc123def456",
      "name": "Backend Worker",
      "key_prefix": "sk-abc123...",
      "status": "active",
      "limit_amount": 500.0,
      "used_amount": 148.25,
      "models": ["gpt-4o-mini", "claude-3-7-sonnet"],
      "expires_at": "2026-04-30T00:00:00.000Z",
      "last_used_at": "2026-03-27T08:12:45.000Z",
      "created_at": "2026-03-01T10:00:00.000Z"
    }
  ]
}

Next Steps