AICredits logo
Getting Started

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 keyManagement key
Prefixsk-live-…akm-…
Used forPOST /v1/chat/completions and the rest of the inference APIThe Management API only
Can call the other one's endpoints?NoNo
Carries scopesNoYes

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

  1. Open the Management API page (Beta) in your dashboard sidebar.
  2. Create management key → name it, pick the scopes it needs, create.
  3. 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.

ScopeGrants
keys:readList your inference keys
keys:writeCreate, update, and revoke inference keys
wallet:readRead wallet balance and run sufficiency checks
usage:readRead usage logs, stats, and cost-per-model
transactions:readRead credit / debit / refund history
team:readList teams and members
team:writeCreate 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.

MethodPathNotes
GET/api/v1/mgmt/keysList your inference keys (metadata only)
GET/api/v1/mgmt/keys/{id}One key's metadata (never the secret)
POST/api/v1/mgmt/keysCreate 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.

MethodPathReturns
GET/api/v1/mgmt/usagePer-request log, paginated (?page=, ?limit=, ?model=)
GET/api/v1/mgmt/usage/exportThe same log as CSV (up to 10,000 rows)
GET/api/v1/mgmt/usage/statsTotals: requests, cost, tokens (all-time and today)
GET/api/v1/mgmt/usage/dailyCost per day, last 30 days
GET/api/v1/mgmt/usage/cost-per-modelCost 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.

MethodPathScope
GET/api/v1/mgmt/teamsteam:read
POST/api/v1/mgmt/teamsteam:write
DELETE/api/v1/mgmt/teams/{teamId}team:write
GET/api/v1/mgmt/teams/{teamId}/membersteam:read
POST/api/v1/mgmt/teams/{teamId}/membersteam:write
POST/api/v1/mgmt/teams/{teamId}/members/{memberId}/allocateteam:write
GET/api/v1/mgmt/teams/{teamId}/members/{memberId}/usageteam: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

StatusMeaning
401Missing / invalid / expired key, or an sk- key was used
403The key lacks the required scope
404The resource doesn't exist or isn't yours
422Idempotency-Key reused with a different request body
503The Management API is temporarily disabled
429Rate 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:

ToolScopeDoes
models_list, model_get, pricing_estimate, docs_search—Public catalog + docs lookups
credits_balancewallet:readYour wallet balance in INR
usage_summaryusage:readRecent request count, spend, top models
keys_listkeys:readYour 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.

On this page