Skip to content

API Keys

CheapestInference uses two categories of API keys:

  • Consumption keys (sk-...) — used for inference requests. Created from a pool (Unlimited) subscription.
  • Management keys (mk_xxx) — used for programmatic account management (create keys, check billing, etc.).

All key management endpoints accept either an auth token or a management key in the Authorization header:

Authorization: Bearer YOUR_AUTH_TOKEN
# or
Authorization: Bearer mk_xxxxxxxxxxxxxxxx

Consumption keys are the keys you use with the Chat Completions and Anthropic Messages endpoints.

Minted from a pool (Unlimited) subscription. After you reserve one or more time blocks via POST /api/pools/:id/subscribe, create a key with POST /api/keys/subscription.

  • Unlimited usage during your reserved time blocks, no token caps; a capped number of simultaneous requests per key
  • Independent expiration per key, tied to the subscription’s billing period
  • When a key expires, only that key is revoked

See Unlimited Subscriptions API for the pool subscribe flow.

Holding several subscriptions? A combined key spans two or more of them under one credential — coverage windows add up, and during overlapping hours their parallel capacity stacks.


GET /api/keys

Returns all consumption keys for the authenticated user.

Terminal window
curl https://api.cheapestinference.com/api/keys \
-H "Authorization: Bearer YOUR_AUTH_TOKEN"
{
"success": true,
"data": [
{
"id": "clx1abc...",
"name": "prod-key",
"keyPlan": "pool",
"keyType": "subscription",
"apiKey": "sk-...",
"isActive": true,
"subscriptionId": "sub-uuid",
"subscriptionStatus": "active",
"subscriptionExpiresAt": "2026-02-15T10:00:00.000Z",
"createdAt": "2026-01-15T10:00:00.000Z",
"lastUsedAt": "2026-01-20T08:00:00.000Z"
}
]
}

The full key (apiKey) is included in list responses for the show/copy feature in the dashboard. Treat list responses as sensitive.


Create subscription key (Unlimited / pool)

Section titled “Create subscription key (Unlimited / pool)”
POST /api/keys/subscription

Creates a new API key for your active Unlimited (pool) subscription.

ParameterTypeRequiredDescription
subscriptionIdstringNoTarget a specific subscription. If omitted, uses the most recent active subscription.

Example — create key for most recent subscription

Section titled “Example — create key for most recent subscription”
Terminal window
curl -X POST https://api.cheapestinference.com/api/keys/subscription \
-H "Authorization: Bearer mk_your_key"

Example — create key for a specific subscription

Section titled “Example — create key for a specific subscription”
Terminal window
curl -X POST https://api.cheapestinference.com/api/keys/subscription \
-H "Authorization: Bearer mk_your_key" \
-H "Content-Type: application/json" \
-d '{"subscriptionId": "subscription_uuid"}'
{
"success": true,
"data": {
"id": "key-uuid",
"apiKey": "sk_pool_xxxxxxxxxxxxxxxx",
"isActive": true
}
}

Note: The apiKey is shown here on creation and stays retrievable later via GET /api/keys. Treat it as a secret.

This endpoint is for Unlimited/pool subscriptions — the current subscription product. Reserve time blocks via POST /api/pools/:id/subscribe first, then create the key here.


PUT /api/keys/:id

Update a key’s name or active status. Deactivating a key immediately revokes it.

ParameterTypeRequiredDescription
namestringNoNew name for the key
isActivebooleanNofalse to deactivate, true to reactivate
Terminal window
curl -X PUT https://api.cheapestinference.com/api/keys/clx1abc... \
-H "Authorization: Bearer YOUR_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"isActive": false}'

DELETE /api/keys/:id

Permanently deletes a consumption key and revokes it.

Terminal window
curl -X DELETE https://api.cheapestinference.com/api/keys/clx1abc... \
-H "Authorization: Bearer YOUR_AUTH_TOKEN"
{
"success": true,
"data": {
"deleted": true
}
}

Management keys (mk_xxx) let you manage your account programmatically without a session token. Use them in CI/CD pipelines, scripts, or automated workflows.

GET /api/keys/management
Terminal window
curl https://api.cheapestinference.com/api/keys/management \
-H "Authorization: Bearer YOUR_AUTH_TOKEN"
{
"success": true,
"data": [
{
"id": "uuid-here",
"name": "mgmt_key_01",
"keyPrefix": "mk_a1b2c3d4",
"isActive": true,
"lastUsedAt": "2026-02-01T08:00:00.000Z",
"createdAt": "2026-01-25T12:00:00.000Z"
}
]
}
POST /api/keys/management
ParameterTypeRequiredDescription
namestringYesA label for the key (e.g. “mgmt_key_01”)
Terminal window
curl -X POST https://api.cheapestinference.com/api/keys/management \
-H "Authorization: Bearer YOUR_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "mgmt_key_01"}'
{
"success": true,
"data": {
"id": "uuid-here",
"name": "mgmt_key_01",
"keyPrefix": "mk_a1b2c3d4",
"apiKey": "mk_a1b2c3d4e5f6g7h8i9j0..."
}
}

Important: The full management key is only returned once. Store it securely.

DELETE /api/keys/management/:id
Terminal window
curl -X DELETE https://api.cheapestinference.com/api/keys/management/uuid-here \
-H "Authorization: Bearer YOUR_AUTH_TOKEN"

Once created, use a management key as a Bearer token to authenticate any /api/* endpoint:

Terminal window
# List your consumption keys using a management key
curl https://api.cheapestinference.com/api/keys \
-H "Authorization: Bearer mk_a1b2c3d4e5f6g7h8i9j0..."
# Check billing status
curl https://api.cheapestinference.com/api/billing/status \
-H "Authorization: Bearer mk_a1b2c3d4e5f6g7h8i9j0..."
# Create a subscription key programmatically
curl -X POST https://api.cheapestinference.com/api/keys/subscription \
-H "Authorization: Bearer mk_a1b2c3d4e5f6g7h8i9j0..." \
-H "Content-Type: application/json" \
-d '{"name": "auto-created"}'

Management keys cannot be used for inference. Use consumption keys (sk-...) for that.


Subscribe to a pool (reserve time blocks) → Create key (POST /api/keys/subscription) → Use during reserved hours → Key expires at period end → Renew
  1. Reserve one or more time blocks on a pool via POST /api/pools/:id/subscribe.
  2. Create one or more keys for that subscription with POST /api/keys/subscription.
  3. Each key gives unlimited usage during your reserved blocks (no token caps).
  4. When a subscription key expires at the end of the billing period, only that specific key is revoked.
  5. You can hold multiple pool subscriptions to cover more time blocks, each with its own keys.
TypeThroughputConcurrency
Pool (Unlimited) subscriptionUnlimited during reserved blocks, no token capsCapped simultaneous requests per key