Skip to main content
PromptGuard provides comprehensive usage tracking to help you monitor API consumption, control costs, and optimize your AI application performance.

Usage Metrics Overview

Key Metrics Tracked

PromptGuard tracks detailed usage metrics across all your API calls:

Request Metrics

  • Total Requests: Number of API calls made
  • Successful Requests: Requests completed without errors
  • Failed Requests: Requests that returned errors
  • Blocked Requests: Requests stopped by security policies

Token Consumption

  • Input Tokens: Tokens in your prompts and messages
  • Output Tokens: Tokens in AI model responses
  • Total Tokens: Combined input and output token usage

Cost Tracking

  • Total Costs: Complete spending across all providers
  • Cost per Model: Spending breakdown by AI model
  • Cost per Provider: Spending split between OpenAI, Anthropic, etc.
  • Daily/Monthly Trends: Cost patterns over time

Performance Metrics

  • Average Latency: Mean response time for requests
  • P95/P99 Latency: High-percentile response times
  • Throughput: Requests per second/minute/hour
  • Error Rates: Percentage of failed requests

Dashboard Analytics

Real-Time Usage Dashboard

Access comprehensive usage analytics at app.promptguard.co:

Main Dashboard View

  • Current Usage: Real-time request and token consumption
  • Cost Tracking: Today’s spending and monthly projections
  • Performance Overview: Latency and error rate summaries
  • Security Events: Blocked requests and threat detection

Detailed Analytics

  • Usage Trends: Historical consumption patterns
  • Model Comparison: Performance across different AI models
  • Geographic Distribution: Usage by region/location
  • User Segmentation: Consumption by API key or user

Usage Breakdown

By Time Period

{
  "daily_usage": {
    "requests": 1250,
    "tokens": {
      "input": 45000,
      "output": 32000,
      "total": 77000
    },
    "cost": 1.85,
    "avg_latency": 420
  },
  "monthly_usage": {
    "requests": 38500,
    "tokens": {
      "input": 1350000,
      "output": 980000,
      "total": 2330000
    },
    "cost": 56.20,
    "avg_latency": 398
  }
}

By Model

{
  "model_usage": {
    "gpt-4o": {
      "requests": 850,
      "tokens": 52000,
      "cost": 1.25,
      "avg_latency": 480
    },
    "gpt-3.5-turbo": {
      "requests": 400,
      "tokens": 25000,
      "cost": 0.35,
      "avg_latency": 320
    },
    "claude-3-5-sonnet-latest": {
      "requests": 200,
      "tokens": 18000,
      "cost": 0.45,
      "avg_latency": 390
    }
  }
}

API Usage Tracking

Current Availability ✅

Developer API - Usage Stats

Get current usage statistics via API:
# Get current usage statistics (developer API - requires API key)
curl https://api.promptguard.co/api/v1/usage/stats \
  -H "X-API-Key: YOUR_PROMPTGUARD_API_KEY"
Response Format:
{
  "requests_this_month": 1250,
  "monthly_limit": 1000,
  "requests_remaining": -250,
  "usage_percentage": 125.0
}

Dashboard API - Detailed Analytics

Access detailed analytics through the dashboard:
# Get analytics stats (dashboard API - requires session auth)
curl https://api.promptguard.co/dashboard/analytics/stats \
  -H "Cookie: session=YOUR_SESSION_COOKIE" \
  -G -d "days=7"

# Get timeseries data
curl https://api.promptguard.co/dashboard/analytics/timeseries \
  -H "Cookie: session=YOUR_SESSION_COOKIE" \
  -G -d "days=7" \
  -d "interval=day"

# Get threat distribution
curl https://api.promptguard.co/dashboard/analytics/threats \
  -H "Cookie: session=YOUR_SESSION_COOKIE" \
  -G -d "days=7"

Roadmap Features 🚧

The following advanced usage tracking features are planned but not yet available:

Advanced Usage Queries (Planned)

# PLANNED - Not yet available
# Get usage for specific time period
curl https://api.promptguard.co/api/v1/usage/range \
  -H "X-API-Key: YOUR_PROMPTGUARD_API_KEY" \
  -G -d "start_date=2024-01-01" \
  -d "end_date=2024-01-31" \
  -d "granularity=daily"

# Get usage by specific dimensions
curl https://api.promptguard.co/api/v1/usage/breakdown \
  -H "X-API-Key: YOUR_PROMPTGUARD_API_KEY" \
  -G -d "dimension=model" \
  -d "timeframe=7d"

Budget Controls (Planned)

# PLANNED - Not yet available
# Set monthly budget limit
curl https://api.promptguard.co/api/v1/billing/budgets \
  -H "X-API-Key: YOUR_PROMPTGUARD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "monthly_limit": 500.00,
    "currency": "USD",
    "alert_thresholds": [50, 80, 95],
    "hard_limit": true
  }'

Automated Reporting (Planned)

# PLANNED - Not yet available
# Schedule automated usage reports
curl https://api.promptguard.co/api/v1/reports/schedule \
  -H "X-API-Key: YOUR_PROMPTGUARD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "report_type": "usage_summary",
    "frequency": "weekly",
    "delivery": {
      "email": ["[email protected]"]
    }
  }'

Cost Management

Current Dashboard Features ✅

Monitor costs through the dashboard:
  1. Navigate: app.promptguard.co → Projects → [Your Project] → Overview
  2. View Usage: See current month’s usage and remaining quota
  3. Billing: Access billing information and subscription details

Cost Optimization Tips

  • Model Selection: Use GPT-3.5-turbo for simple tasks when GPT-4 isn’t necessary
  • Prompt Engineering: Shorter, more efficient prompts reduce token costs
  • Caching: Reuse responses for similar queries (coming soon)
  • Monitoring: Track usage patterns to identify optimization opportunities

Rate Limiting and Quotas

Current Limits

Usage limits are based on your subscription plan:
PlanMonthly RequestsAdditional Features
Free1,000Basic protection
Starter10,000ML detection
Growth1,000,000Advanced analytics
EnterpriseUnlimitedCustom limits

Monitoring Quotas

View your current usage in the dashboard:
  1. Navigate: app.promptguard.co → Projects → [Your Project] → Overview
  2. Check Usage: See requests used vs. monthly limit
  3. Upgrade: Upgrade your plan if you need higher limits

Historical Data

Data Retention

PlanDetailed DataAggregated Data
Free7 days30 days
Starter30 days90 days
Growth90 days365 days
Need longer retention periods? Contact [email protected] for enterprise solutions with custom retention policies.

Troubleshooting Usage Tracking

Common Causes:
  • Requests not properly authenticated
  • API key belongs to different project
  • Data outside retention period
Solutions:
  • Verify API key is correct and active
  • Check that API key belongs to the project you’re querying
  • Check request timestamps
  • Contact support for data recovery
Solutions:
  • Verify you’re looking at the correct project
  • Check date range filters
  • Ensure API key is from the correct project
  • Refresh dashboard to get latest data
Solutions:
  • Check for network issues during measurement period
  • Review security events that might affect latency
  • Analyze request patterns for outliers
  • Check dashboard analytics for detailed breakdowns

Next Steps

Need help with usage tracking setup? Contact support for assistance with analytics and reporting.