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

# Usage

> Read credit balance, request cost, and metered units

# Usage

## Credit balance

```bash theme={null}
curl -sS "https://api.prismgateway.io/v1/credits" \
  -H "Authorization: Bearer $PRISM_API_KEY"
```

```json theme={null}
{
  "object": "credits",
  "balance_minor": 2000,
  "spent_minor": 0
}
```

Amounts use minor credits: `100` minor credits equals THB 1. Keep these values
as integers in your application.

`balance_minor` is the aggregate net balance across credit kinds for the key
owner and the organization ID stored on the key, when present. It is an account
summary, not proof that a particular route can spend: route admission uses
`general` plus that route's credit kind. `spent_minor` is lifetime debited usage
for the same context.

## Per-request usage

Successful chat responses include `x-prism-trace-id`. Use that value to
retrieve the customer-visible metering record:

```bash theme={null}
curl -sS "https://api.prismgateway.io/v1/usage/$REQUEST_ID" \
  -H "Authorization: Bearer $PRISM_API_KEY"
```

```json theme={null}
{
  "object": "usage",
  "request_id": "2feaac79-6d70-46e2-a823-fbe86329b0d7",
  "model": "example-chat-model",
  "created": 1785412800,
  "usage": {
    "input_tokens": 18,
    "output_tokens": 24,
    "total_tokens": 42
  },
  "cost_credits_minor": 7
}
```

Usage lookup is scoped to the user who owns the calling key. Unknown or
cross-user request IDs return `404`.

<Note>
  `cost_credits_minor` is what the customer was charged after organization
  pricing. Prism does not expose provider cost or internal margin through this
  endpoint.
</Note>

[อ่านภาษาไทย](/th/usage)
