Blog · Guides

Production Cost Guardrails: Per-Key USD Spending Caps, Model Presets & Instant QRIS Top-Ups

· Moyra Engineering

Isolate staging, production, and client workloads with per-key credit limits, RPM throttles, and model allowlists that auto-pause cleanly.

One key per environment or microservice

Sharing a single unconstrained API key across staging scripts, background workers, and production endpoints is a recipe for surprise bills.

In the Moyra console, you can issue dedicated keys for each service with its own USD spending cap, requests-per-minute (RPM) limit, expiration date, and model access preset (All models, Budget models only, or a custom allowlist).

# Programmatic balance & key quota inspection (works even when balance is $0.00)
curl https://moyra.ai.id/v1/user/info \
  -H "Authorization: Bearer $MOYRA_API_KEY"

Clean HTTP 402 auto-pause instead of mystery 401s

When an account balance reaches the minimum threshold or a key hits its budget cap, Moyra returns a structured HTTP 402 (balance_exhausted or key_budget_exceeded) rather than a generic 401 Unauthorized. As soon as you top up via QRIS or raise the key limit, keys resume automatically.