website/docs/segments/cli/claude.mdx
Display Claude Code session information including the current AI model, token usage, costs, and workspace details. Shows a visual gauge of context window usage and formatted cost/token information for monitoring your Claude usage.
This segment integrates with Claude Code's statusline functionality to provide real-time session data in your prompt.
import Config from "@site/src/components/Config.js";
<Config data={{ type: "claude", style: "diamond", leading_diamond: "\ue0b6", trailing_diamond: "\ue0b4", foreground: "#FFFFFF", background: "#FF6B35", template: " \udb82\udfc9 {{ .Model.DisplayName }} \uf2d0 {{ .TokenGauge }} ", }} />
:::note default template
\udb82\udfc9 {{ .Model.DisplayName }} \uf2d0 {{ .TokenGauge }}
:::
| Name | Type | Default | Description |
|---|---|---|---|
gauge_marked_char | string | ▰ | Character used for filled blocks in gauge visualizations |
gauge_unmarked_char | string | ▱ | Character used for empty blocks in gauge visualizations |
| Name | Type | Description |
|---|---|---|
.SessionID | string | Unique identifier for the Claude session |
.Model | Model | AI model information |
.Workspace | Workspace | Workspace directory information |
.Cost | Cost | Cost and duration information |
.ContextWindow | ContextWindow | Token usage information |
.TokenUsagePercent | Percentage | Percentage of context window used (0-100) |
.TokenGauge | string | Gauge showing remaining context capacity using configured characters (e.g., ▰▰▰▱▱) |
.TokenGaugeUsed | string | Gauge showing used context capacity using configured characters (e.g., ▰▰▱▱▱) |
.FiveHourGauge | string | Gauge showing 5-hour rate limit usage using configured characters |
.SevenDayGauge | string | Gauge showing 7-day rate limit usage using configured characters |
.FiveHourResetsAt | time.Time | 5-hour rate limit window reset time |
.SevenDayResetsAt | time.Time | 7-day rate limit window reset time |
.FiveHourResetsIn | time.Duration | time until 5-hour resets; 0=unavailable, neg=past |
.SevenDayResetsIn | time.Duration | time until 7-day resets; 0=unavailable, neg=past |
.FormattedCost | string | Formatted cost string (e.g., "$0.15" or "$0.0012") |
.FormattedTokens | string | Human-readable token count (e.g., "1.2K", "15.3M") |
.FormattedDuration | string | Total session duration (e.g., "2m 5s") |
.FormattedAPIDuration | string | API wait time (e.g., "0m 45s") |
.FiveHourUsage | Percentage | 5-hour rolling rate limit usage (0-100) |
.SevenDayUsage | Percentage | 7-day rate limit usage (0-100) |
| Name | Type | Description |
|---|---|---|
.ID | string | Technical model identifier |
.DisplayName | string | Human-readable model name (e.g., "Claude 3.5 Sonnet") |
| Name | Type | Description |
|---|---|---|
.CurrentDir | string | Current working directory |
.ProjectDir | string | Root project directory |
.GitWorktree | string | Path to the linked git worktree, empty when not inside a linked git worktree |
| Name | Type | Description |
|---|---|---|
.TotalCostUSD | float64 | Total cost in USD |
.TotalDurationMS | DurationMS | Total session duration in milliseconds (formats as "Xm Ys") |
.TotalAPIDurationMS | DurationMS | Time spent waiting for API responses (formats as "Xm Ys") |
.TotalLinesAdded | int | Lines of code added in the session |
.TotalLinesRemoved | int | Lines of code removed in the session |
| Name | Type | Description |
|---|---|---|
.TotalInputTokens | int | Total input tokens used in the session |
.TotalOutputTokens | int | Total output tokens generated in the session |
.ContextWindowSize | int | Maximum context window size for the model |
.CurrentUsage | CurrentUsage | Current message token usage |
| Name | Type | Description |
|---|---|---|
.InputTokens | int | Input tokens for the current message |
.OutputTokens | int | Output tokens for the current message |
Available when Claude Code provides rate limit data (Pro/Max subscribers). Access via .RateLimits.
| Name | Type | Description |
|---|---|---|
.FiveHour | RateLimitWindow | 5-hour rolling window |
.SevenDay | RateLimitWindow | 7-day rolling window |
| Name | Type | Description |
|---|---|---|
.UsedPercentage | *float64 | Usage percentage (0-100), nil if unknown |
.ResetsAt | *int64 | Unix epoch seconds when window resets |
The Percentage type (returned by .TokenUsagePercent, .FiveHourUsage, .SevenDayUsage)
provides additional methods for direct use in templates:
| Method | Returns | Description |
|---|---|---|
.Gauge | string | Visual gauge showing remaining capacity using hardcoded ▰/▱ characters |
.GaugeUsed | string | Visual gauge showing used capacity using hardcoded ▰/▱ characters |
.String | string | Numeric percentage value (e.g., "75" for use in templates) |
:::tip Custom gauge characters
Use .TokenGauge, .TokenGaugeUsed, .FiveHourGauge, and .SevenDayGauge instead of the
raw .Percentage methods above — they respect the gauge_marked_char and gauge_unmarked_char options.
:::
The segment reads session information from the POSH_CLAUDE_STATUS environment variable, which is automatically set when using the oh-my-posh claude command. The data includes:
The segment only displays when Claude Code is actively providing session data.