> For the complete documentation index, see [llms.txt](https://doc.threatreaper.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.threatreaper.ai/user-guide/ai-analytics-usage-and-cost-management.md).

# 📈 AI-Analytics — Usage & Cost Management

**Menu:** OPTIMIZE > AI-Analytics

{% tabs %}
{% tab title="Dashboard" %}
Token usage, cost, and usage trends across your models.
{% endtab %}

{% tab title="Models" %}
The models you track, with provider and usage.
{% endtab %}

{% tab title="Budgets" %}
Set spending or token budgets with alert thresholds, typically 70%, 85%, and 95%.
{% endtab %}

{% tab title="Rate Limits" %}
Per-model request or token limits.
{% endtab %}

{% tab title="Pricing" %}
Current model pricing used for cost calculation.
{% endtab %}
{% endtabs %}

## 12.1 How to configure it

{% stepper %}
{% step %}

## Add a model

In the **Models** tab, provide:

* Name
* Model Identifier, for example `gpt-4` or `claude-3-opus`
* Project
* Type: Public or Private
* Category: Language, Vision, Audio, or Custom
* Optional icon and description
* A pricing selection
* Optionally, assign it to existing budgets and rate limits
  {% endstep %}

{% step %}

## Add a budget

In the **Budgets** tab, provide:

* Name
* Total Budget amount
* Period: Monthly or One-time
* Auto Reset toggle
* The models it applies to—leave empty to apply to all

After creating it, use **Add Alert** to set a threshold percentage, for example 80%, and whether to send an email when it is reached.
{% endstep %}

{% step %}

## Add a rate limit

In the **Rate Limits** tab, provide:

* Name
* Scope: Global, Project, or Model
* If scoped, the target
* Requests per Minute
* Tokens per Minute
* Optionally, per-second, per-hour, or per-day limits

You can also enable **Throttling** with a delay, backoff strategy—fixed, exponential, or linear—and max retries, instead of hard-rejecting excess requests.
{% endstep %}

{% step %}

## Add custom pricing

In the **Pricing** tab, provide:

* Model Name
* Input Price and Output Price per 1,000 tokens
* An optional description

This is useful for negotiated or volume-discount rates.
{% endstep %}
{% endstepper %}

## 12.2 Errors you might see and how to fix them

| **Message**                            | **What it means**                                                                          | **What to do**                                                                                                                                                       |
| -------------------------------------- | ------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| "Name is required"                     | A required name field was left blank                                                       | Enter a name for the model, budget, rate limit, or pricing entry                                                                                                     |
| "Please select at least one model"     | A budget or rate limit needs at least one assigned model, or none was chosen when required | Select one or more models, or leave it to apply to all                                                                                                               |
| "Failed to save item"                  | The save request failed                                                                    | Check the fields shown and retry                                                                                                                                     |
| A budget shows status **Exceeded**     | Spending passed 100% of the budget                                                         | Requests tied to that budget may be blocked or alerted depending on policy configuration—ask your administrator to raise the budget or confirm the usage is expected |
| Requests are being delayed or rejected | A rate limit's cap was reached                                                             | Check **Rate Limits** for the relevant model/project and raise the limit if appropriate                                                                              |

## 12.3 What success looks like

**Budget card:**

> Production Budget Status: ⚠️ Warning
>
> Period: Monthly Usage: 82.4%
>
> Spent: $824.00 / $1,000.00 Resets in 6 days
>
> Models: gpt-4, gpt-4o-mini (+1 more)

**Rate limit table:**

| **Model**  | **Tokens / Minute** | **Requests / Minute** | **Tokens / Day** |
| ---------- | ------------------- | --------------------- | ---------------- |
| gpt-5      | 30,000              | 500                   | 900,000          |
| gpt-5-mini | 200,000             | 500                   | 2,000,000        |

The Dashboard tab turns this into trend charts for token usage and cost over time, by model and by project.


---

# 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://doc.threatreaper.ai/user-guide/ai-analytics-usage-and-cost-management.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.
