AI Investment Overview

Last updated: October 27, 2026

Span estimates what your coding-agent sessions cost from the tokens each session used, then spreads those dollars across the pull requests, models, and tasks the work touched, so you can slice AI spend any way you need.

Why it matters

A vendor invoice tells you what you spent. It doesn't tell you which team, repository, task, or pull request the money went to. Because Span prices each recorded session and links it to the code it produced, you can see spend per merged PR and per 1,000 AI-written lines, and catch a sudden jump before the invoice arrives.

How it works

1. Collect usage. auspex records each session in Cursor, GitHub Copilot, Claude Code, Codex, and VS Code.

2. Group into turns. Span groups raw events into turns (one request and response with a model), tagged with the model and token counts: input, output, cached input, cache read, cache write, and reasoning.

3. Price the tokens. Span prices each request by its model, date, and usage tier:

request cost = Σ over token types (tokens ÷ 1,000,000 × rate per 1M tokens)
  • Copilot, Claude Code, Codex, and VS Code are priced from tokens using Span's managed rate catalog, or your own rates where you have set them.

  • Some models charge a higher rate above an input-token threshold. Span picks one tier for the whole request and never blends them.

  • Span prices each request at the rate in effect on its date (UTC), so a rate change applies from its start date.

  • Cursor uses Cursor's own billing data instead: token-based where Cursor reports a token cost, per-request where it reports a flat request charge. Span never re-prices Cursor.

  • If a model or token type has no rate, the request is unpriced, not $0. It gets priced once a rate exists.

4. Spread the dollars. Priced cost is split so it adds up the same way in every view:

  • Across PRs the session contributed code to, weighted by the AI-attributed lines the session wrote on each PR. If none of the session's PRs has AI-attributed lines, the cost splits equally across them. A session with no linked PR keeps its cost in a Not linked to a PR slice.

  • Across models, by what each model actually used.

  • Across tasks the session was classified into, split equally.

5. Show it.

  • AI Effectiveness → AI investment: Key metrics (Est. AI cost, AI merge cost, AI cost per attributed PR), the Where trace investment goes view across team, repository, task classification, PR status, agent, and model, and a breakdown table. Click How cost is calculated for a summary.

  • Weekly briefing on the same page, for teams where at least 40% of active developers had a collector heartbeat in the last 7 days and a priced trace in the period.

  • Each trace: Estimated cost in the trace drawer on AI Effectiveness → Traces, where you can also sort sessions by cost.

  • Each PR: Estimated AI traces cost and Connected traces in the PR drawer. A PR's cost is its share of each connected session.

Tool

How data arrives

Pricing basis

Token types priced

Cursor

Cursor billing (via sync)

Cursor's own billing

As Cursor bills: token cost or a flat request charge

GitHub Copilot

auspex

Tokens

Input, output, cache-read, cache-write, and reasoning

Claude Code

auspex

Tokens

Input, output, cache-read, and 5-minute and 1-hour cache-write

Codex

auspex

Tokens

Input, output, cached input, and reasoning

VS Code

auspex

Tokens (Copilot rates)

Input, output, and reasoning

Setting your own rates

  1. Go to Settings → Integrations and find Token rates by model. The card appears once Agent Traces is on for your organization.

  2. Add a custom rate for a model, context tier, and date range. A custom row fully replaces Span's default for the dates and tiers it covers.

  3. Check Models with no pricing configuration on the same card. It lists each unpriced model and how many traces it leaves without a cost.

When you or Span change a rate, Span reprices the affected sessions automatically. No manual backfill is needed. Custom rates don't apply to Cursor, which follows Cursor's billing.

Things to know

  • It's an estimate, not an invoice. Span prices only sessions it recorded. Usage outside recorded sessions, discounts you haven't entered as custom rates, and flat subscription seats priced at token rates can all make Span's number differ from your bill.

  • Unpriced is not free. A session with an unpriced model shows no cost rather than $0.

  • A session's whole cost goes to its PRs. Work in the same session that didn't end up in the PR is still part of the cost.

  • Totals depend on the metric. Est. AI cost includes sessions with no PR and PRs that haven't merged. It dates PR-linked cost by the PR's merge date (or creation date if it hasn't merged), and other cost by the session's start. AI merge cost counts only qualified merged PRs, so it uses a smaller total.

  • History can change. A new rate or a fix to token counts reprices past sessions.

  • Seeing cost needs permission. Trace cost needs the Agent Trace Data permission. Est. AI cost also needs permission to read pull requests. See Agent Trace permissions.

  • Worked example: using example rates, a Claude Code session uses 2,000,000 input tokens at $3 per 1M and 200,000 output tokens at $15 per 1M, so it costs $6 + $3 = $9. It wrote 300 AI lines on PR A and 100 on PR B, so PR A gets $6.75 and PR B gets $2.25. The session was classified as both debugging and refactoring, so each PR's share splits equally between those two tasks. If neither PR had AI-attributed lines, each would get $4.50.

Related articles

How AI Code Ratio is calculated

Understanding Agent Traces in Span (auspex)

Agent Trace permissions

How long before a trace shows up in Span?

Need help?

Contact your Span account team or reach out to support@span.app.