1. Getting Started
Power Guard AI
  • Getting Started
    • hello-powerguard (starts here!)
    • ai-controller-guide
    • chat-controller-guide
    • health-controller-guide
    • models-controller-guide
    • usage-controller-guide
  • AI
    • Generate AI responses for form fields
      POST
    • Generate AI text completion
      POST
    • Generate embeddings for input text
      POST
  • Chat
    • Process chat completions
      POST
    • Process chat completions
      POST
  • Health
    • Check API health status
      GET
  • Models
    • List all available models
      GET
    • Get specific model information
      GET
  • Usage
    • Get API usage statistics
      GET
    • Get API usage statistics
      POST
  • Esquemas
    • Schemas
    • CompletionRequest
    • ChatCompletionChoice
    • EmbeddingRequest
    • ChatCompletionFunction
    • FunctionParameters
    • ChatCompletionMessage
    • Message
    • ChatCompletionResponse
    • QuestionModel
    • ChatCompletionToolCall
    • QuestionRequest
    • ChatCompletionUsage
    • Choice
    • QuestionValidationRules
    • Tool
    • ChoiceMessage
    • ToolFunction
    • CompletionResponse
    • DataItem
    • EmbeddingResponse
    • HealthResponseModel
    • ModelCapabilities
    • ModelInfo
    • ResponseModel
    • Role
    • SingleReadOnlyMemory
    • SingleReadOnlySpan
    • Usage
    • UsageModel
    • UsageRequest
  1. Getting Started

usage-controller-guide

📊 Usage Controller Guide#

Track your API usage with simple metrics.
The Usage Controller provides a straightforward way to monitor your API consumption across different models and time periods.

🎯 When to Use This Controller#

Usage monitoring - Track total requests and tokens used
Model comparison - See usage across different models
Cost estimation - Use token counts to estimate costs
Usage patterns - Analyze average tokens per request

🚀 Endpoint#

GET /api/Usage#

Retrieve usage data across models and time periods.

📋 Response Schema#

🔍 Example Response#

[
  {
    "monthYear": "2023-07",
    "model": "gpt-4",
    "totalRequests": 1250,
    "totalTokens": 3750000,
    "averageTokensPerRequest": 3000,
    "customer": "acme-corp"
  },
  {
    "monthYear": "2023-07",
    "model": "gpt-3.5-turbo",
    "totalRequests": 8500,
    "totalTokens": 12750000,
    "averageTokensPerRequest": 1500,
    "customer": "acme-corp"
  }
]

🜈 Real-World Examples#

💰 Department Chargebacks SOON#

🚨 Usage Alerts & Anomaly Detection SOON#

🔍 Optimization Recommendations SOON#

📊 Visualization Examples SOON#

🔄 Real-Time Monitoring SOON#

🔧 Best Practices#

1.
Track usage trends - Monitor monthly changes in token consumption
2.
Compare model efficiency - Evaluate which models give the best results per token
3.
Set usage alerts - Create custom alerts based on token thresholds
4.
Regular reporting - Generate monthly usage reports for budgeting
5.
Optimize prompts - Use data to identify opportunities for prompt engineering improvements
6.
Model selection - Choose appropriate models based on complexity of tasks

Remember: Regular monitoring of your API usage helps optimize costs and improve application performance.

🎁 Pro Tips#

1.
Set up automated reports: Schedule weekly/monthly usage reports
2.
Use tags extensively: Better tags = better cost allocation
3.
Monitor patterns: Unusual usage often indicates issues
4.
Implement quotas early: Easier to relax than to restrict later
5.
Archive usage data: Historical data is gold for optimization

Usage Tracking Checklist:
Set up department budgets
Configure usage alerts
Implement cost allocation tags
Schedule automated reports
Plan data retention strategy
Need help optimizing your usage? Email us
Modificado em 2025-07-16 20:45:05
Página anterior
models-controller-guide
Próxima página
Generate AI responses for form fields
Built with