Skip to content

Balance & Billing

ModuCompia AI uses a credit-based billing system. Your account balance is deducted per-request based on token usage and the model's pricing.

Checking Your Balance

View your current balance in the dashboard at ModuCompia AI under Wallet in the sidebar.

To check programmatically, use your API key against the key-usage endpoint:

curl https://ai.moducompia.com/api/usage/token/ \
  -H "Authorization: Bearer sk-YOUR_API_KEY"
{
  "code": true,
  "message": "ok",
  "data": {
    "object": "token_usage",
    "name": "production",
    "total_granted": 500000,
    "total_used": 12500,
    "total_available": 487500,
    "unlimited_quota": false,
    "model_limits_enabled": false,
    "expires_at": 0
  }
}

Values are in credits. When the key has no quota of its own (unlimited_quota: true), it draws on the account balance and these counters reflect the key's usage only.

An OpenAI-compatible variant is also available for tools that expect it:

curl https://ai.moducompia.com/v1/dashboard/billing/subscription \
  -H "Authorization: Bearer sk-YOUR_API_KEY"

It returns hard_limit_usd / soft_limit_usd in the site's display currency, and https://ai.moducompia.com/v1/dashboard/billing/usage returns the amount already spent.

Dashboard endpoints need a session

Endpoints under /api/user/… and /api/log/self belong to the web dashboard and are authenticated by your login session, not by an API key. Use the endpoints above from code.

How Pricing Works

Prices are those of the site you send the request to — the same account and the same key used against a different host would not carry them over. Always point base_url at the site you signed up on.

Each model has its own per-token pricing. When you make an API request:

  1. Prompt tokens (input) are charged at the model's input rate
  2. Completion tokens (output) are charged at the model's output rate
  3. The total cost is deducted from your balance immediately

Pricing for each model is visible in the Pricing page of the dashboard.

Top-Up

Add credits to your account through the Wallet → Top Up section in the dashboard. Available payment methods depend on your platform configuration.

Quota Limits on Keys

Each API key can have its own quota limit, independent of the account balance. This lets you:

  • Set spend caps per application
  • Allocate budgets per project
  • Prevent runaway costs from misbehaving scripts

When a key's own quota is used up, the key stops working and requests return 401 with an invalid-key message — even if the account still has funds. Raise the key's quota (or switch it to unlimited) to bring it back.

Insufficient Balance

If your account balance reaches zero:

{
  "error": {
    "message": "insufficient user quota (request id: 20260812...)",
    "type": "new_api_error",
    "code": "insufficient_user_quota"
  }
}

The HTTP status is 402 Payment Required.

Top up your balance to resume making requests.

Usage Tracking

See Usage & Analytics for detailed breakdowns of your spending by model, token, and time period.