Skip to main content
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.

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 ValueAggregation PeriodUse Case
1DailyDetailed daily analysis
2WeeklyWeekly trends
3MonthlyMonthly reports
4YearlyAnnual summaries

Filtering Options

Filter your cost data by adding any of these query parameters:
ParameterDescriptionExample
providerSpecific AI provideropenai, anthropic
subfeatureSpecific featurechat, ocr, text_to_speech
tokenSpecific API tokenprod_token_123
workflow_idSpecific workflow execution
rag_project_idSpecific RAG project

Check Your Current Credits

Python
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:
{
  "credits": 42.50
}

Monitor Usage

Get your last 30 days of usage, grouped by day:
Python
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:
{
  "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

FieldTypeDescription
tokenstringAPI token identifier
dataobjectDate-keyed usage data
total_costnumberTotal cost for this feature on this date
detailsintegerNumber of API calls made
cost_per_providerobjectCost breakdown by provider

Feature Naming Convention

Features follow the pattern {category}__{subfeature}:
KeyDescription
text__chatLLM chat completions
text__generationText generation
text__embeddingsText embeddings
image__explicit_contentImage moderation
image__question_answerImage Q&A
ocr__ocrOCR text extraction
audio__text_to_speechText-to-speech

Error Responses

400 Bad Request

{
  "error": {
    "type": "validation_error",
    "message": {
      "begin": ["This field is required."]
    }
  }
}

403 Forbidden

{
  "error": {
    "type": "permission_error",
    "message": "You do not have permission to access this resource"
  }
}

404 Not Found

{
  "details": "Not Found"
}