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

# Cost Tracking

> Configure cost calculations, apply provider discounts, and validate effective usage costs across the platform.

## Overview

The **Cost Tracking** section allows administrators to customize how usage costs are calculated and reported. It supports applying **percentage-based discounts** to provider costs and validating how those discounts affect the final calculated usage.

All changes are applied automatically and reflected across usage, budgets, and analytics.

***

## Cost Tracking Tabs

The Cost Tracking screen is organized into two tabs:

* **Provider Discounts**
* **Test It**

Each tab focuses on a different aspect of cost configuration and verification.

***

## Provider Discounts

The **Provider Discounts** tab is used to define discount percentages that are applied to provider usage costs.

### Add Provider Discount

Select **Add Provider Discount** to configure a discount.

#### Provider

Select a provider from the dropdown list.

> The drop-down dynamically reflects available providers.

#### Discount Percentage

Set a discount value between **0% and 100%**.

This value represents the percentage reduction applied to the provider’s base cost.

***

### Discount Rules

* Discounts apply **after** the base provider cost is calculated
* Discount values must fall between **0 and 100**
* Multiple providers can have different discount rates
* Changes are saved automatically once applied

***

## Cost Calculation Logic

Discounts are applied using the following formula: final\_cost = base\_cost × (1 - discount\_percentage / 100)

### Example

If a request has a base cost of `10.00` and a discount of `5%`: \
final\_cost = 10.00 × (1 - 0.05) final\_cost = 9.50

***

## Valid Discount Range

* Minimum: `0%`
* Maximum: `100%`

Values outside this range are not accepted.

***

## Validating Discounts

To confirm that discounts are applied correctly, you can send a test request and inspect the response headers.

### Example Test Request (cURL)

```bash theme={null}
curl -X POST http://api.llmgrid.ai/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-api-key>" \
  -d '{
    "model": "<model-name>",
    "messages": [{ "role": "user", "content": "Hello" }]
  }'
```
