Skip to content

API Keys

CheapestInference uses two categories of API keys:

  • Consumption keys (sk_xxx) — used for inference requests. Created via subscription payments or from your credit balance.
  • 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.

There are two types:

Created automatically when you subscribe. Each payment = one key with 30-day access.

  • Rate limits set by plan tier (Standard or Pro)
  • Independent expiration per key
  • When a key expires, only that key is revoked

Created manually from the API Keys page or via API. All credit keys share your account’s credit balance.

  • 60 RPM rate limit
  • Usage deducted from your shared credit pool
  • Never expire (as long as you have balance)

GET /api/keys

Returns all consumption keys (subscription + credit) for the authenticated user.

Terminal window
curl https://api.cheapestinference.com/api/keys \
-H "Authorization: Bearer YOUR_AUTH_TOKEN"
[
{
"id": "clx1abc...",
"name": "prod-key",
"keyPlan": "standard",
"keyType": "subscription",
"isActive": true,
"subscriptionStatus": "active",
"subscriptionExpiresAt": "2026-02-15T10:00:00.000Z",
"createdAt": "2026-01-15T10:00:00.000Z"
},
{
"id": "clx2def...",
"name": "mobile-app",
"keyPlan": "credits",
"keyType": "credit",
"isActive": true,
"createdAt": "2026-01-20T14:30:00.000Z"
}
]

The apiKey field is never returned in list responses.


POST /api/keys/credit

Creates a new credit key that shares your account’s credit balance. Requires a credit balance > 0.

ParameterTypeRequiredDescription
namestringYesA label for the key (e.g. “mobile-app”)
Terminal window
curl -X POST https://api.cheapestinference.com/api/keys/credit \
-H "Authorization: Bearer YOUR_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "mobile-app"}'
{
"id": "clx3ghi...",
"name": "mobile-app",
"keyType": "credit",
"apiKey": "sk_live_xxxxxxxxxxxxxxxx",
"isActive": true,
"createdAt": "2026-01-20T14:30:00.000Z"
}

Important: The apiKey value is only returned once — on creation. Copy it immediately.


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"
{
"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"
[
{
"id": "uuid-here",
"name": "ci-pipeline",
"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. “ci-pipeline”)
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": "ci-pipeline"}'
{
"id": "uuid-here",
"name": "ci-pipeline",
"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 credit key programmatically
curl -X POST https://api.cheapestinference.com/api/keys/credit \
-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_xxx) for that.


Pay (Stripe/USDC) → Key created automatically → Use for 30 days → Key expires → Renew
  1. Each subscription payment creates exactly one API key.
  2. The key has its own 30-day period and rate limits based on the plan tier.
  3. When a subscription key expires, only that specific key is revoked.
  4. You can have multiple active subscription keys from separate payments.
Top up credits → Create credit key(s) → Use until balance runs out → Top up again
  1. Top up your credit balance first (Billing page).
  2. Create one or more credit keys — they all share your account balance.
  3. Credit keys never expire; usage is deducted from your shared pool.
TypeRPMTPM
Standard subscription603,333
Pro subscription20013,333
Credit60