> For the complete documentation index, see [llms.txt](https://docs.umbraco.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.umbraco.com/ai-in-umbraco/19.latest/management-api/analytics/breakdown-model.md).

# By Model

Get usage breakdown by AI model.

{% hint style="warning" %}
This endpoint is obsolete and will be removed in version 20. Use [Get Usage Breakdown](/ai-in-umbraco/19.latest/management-api/analytics/breakdown.md) with `dimension=Model` instead.
{% endhint %}

Returns usage distribution across AI models.

## Request

```http
GET /umbraco/ai/management/api/v1/analytics/usage-by-model
```

### Query Parameters

| Parameter     | Type     | Required | Description                                                             |
| ------------- | -------- | -------- | ----------------------------------------------------------------------- |
| `from`        | datetime | Yes      | Start of period (inclusive)                                             |
| `to`          | datetime | Yes      | End of period (exclusive)                                               |
| `granularity` | string   | No       | Aggregation granularity: `Hourly` or `Daily` (auto-selected if omitted) |

## Response

### Success

{% code title="200 OK" %}

```json
[
    {
        "dimension": "openai/gpt-4o",
        "dimensionName": null,
        "requestCount": 8500,
        "totalTokens": 1950000,
        "percentage": 0.51
    },
    {
        "dimension": "openai/gpt-4o-mini",
        "dimensionName": null,
        "requestCount": 4000,
        "totalTokens": 520000,
        "percentage": 0.24
    },
    {
        "dimension": "anthropic/claude-3-5-sonnet-20241022",
        "dimensionName": null,
        "requestCount": 3200,
        "totalTokens": 890000,
        "percentage": 0.19
    }
]
```

{% endcode %}

{% hint style="info" %}
For provider and model breakdowns, `dimensionName` is typically `null` because no friendly name mapping is available.
{% endhint %}

## Examples

{% code title="cURL" %}

```bash
curl -X GET "https://your-site.com/umbraco/ai/management/api/v1/analytics/usage-by-model?from=2024-01-01T00:00:00Z&to=2024-01-31T23:59:59Z" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
```

{% endcode %}

{% code title="C#" %}

```csharp
var from = DateTime.UtcNow.AddDays(-30);
var to = DateTime.UtcNow;

var response = await httpClient.GetAsync(
    $"/umbraco/ai/management/api/v1/analytics/usage-by-model?from={from:O}&to={to:O}");

var breakdown = await response.Content.ReadFromJsonAsync<UsageBreakdownItemModel[]>();

foreach (var item in breakdown.OrderByDescending(x => x.TotalTokens))
{
    Console.WriteLine($"{item.Dimension}: {item.TotalTokens:N0} tokens ({item.Percentage:P0})");
}
```

{% endcode %}

## Response Properties

| Property        | Type   | Description                            |
| --------------- | ------ | -------------------------------------- |
| `dimension`     | string | Model reference (`providerId/modelId`) |
| `dimensionName` | string | Model display name                     |
| `requestCount`  | int    | Number of requests                     |
| `totalTokens`   | long   | Total tokens used                      |
| `percentage`    | double | Share of total requests (0.0-1.0)      |

## Use Cases

* **Cost optimization** - Identify expensive models for potential replacement
* **Performance analysis** - Compare model usage patterns
* **Capacity planning** - Understand which models are most relied upon


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.umbraco.com/ai-in-umbraco/19.latest/management-api/analytics/breakdown-model.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
