# Apertis Changelog: 2.2.27 — Feature Added

Canonical page: https://apertis.ai/changelog/2.2.27
Markdown mirror: https://apertis.ai/changelog/2.2.27.md
Version: 2.2.27
Title: Feature Added
Published: 2026-03-17
Category: feature

✨ Billing Credits API — Check Your Balance Programmatically

## Details

We've launched a new API endpoint that lets you query your remaining credits and subscription quota using your API key — no dashboard login required.

  **Endpoint**: `GET /v1/dashboard/billing/credits`

  ---

  #### The Problem

  Until now, checking your Apertis balance meant opening the dashboard in a browser. This creates friction in several real-world scenarios:

  - **Coding agents running overnight** — Claude Code, Cursor, or Kilo Code sessions can burn through credits while you sleep. By the time you notice, the session
  has already failed mid-task with an insufficient balance error.
  - **Team automation pipelines** — CI/CD workflows that call AI APIs have no way to pre-check if there's enough budget before kicking off an expensive batch job.
  - **Multi-key management** — If you distribute API keys across projects or team members, there's no programmatic way to monitor which keys are running low.
  - **Subscription cycle awareness** — Subscription users couldn't check how much cycle quota remains without visiting the dashboard. Easy to accidentally exhaust
  your monthly allocation without realizing it.

  We looked at what other providers offer: **OpenAI has no balance endpoint** (this is one of the most requested features on their community forum). **Anthropic's
  Admin API** can query cost reports but not remaining credits, and requires a separate admin key. Neither provides a simple "how much do I have left?" API call.

  We decided to solve this properly.

  ---

  #### What It Returns

  A single request gives you the complete picture:

  **PAYG users** get their credit balance in USD:

  ```json
  {
    "object": "billing_credits",
    "is_subscriber": false,
    "payg": {
      "remaining_usd": 12.50,
      "used_usd": 7.50,
      "total_usd": 20.00,
      "is_unlimited": false,
      "monthly_limit_usd": 50.00,
      "monthly_used_usd": 7.50,
      "monthly_reset_day": 1
    }
  }

  Subscription users see both their cycle quota and PAYG balance:

  {
    "object": "billing_credits",
    "is_subscriber": true,
    "payg": {
      "remaining_usd": 0.95,
      "used_usd": 0.05,
      "total_usd": 1.00,
      "is_unlimited": false
    },
    "subscription": {
      "plan_type": "pro",
      "status": "active",
      "cycle_quota_limit": 1000,
      "cycle_quota_used": 350,
      "cycle_quota_remaining": 650,
      "cycle_start": "2026-03-16T10:02:35Z",
      "cycle_end": "2026-04-16T10:02:35Z",
      "payg_fallback_enabled": true,
      "payg_spent_usd": 2.50,
      "payg_limit_usd": 10.00
    }
  }

```
---

### Use Cases

  1. Pre-flight budget check before expensive operations

  Before kicking off a large batch job or a long coding agent session, check if you have enough credits:

```python
import requests

credits = requests.get(
     "https://api.apertis.ai/v1/dashboard/billing/credits",
      headers={"Authorization": "Bearer sk-your-key"}
  ).json()

if credits["is_subscriber"]:
    remaining = credits["subscription"]["cycle_quota_remaining"]
    if remaining \< 100:
        print(f"Warning: only {remaining} quota remaining in this cycle")
    else:
        remaining = credits["payg"]["remaining_usd"]
        if remaining \< 1.0:
            print(f"Warning: only ${remaining:.2f} credits left")
```

  2. Automated low-balance alerts

  Set up a cron job or monitoring script that pings you when credits drop below a threshold:

```bash
  #!/bin/bash
  BALANCE=$(curl -s https://api.apertis.ai/v1/dashboard/billing/credits \
    -H "Authorization: Bearer $APERTIS_KEY" | jq '.payg.remaining_usd')

  if (( $(echo "$BALANCE \< 5.0" | bc -l) )); then
    echo "Low balance alert: $BALANCE USD remaining" | \
      mail -s "Apertis Low Balance" you@example.com
  fi
```

### What Makes This Different

  This is an Apertis exclusive. We surveyed every major AI API provider:

  - OpenAI: No balance endpoint. The most upvoted feature request on their developer forum for over two years. Their Usage API shows historical spending but not remaining credits.
  - Anthropic: Admin API provides cost reports, but requires a separate admin key and doesn't return remaining balance.
  - Together AI, OpenRouter: No programmatic balance check.

  We believe knowing your balance should be as simple as making one API call. No special keys, no dashboard login, no scraping.

  [Full API documentation](https://docs.apertis.ai/api/utilities/billing-credits)
  
  Enjoy it.
