# Get AI agent usage

```http
GET https://trydimmi.com/api/v1/ai/usage
```

## Authorization

Send an API token as `Authorization: Bearer <token>`.
The token needs: `ai:read`.

## Query parameters

- `period` (string): The month as YYYY-MM, such as 2026-11. Leave out for the current month.

## Response 200 (OK)

- `data` (object, required)
  - `answered_count` (integer, required): Runs this month that ended with an answer.
  - `by_model` (object[] | null, required): The month's call count for each model. Empty when there were no calls.
    - `calls` (integer, required): How many calls were made to this model in the month.
    - `model` (string, required): Id of the model.
  - `by_outcome` (object[] | null, required): How many of the month's runs ended each way. Empty when there were no runs.
    - `outcome` (string, required): How the runs ended, such as answered, unknown, handoff, silent or skipped.
    - `runs_count` (integer, required): How many of the month's runs ended this way.
  - `cached_input_tokens` (integer, required): How many of the month's input tokens were read from the provider's cache.
  - `capped_at` (string | null, required): When the month's spending cap was reached. Null when it has not been.
  - `daily` (object[] | null, required): Runs for each day of the month, days in UTC.
    - `day` (string, required): The day in UTC, as YYYY-MM-DD, such as 2026-11-23.
    - `runs_count` (integer, required): How many times the agent ran that day.
  - `handoff_count` (integer, required): Runs this month that ended with a handoff to the team.
  - `input_tokens` (integer, required): Tokens sent to the models this month.
  - `output_tokens` (integer, required): Tokens the models wrote this month.
  - `period_start` (string, required): First day of the month the numbers cover, as YYYY-MM-DD, such as 2026-11-01.
  - `runs_count` (integer, required): How many times the agent ran this month.
  - `silent_count` (integer, required): Runs this month where the agent chose to say nothing.
  - `unknown_count` (integer, required): Runs this month where the agent did not know the answer.

## Response default (Error)

- `code` (string, required): Stable code for programs to tell errors apart, such as validation_failed or internal_error.
- `errors` (object): Each rejected field mapped to its messages. Only present when the input was invalid.
- `message` (string, required): What went wrong, in words safe to show a person.

## Example request

```bash
curl --request GET \
  --url 'https://trydimmi.com/api/v1/ai/usage' \
  --header 'Authorization: Bearer <token>'
```

## Example response

```json
{
  "data": {
    "answered_count": 123,
    "by_model": [
      {
        "calls": 123,
        "model": "<string>"
      }
    ],
    "by_outcome": [
      {
        "outcome": "<string>",
        "runs_count": 123
      }
    ],
    "cached_input_tokens": 123,
    "capped_at": "2026-11-01T09:30:00Z",
    "daily": [
      {
        "day": "<string>",
        "runs_count": 123
      }
    ],
    "handoff_count": 123,
    "input_tokens": 123,
    "output_tokens": 123,
    "period_start": "<string>",
    "runs_count": 123,
    "silent_count": 123,
    "unknown_count": 123
  }
}
```

---

Index of all dimmi docs: https://trydimmi.com/llms.txt (full text: https://trydimmi.com/llms-full.txt)
