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

> Learn how to track your Eden AI API consumption and costs using the Cost Monitoring endpoints.

# Monitoring

export const TechArticleSchema = ({title, description, path, articleSection, about, proficiencyLevel = "Beginner", dependencies, keywords = [], datePublished, dateModified, image, inLanguage = "en"}) => {
  const baseUrl = "https://www.edenai.co/docs";
  const canonicalUrl = `${baseUrl}/${path}`.replace(/\/+$/, "");
  const ogParams = new URLSearchParams({
    division: articleSection || "",
    title: title || "",
    description: description || ""
  });
  const resolvedImage = image || `https://edenai.mintlify.app/_mintlify/api/og?${ogParams.toString()}`;
  const data = {
    "@context": "https://schema.org",
    "@type": "TechArticle",
    "@id": `${canonicalUrl}#techarticle`,
    mainEntityOfPage: {
      "@type": "WebPage",
      "@id": canonicalUrl
    },
    headline: title,
    name: title,
    description: description,
    url: canonicalUrl,
    inLanguage: inLanguage,
    isPartOf: {
      "@type": "WebSite",
      name: "Eden AI Documentation",
      url: baseUrl
    },
    author: [{
      "@type": "Organization",
      name: "Eden AI",
      url: "https://www.edenai.co/"
    }],
    publisher: {
      "@type": "Organization",
      name: "Eden AI",
      url: "https://www.edenai.co/",
      logo: {
        "@type": "ImageObject",
        url: "https://www.edenai.co/assets/logo.png"
      }
    }
  };
  if (articleSection) data.articleSection = articleSection;
  if (about) data.about = {
    "@type": "Thing",
    name: about
  };
  if (proficiencyLevel) data.proficiencyLevel = proficiencyLevel;
  if (dependencies) data.dependencies = dependencies;
  if (keywords && keywords.length) data.keywords = keywords;
  if (datePublished) data.datePublished = datePublished;
  if (dateModified) data.dateModified = dateModified;
  data.image = Array.isArray(resolvedImage) ? resolvedImage : [resolvedImage];
  const json = JSON.stringify(data);
  const schemaId = `techarticle-${canonicalUrl}`;
  React.useEffect(() => {
    if (typeof document === "undefined") return;
    document.querySelectorAll(`script[data-schema-id="${schemaId}"]`).forEach(n => n.remove());
    const script = document.createElement("script");
    script.type = "application/ld+json";
    script.dataset.schemaId = schemaId;
    script.textContent = json;
    document.head.appendChild(script);
    return () => script.remove();
  }, [json, schemaId]);
  return null;
};

<TechArticleSchema title={"Monitoring"} description={"Learn how to track your Eden AI API consumption and costs using the Cost Monitoring endpoints."} path="v3/general/monitoring" articleSection="General" about={"API Configuration"} proficiencyLevel="Intermediate" keywords={["Eden AI", "AI API", "rate limits", "billing", "monitoring"]} datePublished="2026-05-06T00:00:00Z" dateModified="2026-05-07T00:00:00Z" />

Learn how to track your Eden AI API consumption and costs using the Cost Monitoring endpoints.

> **Note**: These are admin/dashboard endpoints typically used by the Eden AI dashboard or custom admin interfaces. For standard API usage authentication, see the [API Keys guide](/v3/general/custom-api-keys).

## Overview

The Cost Monitoring API provides two key endpoints to help you track and manage your Eden AI spending:

* **Monitor Consumptions** - Get detailed usage and cost breakdowns by date, provider, and feature
* **Check Credits** - Retrieve your current account credit balance

## Endpoints

### Monitor Consumptions

```
GET https://api.edenai.run/v2/cost_management/
```

### Check Current Credits

```
GET https://api.edenai.run/v2/cost_management/credits/
```

## Key Concepts

### Step Parameter

The `step` parameter controls how data is aggregated:

