Quickstart

Four steps from zero balance to a charged call. API host comes from env (https://credits-api.example.com is the placeholder).

1. Create a key

POST /v1/keys returns an API key immediately with balance 0. Starter credit arrives after email verification.

curl -X POST https://credits-api.example.com/v1/keys \
  -H "content-type: application/json" \
  -d '{"projectId":"tpr","email":"you@example.com"}'

2. Verify email

Open the link from the verification email (GET /v1/keys/verify?token=…&project=…). After verify you get 1000 öre once per address (credit projects).

3. Call a tool (charge)

Paid tools allow 3 free trial calls per tool, agent, and day. Pass a hashed agent id (X-Credits-Client-Id / clientId, 64 hex) so trials count per agent. Then unpaid calls hit the paywall.

curl -X POST https://credits-api.example.com/v1/charge \
  -H "content-type: application/json" \
  -H "authorization: Bearer YOUR_API_KEY" \
  -H "idempotency-key: create_order:demo-1" \
  -H "x-credits-client-id: $(printf agent-demo | sha256sum | awk '{print $1}')" \
  -d '{"projectId":"tpr","toolName":"create_order","idempotencyKey":"create_order:demo-1"}'

4. Top up

Invoice is live: POST /v1/:project/top-ups with amountOre and email. Balance is credited when the invoice is marked paid. Stripe Checkout packages of 50, 100, and 250 SEK are coming soon.

curl -X POST https://credits-api.example.com/v1/tpr/top-ups \
  -H "content-type: application/json" \
  -H "authorization: Bearer YOUR_API_KEY" \
  -d '{"amountOre":5000,"email":"you@example.com"}'

Next: wire the client into your MCP server or read pricing.