Back to Home
CLI Commands

gk tokens

Display token usage analysis for the current session

Overview

The gk tokens command displays token usage analysis for the current session, showing consumption breakdown and cost estimates.

Usage

bash
gk tokens [options]

Alias: gk t

Options

OptionDescription
--jsonOutput in JSON format

Output

Formatted Output (default)

Displays a styled box interface with:

Session Metadata:

  • Session ID
  • Start time
  • Duration
  • Models used
  • Message count

Token Breakdown:

  • Input tokens
  • Output tokens
  • Cached tokens
  • Thoughts tokens
  • Tool tokens

Cost Analysis:

  • Estimated cost for each token type
  • Total cost

Averages:

  • Tokens per message
  • Cost per message

JSON Output

Returns structured data:

json
{
  "sessionId": "abc123",
  "startTime": "2026-01-20T10:00:00Z",
  "duration": "5m 30s",
  "model": "gemini-2.5-flash",
  "modelsUsed": ["gemini-2.5-flash"],
  "messageCount": 15,
  "tokens": {
    "input": 12500,
    "output": 3200,
    "cached": 5000,
    "thoughts": 800,
    "tool": 1500
  },
  "averages": {
    "tokensPerMessage": 1533,
    "costPerMessage": 0.012
  },
  "cost": {
    "input": 0.10,
    "output": 0.08,
    "cached": 0.02,
    "thoughts": 0.01,
    "total": 0.21
  }
}

Examples

bash
# View token usage for current session
gk tokens

# Output as JSON
gk tokens --json

# Using alias
gk t
gk t --json

Token Types

TypeDescription
InputTokens sent to the model (context + prompt)
OutputTokens generated by the model
CachedPreviously cached tokens reused
ThoughtsTokens used for model reasoning
ToolTokens used for tool calls
Caught a mistake? Edit this page on GitHub
Updated: Jan 20, 2026