Skip to main content
terraform {
  required_providers {
    costory = {
      source  = "costory-io/costory"
      version = ">= 0.1.0"
    }
  }
}

variable "costory_api_token" {
  type        = string
  description = "Costory API token."
  sensitive   = true
}

variable "cursor_admin_api_key" {
  type        = string
  description = "Cursor admin API key used to fetch billing data."
  sensitive   = true
}

provider "costory" {
  token = var.costory_api_token
}

resource "costory_billing_datasource_cursor" "main" {
  name          = "Cursor Billing"
  admin_api_key = var.cursor_admin_api_key
}
What Costory includes
  • Chargeable usage events only (Cursor marks these as chargeable).
  • Per-user spend using the user_email from Cursor.
  • Per-model usage (group by Service name = model).
  • Feature-level breakdown using kind, max_mode, and is_headless.
What Costory does not include
  • Non-chargeable or included usage (e.g., free or bundled allowances).
  • Seat or license invoices that are not emitted as usage events.
  • Taxes or adjustments outside the usage event stream.
How to analyze Cursor costs
  • Per-user email spend: group by Resource name or Sub account id (both map to the Cursor user email).
  • Per-model costs: group by Service name (model) and break down by SKU (input vs output tokens).
  • Feature usage: group by the kind, max_mode, and is_headless labels to compare Compose vs Chat, Max mode usage, or headless runs.
Cursor costs are attributed to input tokens. Output token rows are included for usage analysis but have $0 cost.
Last modified on March 18, 2026