Management API
Programmatic control-plane access for AICredits — create API keys, check wallet balance, read usage and transactions, and manage teams with a scoped management key.
Use this page with an AI assistant
Opens a new chat with this docs URL and the correct AICredits base URLs.
The Management API lets you script your AICredits account: create and revoke inference API keys, check your wallet balance before a job, pull usage and transaction history, and manage teams — all without the dashboard.
Beta. The Management API is available to every AICredits account. The surface may still change — pin your integration and watch the changelog.
Management keys vs. inference keys
| Inference key | Management key | |
|---|---|---|
| Prefix | sk-live-… | akm-… |
| Used for | POST /v1/chat/completions and the rest of the inference API | The Management API only |
| Can call the other one's endpoints? | No | No |
| Carries scopes | No | Yes |
A management key cannot make inference calls, and an inference key cannot call the Management API. Keep them separate — don't ship a management key in client-side code alongside your inference key.
Get a key
- Open the Management API page (Beta) in your dashboard sidebar.
- Create management key → name it, pick the scopes it needs, create.
- Copy the
akm-…value — it's shown once.
Keys are scoped to your own account and expire after at most one year. Revoke a key from the same page at any time.
Authentication
Send the key as a bearer token:
curl https://api.aicredits.in/api/v1/mgmt/wallet \
-H "Authorization: Bearer akm-your-management-key"Scopes
A key only works on endpoints covered by the scopes you granted it. There is no wildcard.
| Scope | Grants |
|---|---|
keys:read | List your inference keys |
keys:write | Create, update, and revoke inference keys |
wallet:read | Read wallet balance and run sufficiency checks |
usage:read | Read usage logs, stats, and cost-per-model |
transactions:read | Read credit / debit / refund history |
team:read | List teams and members |
team:write | Create teams; invite, allocate, and remove members |
Wallet
GET /api/v1/mgmt/wallet
Scope: wallet:read. Add ?required_inr=<amount> to get a sufficiency verdict.
curl "https://api.aicredits.in/api/v1/mgmt/wallet?required_inr=100" \
-H "Authorization: Bearer akm-…"{
"balance_inr": 250.0,
"currency": "INR",
"low_balance": false,
"max_wallet_balance_inr": 5000,
"required_inr": 100,
"sufficient": true
}Inference keys
All under scope keys:read (GET) or keys:write (POST/PATCH/DELETE). These act
on your sk-live-… keys.
| Method | Path | Notes |
|---|---|---|
GET | /api/v1/mgmt/keys | List your inference keys (metadata only) |
GET | /api/v1/mgmt/keys/{id} | One key's metadata (never the secret) |
POST | /api/v1/mgmt/keys | Create one. budget must be > 0; rate_limit is capped at 600 RPM |
PATCH | /api/v1/mgmt/keys/{id} | Update budget / rate limit / expiry. Fields you omit are left unchanged; "budget": 0 means unlimited |
DELETE | /api/v1/mgmt/keys/{id} | Revoke |
curl -X POST https://api.aicredits.in/api/v1/mgmt/keys \
-H "Authorization: Bearer akm-…" \
-H "Content-Type: application/json" \
-d '{"name":"prod-app","budget":500,"rate_limit":120}'{ "api_key": "sk-live-…" }The sk-live-… value is returned once.
Idempotency
The mutating endpoints — create key, invite member, allocate — accept an
optional Idempotency-Key header (any unique string ≤ 255 chars). The first
request with a given key is processed and its response cached for 24h; retries
with the same key and body replay that response (Idempotency-Replayed: true)
instead of running again. Reusing the key with a different body returns 422.
curl -X POST https://api.aicredits.in/api/v1/mgmt/teams/{teamId}/members \
-H "Authorization: Bearer akm-…" \
-H "Idempotency-Key: invite-2026-08-28-alice" \
-H "Content-Type: application/json" \
-d '{"email":"[email protected]","allocate_inr":200}'Usage
Scope: usage:read.
| Method | Path | Returns |
|---|---|---|
GET | /api/v1/mgmt/usage | Per-request log, paginated (?page=, ?limit=, ?model=) |
GET | /api/v1/mgmt/usage/export | The same log as CSV (up to 10,000 rows) |
GET | /api/v1/mgmt/usage/stats | Totals: requests, cost, tokens (all-time and today) |
GET | /api/v1/mgmt/usage/daily | Cost per day, last 30 days |
GET | /api/v1/mgmt/usage/cost-per-model | Cost grouped by model |
GET | /api/v1/mgmt/requests/{id} | One request's billed detail (model, tokens, cost, latency) |
curl "https://api.aicredits.in/api/v1/mgmt/usage/stats" \
-H "Authorization: Bearer akm-…"Transactions
GET /api/v1/mgmt/transactions
Scope: transactions:read. Paginated (?page=, ?limit=, max 100).
{
"transactions": [
{ "id": "…", "amount": 500.0, "type": "credit", "status": "completed",
"description": "Razorpay Topup", "created_at": "2026-08-01T10:00:00Z" }
],
"total": 12, "page": 1, "limit": 25, "total_pages": 1
}Teams
Teams let you allocate part of your wallet to other people (e.g. students, teammates). Their usage is billed to your wallet up to their allocation.
| Method | Path | Scope |
|---|---|---|
GET | /api/v1/mgmt/teams | team:read |
POST | /api/v1/mgmt/teams | team:write |
DELETE | /api/v1/mgmt/teams/{teamId} | team:write |
GET | /api/v1/mgmt/teams/{teamId}/members | team:read |
POST | /api/v1/mgmt/teams/{teamId}/members | team:write |
POST | /api/v1/mgmt/teams/{teamId}/members/{memberId}/allocate | team:write |
GET | /api/v1/mgmt/teams/{teamId}/members/{memberId}/usage | team:read |
DELETE | /api/v1/mgmt/teams/{teamId}/members/{memberId} | team:write |
curl -X POST https://api.aicredits.in/api/v1/mgmt/teams/{teamId}/members \
-H "Authorization: Bearer akm-…" \
-H "Content-Type: application/json" \
-d '{"email":"[email protected]","allocate_inr":200}'Allocate takes {"amount_inr": <delta>} by default (adds to the current
allocation). Pass {"set": true, "amount_inr": <target>} to set an absolute
allocation instead — the idempotent form to use from scripts. Allocation can
never drop below what the member has already spent.
Inviting a member does not send an email or create an account. It records
the email against the team; the person must sign up separately with that exact
address to be linked. Repeated invite calls for the same email add to the
existing allocation unless you send an Idempotency-Key (see above) or use the
absolute set form.
Errors
| Status | Meaning |
|---|---|
401 | Missing / invalid / expired key, or an sk- key was used |
403 | The key lacks the required scope |
404 | The resource doesn't exist or isn't yours |
422 | Idempotency-Key reused with a different request body |
503 | The Management API is temporarily disabled |
429 | Rate limit exceeded |
Rate limits
Each management key has its own per-minute limit (default 60 rpm). Responses
carry X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset.
MCP server
The AICredits MCP server at https://api.aicredits.in/mcp authenticates with a
management key. Add it to an MCP client (Claude Code, Cursor, …):
claude mcp add --transport http aicredits https://api.aicredits.in/mcp \
--header "Authorization: Bearer akm-your-management-key"Tools, each gated by the key's scopes:
| Tool | Scope | Does |
|---|---|---|
models_list, model_get, pricing_estimate, docs_search | — | Public catalog + docs lookups |
credits_balance | wallet:read | Your wallet balance in INR |
usage_summary | usage:read | Recent request count, spend, top models |
keys_list | keys:read | Your inference keys (metadata only) |
The MCP server never routes inference — point your client's model config at
https://api.aicredits.in/v1 with an sk-live-… key for that.