> ## Documentation Index
> Fetch the complete documentation index at: https://docs.behaviq.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Credits

BehavIQ tracks API usage at the workspace level.

Workspaces can pay for API usage in two ways:

| Billing setup                | How API requests are counted                                                              |
| ---------------------------- | ----------------------------------------------------------------------------------------- |
| Credit balance               | Chat uses `1` credit. Text to speech uses `3` credits.                                    |
| Enterprise pooled contract   | API requests and TTS draw from included workspace usage first, then credits if available. |
| Enterprise per-user contract | API key traffic uses credits. Signed-in app usage uses per-user included usage.           |

Enterprise admins can also set API key caps and member limits. API key caps apply to API key traffic. Member limits apply to signed-in app usage. Either can block a request even when the workspace still has usage left.

## Check the balance

```bash theme={null}
curl https://behaviq.io/v1/credits \
  -H "Authorization: Bearer YOUR_API_KEY"
```

Example response:

```json theme={null}
{
  "credits": 97
}
```

Enterprise workspaces may show `0` credits if they are using included usage instead of a credit balance.

## Check current period usage

```bash theme={null}
curl https://behaviq.io/v1/usage \
  -H "Authorization: Bearer YOUR_API_KEY"
```

The response includes `periodStart`, `periodEnd`, `requests`, `tts`, and `credits`.

## When usage is unavailable

The API returns `402` when a request cannot be covered by the workspace setup. Common causes are exhausted credits, exhausted included usage, a member limit, an API key cap, a workspace credit cap, or missing billing configuration.

Credit-balance workspaces can buy more credit packs in the app under `Billing -> Credits`.