| Step Value | Aggregation Period | Use Case                |
| ---------- | ------------------ | ----------------------- |
| 1          | Daily              | Detailed daily analysis |
| 2          | Weekly             | Weekly trends           |
| 3          | Monthly            | Monthly reports         |
| 4          | Yearly             | Annual summaries        |

### Filtering Options

Filter your cost data by adding any of these query parameters:

| Parameter        | Description                 | Example                         |
| ---------------- | --------------------------- | ------------------------------- |
| `provider`       | Specific AI provider        | `openai`, `anthropic`           |
| `subfeature`     | Specific feature            | `chat`, `ocr`, `text_to_speech` |
| `token`          | Specific API token          | `prod_token_123`                |
| `workflow_id`    | Specific workflow execution |                                 |
| `rag_project_id` | Specific RAG project        |                                 |

## Check Your Current Credits

```python Python theme={null}
import requests

API_KEY = "eyJhbG...xxxxxxxxxxxxxxxxxxxxxxxx"

response = requests.get(
    "https://api.edenai.run/v2/cost_management/credits/",
    headers={"Authorization": f"Bearer {API_KEY}"}
)

credits_data = response.json()
print(f"Current credits: ${credits_data['credits']:.2f}")
```

**Response:**

```json theme={null}
{
  "credits": 42.50
}
```

## Monitor Usage

Get your last 30 days of usage, grouped by day:

```python Python theme={null}
import requests
from datetime import datetime, timedelta

API_KEY = "eyJhbG...xxxxxxxxxxxxxxxxxxxxxxxx"

end_date = datetime.now()
begin_date = end_date - timedelta(days=30)

response = requests.get(
    "https://api.edenai.run/v2/cost_management/",
    headers={"Authorization": f"Bearer {API_KEY}"},
    params={
        "begin": begin_date.strftime("%Y-%m-%d"),
        "end": end_date.strftime("%Y-%m-%d"),
        "step": 1  # Daily aggregation
    }
)

data = response.json()
print(f"Usage data retrieved for {len(data['response'])} token(s)")
```

## Response Format

The monitoring endpoint returns data structured by token, date, and feature:

```json theme={null}
{
  "response": [
    {
      "token": "base_token",
      "data": {
        "2024-01-01": {
          "text__chat": {
            "total_cost": 11.30,
            "details": 381,
            "cost_per_provider": {
              "openai": 11.28,
              "anthropic": 0.02
            }
          },
          "image__explicit_content": {
            "total_cost": 0.15,
            "details": 101,
            "cost_per_provider": {
              "google": 0.15
            }
          }
        }
      }
    }
  ]
}
```

### Response Fields

| Field               | Type    | Description                              |
| ------------------- | ------- | ---------------------------------------- |
| `token`             | string  | API token identifier                     |
| `data`              | object  | Date-keyed usage data                    |
| `total_cost`        | number  | Total cost for this feature on this date |
| `details`           | integer | Number of API calls made                 |
| `cost_per_provider` | object  | Cost breakdown by provider               |

### Feature Naming Convention

Features follow the pattern `{category}__{subfeature}`:

| Key                       | Description          |
| ------------------------- | -------------------- |
| `text__chat`              | LLM chat completions |
| `text__generation`        | Text generation      |
| `text__embeddings`        | Text embeddings      |
| `image__explicit_content` | Image moderation     |
| `image__question_answer`  | Image Q\&A           |
| `ocr__ocr`                | OCR text extraction  |
| `audio__text_to_speech`   | Text-to-speech       |

## Error Responses

### 400 Bad Request

```json theme={null}
{
  "error": {
    "type": "validation_error",
    "message": {
      "begin": ["This field is required."]
    }
  }
}
```

### 403 Forbidden

```json theme={null}
{
  "error": {
    "type": "permission_error",
    "message": "You do not have permission to access this resource"
  }
}
```

### 404 Not Found

```json theme={null}
{
  "details": "Not Found"
}
```
