Skip to content

Management API

Everything you can do in the dashboard, you can do via API. Create a management key and use it to subscribe to plans, create API keys, top up credits, and manage your account — all programmatically. Perfect for CI/CD pipelines, SaaS platforms, and AI agents.

From the dashboard, switch to the Management Keys tab and create one. You’ll get a key starting with mk_. Save it — you won’t see it again.

All Management API requests use this key as a Bearer token:

Terminal window
curl https://api.cheapestinference.com/api/billing/status \
-H "Authorization: Bearer mk_your_management_key"

Start a recurring Stripe subscription:

Terminal window
curl -X POST https://api.cheapestinference.com/api/billing/checkout \
-H "Authorization: Bearer mk_your_management_key" \
-H "Content-Type: application/json" \
-d '{"planSlug": "pro"}'
{
"sessionUrl": "https://checkout.stripe.com/c/pay/cs_live_..."
}

Open sessionUrl in a browser to complete payment. After Stripe processes the payment, the subscription activates automatically via webhook.

PlanPriceRPMBudget per 5h
standard$20/mo60$0.14
pro$60/mo200$0.42

You can hold multiple subscriptions — each one is an independent budget pool with its own keys.

Terminal window
curl https://api.cheapestinference.com/api/billing/status \
-H "Authorization: Bearer mk_your_management_key"
{
"subscriptions": [
{
"id": "sub_uuid",
"planSlug": "pro",
"status": "active",
"currentPeriodEnd": "2026-03-05T10:00:00.000Z",
"cancelAtPeriodEnd": false,
"keyCount": 2,
"keys": [
{ "id": "key_uuid", "name": "prod-api" },
{ "id": "key_uuid", "name": "staging" }
]
}
],
"creditBalance": "25.00"
}

Each subscription supports unlimited keys. Create keys and assign them to a subscription:

Terminal window
curl -X POST https://api.cheapestinference.com/api/keys/subscription \
-H "Authorization: Bearer mk_your_management_key" \
-H "Content-Type: application/json" \
-d '{"name": "prod-api", "subscriptionId": "sub_uuid"}'
{
"id": "key_uuid",
"name": "prod-api",
"apiKey": "sk_live_abc123..."
}

Save the apiKey — it’s shown only once. Use it to make inference requests:

Terminal window
curl https://api.cheapestinference.com/v1/chat/completions \
-H "Authorization: Bearer sk_live_abc123..." \
-H "Content-Type: application/json" \
-d '{"model": "deepseek/deepseek-chat-v3-0324", "messages": [{"role": "user", "content": "Hello"}]}'
Terminal window
curl -X POST https://api.cheapestinference.com/api/billing/topup \
-H "Authorization: Bearer mk_your_management_key" \
-H "Content-Type: application/json" \
-d '{"amount": 50, "method": "stripe"}'

Returns a sessionUrl to complete the payment. Minimum $10.

Terminal window
# 1. Get payment address
curl -X POST https://api.cheapestinference.com/api/billing/topup \
-H "Authorization: Bearer mk_your_management_key" \
-H "Content-Type: application/json" \
-d '{"amount": 50, "method": "usdc"}'
{
"address": "0x...",
"chain": "base",
"amount": "50"
}
Terminal window
# 2. Send USDC on Base, then verify
curl -X POST https://api.cheapestinference.com/api/billing/verify-topup \
-H "Authorization: Bearer mk_your_management_key" \
-H "Content-Type: application/json" \
-d '{"txHash": "0xabc123...", "amount": 50}'

Credit keys deduct from your prepaid balance. Optionally set a per-key budget and rate limits:

Terminal window
curl -X POST https://api.cheapestinference.com/api/keys/credit \
-H "Authorization: Bearer mk_your_management_key" \
-H "Content-Type: application/json" \
-d '{"name": "client-acme", "maxBudget": 25, "rpm": 100, "tpm": 50000}'
ParameterTypeRequiredDescription
namestringYesKey name
maxBudgetnumberNoPer-key budget in USD (omit for shared pool)
rpmnumberNoRequests per minute limit
tpmnumberNoTokens per minute limit
Terminal window
curl -X POST https://api.cheapestinference.com/api/billing/cancel \
-H "Authorization: Bearer mk_your_management_key" \
-H "Content-Type: application/json" \
-d '{"subscriptionId": "sub_uuid"}'

The subscription stays active until the end of the billing period, then keys are revoked automatically.

Terminal window
# List all consumption keys
curl https://api.cheapestinference.com/api/keys \
-H "Authorization: Bearer mk_your_management_key"
# Delete a key
curl -X DELETE https://api.cheapestinference.com/api/keys/KEY_ID \
-H "Authorization: Bearer mk_your_management_key"
Terminal window
MK="mk_your_management_key"
API="https://api.cheapestinference.com/api"
# 1. Subscribe to Pro
SESSION=$(curl -s -X POST $API/billing/checkout \
-H "Authorization: Bearer $MK" \
-H "Content-Type: application/json" \
-d '{"planSlug": "pro"}' | jq -r '.data.sessionUrl')
echo "Pay at: $SESSION"
# 2. After payment, check status
STATUS=$(curl -s $API/billing/status -H "Authorization: Bearer $MK")
SUB_ID=$(echo $STATUS | jq -r '.data.subscriptions[0].id')
# 3. Create a key
KEY=$(curl -s -X POST $API/keys/subscription \
-H "Authorization: Bearer $MK" \
-H "Content-Type: application/json" \
-d "{\"name\": \"my-app\", \"subscriptionId\": \"$SUB_ID\"}" | jq -r '.data.apiKey')
# 4. Use it
curl https://api.cheapestinference.com/v1/chat/completions \
-H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" \
-d '{"model": "deepseek/deepseek-chat-v3-0324", "messages": [{"role": "user", "content": "Hello!"}]}'