Token Usage

Tokens are the units AI models use to process text. Understanding tokens helps you optimize costs.

What Are Tokens?

Tokens are pieces of words:

  • "Hello" = 1 token
  • "Hello, world!" = 3 tokens
  • "implementation" = 1 token
  • "implementations" = 2 tokens

Rule of thumb: 1 token ≈ 4 characters or ¾ of a word.

What Consumes Tokens

Input Tokens (sent to AI)

  • Ticket title and description
  • Code context (relevant files)
  • Conversation history
  • Agent system prompt
  • Organization context

Output Tokens (generated by AI)

  • Clarifying questions
  • Implementation plans
  • Generated code
  • PR descriptions
  • Comment responses

Typical Usage

TaskInput TokensOutput Tokens
Simple clarification2,000500
Small feature10,0003,000
Medium feature25,0008,000
Complex feature50,000+15,000+
PR feedback response5,0001,000

Reducing Token Usage

Write Concise Tickets

❌ Verbose (more tokens):
"I would like you to please add a feature that allows
users to upload their profile pictures to the system..."

✅ Concise (fewer tokens):
"Add user avatar upload: JPG/PNG, max 5MB, store in S3"

Keep Context Focused

Only include relevant information in your agent context:

❌ Too much:
[Entire architecture document, all coding standards,
company history, team bios...]

✅ Focused:

- Stack: NestJS, Drizzle, PostgreSQL
- Pattern: Repository for DB, DTOs for API
- Testing: Jest, required for new endpoints

Use Appropriate Models

TaskRecommended Model
Quick questionsHaiku
Standard featuresSonnet
Complex refactoringOpus

Haiku is ~10× cheaper than Sonnet for simple tasks.

Break Up Large Features

Instead of one massive ticket, create smaller focused tickets:

❌ One large ticket:
"Build complete user management system"

✅ Multiple focused tickets:

1. "Add user CRUD endpoints"
2. "Add user avatar upload"
3. "Add user role management"
4. "Add user invitation flow"

Monitoring Usage

Dashboard

View token usage in Settings → Usage:

  • Daily/weekly/monthly breakdowns
  • Per-agent consumption
  • Per-project consumption

Per-Run Details

Each agent run shows:

  • Input tokens used
  • Output tokens generated
  • Total cost
  • Model used

Cost Estimation

Before running a large task, estimate tokens:

  1. Count characters in your ticket + context
  2. Divide by 4 for approximate input tokens
  3. Estimate output as 20-50% of input
  4. Apply your tier multiplier