> ## Documentation Index
> Fetch the complete documentation index at: https://copilot-api.nick3.top/llms.txt
> Use this file to discover all available pages before exploring further.

# Usage and token monitoring endpoints

> Reference for the /usage and /token endpoints, which let you check Copilot quota status, remaining premium requests, and the current active token.

These endpoints expose runtime status and quota information for the accounts loaded by the proxy. Use them to monitor remaining premium requests, check which accounts are active, and debug authentication issues.

## Authentication

When API keys are configured in `auth.apiKeys`, the `/usage` endpoints require authentication using one of:

| Header          | Format                        |
| --------------- | ----------------------------- |
| `x-api-key`     | `x-api-key: <key>`            |
| `Authorization` | `Authorization: Bearer <key>` |

If no keys are configured, the endpoints are open.

***

## GET /usage

Returns runtime status snapshots for all accounts currently loaded by the proxy. Each entry includes the account ID, remaining premium quota, and whether the account has unlimited access.

```bash theme={null}
curl http://localhost:4141/usage
```

Example response:

```json theme={null}
{
  "accounts": [
    {
      "id": "octocat",
      "entitlement": 300,
      "remaining": 212,
      "unlimited": false,
      "failed": false
    },
    {
      "id": "octocat2",
      "entitlement": 300,
      "remaining": 300,
      "unlimited": false,
      "failed": false
    }
  ]
}
```

***

## GET /usage/:accountIndex

Returns detailed Copilot usage for a specific account, including `quota_snapshots` with a breakdown of usage over time. The `accountIndex` parameter is **0-based**.

```bash theme={null}
# Detailed usage for the first account
curl http://localhost:4141/usage/0

# Detailed usage for the second account
curl http://localhost:4141/usage/1
```

<Note>
  If you started the server with `--github-token`, a temporary account is added at index `0` and your registered accounts start at index `1`. Run `GET /usage` first to see which account is at each index.

  Note that `auth rm <index>` uses a **1-based** index (as shown by `auth ls`), while `/usage/:accountIndex` is **0-based**. These are different numbering schemes.
</Note>

***

## GET /token

Returns the current Copilot token the proxy is using to authenticate upstream requests. Useful for debugging authentication failures or verifying that a token refresh has occurred.

```bash theme={null}
curl http://localhost:4141/token
```

Example response:

```json theme={null}
{
  "token": "tid=...;exp=...;sku=...",
  "expires_at": 1735000000
}
```
