Claude Code
What
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.
Sample Configuration
- json
- yaml
- toml
{
"type": "claude",
"style": "diamond",
"leading_diamond": "",
"trailing_diamond": "",
"foreground": "#FFFFFF",
"background": "#FF6B35",
"template": " {{ .Model.DisplayName }} {{ .TokenUsagePercent.Gauge }} "
}
type: claude
style: diamond
leading_diamond:
trailing_diamond:
foreground: "#FFFFFF"
background: "#FF6B35"
template: " {{ .Model.DisplayName }} {{ .TokenUsagePercent.Gauge }} "
type = "claude"
style = "diamond"
leading_diamond = ""
trailing_diamond = ""
foreground = "#FFFFFF"
background = "#FF6B35"
template = " {{ .Model.DisplayName }} {{ .TokenUsagePercent.Gauge }} "
Template (info)
default template
\udb82\udfc9 {{ .Model.DisplayName }} \uf2d0 {{ .TokenUsagePercent.Gauge }}
Properties
| 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) |
.FormattedCost | string | Formatted cost string (e.g., "$0.15" or "$0.0012") |
.FormattedTokens | string | Human-readable token count (e.g., "1.2K", "15.3M") |
Model Properties
| Name | Type | Description |
|---|---|---|
.ID | string | Technical model identifier |
.DisplayName | string | Human-readable model name (e.g., "Claude 3.5 Sonnet") |
Workspace Properties
| Name | Type | Description |
|---|---|---|
.CurrentDir | string | Current working directory |
.ProjectDir | string | Root project directory |
Cost Properties
| Name | Type | Description |
|---|---|---|
.TotalCostUSD | float64 | Total cost in USD |
.TotalDurationMS | int64 | Total session duration in milliseconds |
ContextWindow Properties
| 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 |
CurrentUsage Properties
| Name | Type | Description |
|---|---|---|
.InputTokens | int | Input tokens for the current message |
.OutputTokens | int | Output tokens for the current message |
Percentage Methods
The TokenUsagePercent property is a Percentage type that provides additional functionality:
| Method | Returns | Description |
|---|---|---|
.Gauge | string | Visual gauge showing remaining capacity using 5 bar blocks (▰▰▰▰▱) |
.String | string | Numeric percentage value (e.g., "75" for use in templates) |
How it works
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:
- Current AI model information
- Token usage and context window utilization
- Session costs and duration
- Workspace directory information
The segment only displays when Claude Code is actively providing session data.