Usage & Cost

Understand how usage is tracked and how costs are calculated.

What Is Metered?

WhizAI tracks usage for the following:

API Calls

Each API request counts as one call, regardless of the endpoint.

  • Generation requests
  • Search queries
  • Recommendation requests
  • Moderation checks
  • Enrichment operations

Tokens

For text generation, both input and output tokens are counted.

  • Prompt tokens (input)
  • Completion tokens (output)
  • Total tokens = prompt + completion

Workflow Runs

Each workflow execution counts as one run, regardless of the number of steps.

File Storage

Files ingested for search/recommendations are measured by size.

When Usage Is Recorded

Usage is recorded:

  • Immediately after a successful API call
  • For workflow runs, when the run completes (success or failure)
  • For tokens, based on actual model usage
  • Failed requests are not charged (unless they consume resources)

Viewing Usage

You can view usage in multiple ways:

Dashboard

The Usage & Cost page in your dashboard shows:

  • Total requests per time period
  • Total tokens consumed
  • Total costs
  • Breakdown by capability
  • Daily/weekly/monthly trends

API

Use the usage API to programmatically access usage data:

GET /v1/usage/metrics?timeframe=7d&granularity=day

How Costs Map to Actions

Runs (Workflow Executions)

Each workflow run is charged based on the steps executed and resources consumed. Complex workflows with many steps cost more than simple ones.

Tokens (Generation Calls)

Token costs vary by model. More powerful models cost more per token. Costs are calculated as: (input_tokens + output_tokens) × cost_per_token.

Files (Data Ingestion)

File storage is charged based on the size of files ingested and indexed for search/recommendations.

API Calls (Per Capability)

Each API call has a base cost. Some capabilities (like generation) have additional token-based costs on top of the base call cost.

Usage API Endpoint

GET /v1/usage/metrics

Query parameters:

  • timeframe - Time period (e.g., 7d, 30d)
  • granularity - Breakdown granularity (hour, day, week, month)

Example response:

{
  "id": "usage_123",
  "object": "usage_metrics",
  "timeframe": "7d",
  "granularity": "day",
  "metrics": {
    "total_requests": 15420,
    "total_tokens": 1250000,
    "total_cost": 125.5,
    "api_calls": {
      "generate": 8500,
      "enrich": 3200,
      "moderate": 1800,
      "recommend": 1200,
      "search": 720
    }
  }
}

Monitor Your Usage

Keep track of your usage and costs in the dashboard to optimize your spending.

Usage API Reference