Skip to main content

Get Requests Usage

Get aggregated request statistics for your project, showing API usage patterns over time.

Query Parameters

page
integer
Page number for pagination (default: 1)
date_from
string
Start date for usage data (ISO 8601 format, e.g., “2024-01-01”)
date_to
string
End date for usage data (ISO 8601 format, e.g., “2024-01-31”)

Response

requests
array
Array of daily request statistics
curl --location --request GET 'https://api.plaisolutions.com/usage/requests?date_from=2024-01-01&date_to=2024-01-31' \
--header 'Authorization: Bearer YOUR_TOKEN'

Get Threads Usage

Get conversation thread statistics showing how users interact with your agents over time.

Query Parameters

date_from
string
Start date for usage data (ISO 8601 format)
date_to
string
End date for usage data (ISO 8601 format)

Response

threads
array
Array of daily thread statistics
curl --location --request GET 'https://api.plaisolutions.com/usage/threads?date_from=2024-01-01&date_to=2024-01-31' \
--header 'Authorization: Bearer YOUR_TOKEN'

Get LLM Usage

Get detailed statistics about language model usage including token consumption and costs.

Query Parameters

date_from
string
Start date for usage data (ISO 8601 format)
date_to
string
End date for usage data (ISO 8601 format)

Response

llm_usage
array
Array of LLM usage statistics
curl --location --request GET 'https://api.plaisolutions.com/usage/llm?date_from=2024-01-01&date_to=2024-01-31' \
--header 'Authorization: Bearer YOUR_TOKEN'

Get Rerank Usage

Get statistics about vector reranking operations used to improve search result quality.

Query Parameters

date_from
string
Start date for usage data (ISO 8601 format)
date_to
string
End date for usage data (ISO 8601 format)

Response

rerank_usage
array
Array of reranking usage statistics
curl --location --request GET 'https://api.plaisolutions.com/usage/rerank?date_from=2024-01-01&date_to=2024-01-31' \
--header 'Authorization: Bearer YOUR_TOKEN'

Get Embeddings Usage

Get statistics about embedding generation for vector search and semantic operations.

Query Parameters

date_from
string
Start date for usage data (ISO 8601 format)
date_to
string
End date for usage data (ISO 8601 format)

Response

embeddings_usage
array
Array of embedding usage statistics
curl --location --request GET 'https://api.plaisolutions.com/usage/embeddings?date_from=2024-01-01&date_to=2024-01-31' \
--header 'Authorization: Bearer YOUR_TOKEN'

Get Scraping Usage

Get statistics about web scraping operations performed for content extraction.

Query Parameters

date_from
string
Start date for usage data (ISO 8601 format)
date_to
string
End date for usage data (ISO 8601 format)

Response

scraping_usage
array
Array of scraping usage statistics
curl --location --request GET 'https://api.plaisolutions.com/usage/scraping?date_from=2024-01-01&date_to=2024-01-31' \
--header 'Authorization: Bearer YOUR_TOKEN'

Get Web Search Usage

Get statistics about web search operations performed through integrated search tools.

Query Parameters

date_from
string
Start date for usage data (ISO 8601 format)
date_to
string
End date for usage data (ISO 8601 format)

Response

web_search_usage
array
Array of web search usage statistics
curl --location --request GET 'https://api.plaisolutions.com/usage/web-search?date_from=2024-01-01&date_to=2024-01-31' \
--header 'Authorization: Bearer YOUR_TOKEN'

Get Speech-to-Text Usage

Get statistics about audio transcription operations performed using speech-to-text services.

Query Parameters

date_from
string
Start date for usage data (ISO 8601 format)
date_to
string
End date for usage data (ISO 8601 format)

Response

speech_to_text_usage
array
Array of speech-to-text usage statistics
curl --location --request GET 'https://api.plaisolutions.com/usage/speech-to-text?date_from=2024-01-01&date_to=2024-01-31' \
--header 'Authorization: Bearer YOUR_TOKEN'

Register Speech-to-Text Usage

Register speech-to-text usage in the system. This endpoint is typically used by internal services to track transcription usage.
This endpoint requires API key authentication with Users-Management-Key header and is intended for administrative use.

Request Body

llm_model
string
required
The transcription model used (e.g., “OPENAI_WHISPER”)
llm_provider
string
required
The service provider used for transcription
bytes
integer
required
Number of audio bytes processed
project_id
string
required
ID of the project to attribute the usage to

Response

Returns a confirmation of usage registration.
curl --location --request POST 'https://api.plaisolutions.com/usage/whisper' \
--header 'Users-Management-Key: YOUR_MANAGEMENT_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
  "llm_model": "OPENAI_WHISPER",
  "llm_provider": "OPENAI",
  "bytes": 1048576,
  "project_id": "project_123"
}'

Usage Analytics Best Practices

1

Monitor Regularly

Check usage statistics regularly to track consumption patterns and optimize costs
2

Set Alerts

Implement usage monitoring and alerts to prevent unexpected cost overruns
3

Analyze Trends

Use time-based filtering to identify usage trends and plan capacity accordingly
4

Optimize Performance

Use detailed usage data to identify inefficient operations and optimize them
5

Budget Planning

Leverage historical usage data for accurate budget forecasting and planning

Understanding Usage Metrics

Token Consumption

Monitor prompt and completion tokens to understand LLM costs and optimize prompt engineering

Request Patterns

Analyze request timing and frequency to identify peak usage periods and scale accordingly

Service Distribution

Track usage across different services to identify your primary cost drivers

Thread Activity

Monitor conversation patterns to understand user engagement and agent effectiveness

Cost Optimization Tips

Token Management:
  • Use shorter prompts when possible to reduce input token costs
  • Implement response length limits to control completion token usage
  • Consider using smaller models for simple tasks
Batch Processing:
  • Use batch APIs for non-real-time operations to reduce costs by up to 50%
  • Aggregate similar requests to minimize API overhead
Caching Strategy:
  • Implement response caching for frequently asked questions
  • Use embeddings caching to avoid re-generating vectors for existing content

Usage Reporting Dashboard

Create comprehensive usage dashboards using the analytics data:
// Example: Building a usage dashboard
async function fetchAllUsageData(dateFrom, dateTo) {
  const endpoints = [
    'requests',
    'threads', 
    'llm',
    'embeddings',
    'scraping',
    'web-search',
    'speech-to-text'
  ];
  
  const usageData = {};
  
  for (const endpoint of endpoints) {
    const response = await fetch(`/usage/${endpoint}?date_from=${dateFrom}&date_to=${dateTo}`, {
      headers: { 'Authorization': 'Bearer YOUR_TOKEN' }
    });
    usageData[endpoint] = await response.json();
  }
  
  return usageData;
}

Billing Integration

Usage statistics directly correlate with billing charges:
  • LLM Usage: Charged per token (input + output)
  • Embeddings: Charged per token processed
  • Scraping: Charged per credit consumed
  • Web Search: Charged per query + token usage
  • Speech-to-Text: Charged per audio minute/byte
  • Reranking: Charged per search unit
Rate Limiting Considerations:
  • High usage may trigger rate limiting
  • Monitor request patterns to stay within limits
  • Implement exponential backoff for retry logic
  • Consider upgrading to higher tier plans for increased limits