Skip to main content

GitHub Copilot

What

Display your GitHub Copilot usage statistics and quota information including premium interactions, inline completions, and chat usage. This segment was inspired by Elio Struyf's GitHub Copilot Usage Tauri application.

Sample Configuration

{
"type": "copilot",
"style": "diamond",
"leading_diamond": "",
"trailing_diamond": "",
"foreground": "#111111",
"background": "#fee898",
"template": "  {{ .Premium.Percent.Gauge }} ",
"cache": {
"duration": "5m",
"strategy": "session"
},
"properties": {
"http_timeout": 1000
}
}

Properties

NameTypeDescriptionDefault
http_timeoutintThe default timeout for HTTP requests in milliseconds20

Template (info)

default template
 \uec1e {{ .Premium.Percent.Gauge }}

Properties

NameTypeDescription
.PremiumCopilotUsagePremium interactions usage data
.Premium.UsedintNumber of premium interactions used
.Premium.LimitintTotal premium interactions available
.Premium.PercentCopilotPercentagePercentage of premium quota used (0-100)
.Premium.RemainingCopilotPercentagePercentage of premium quota remaining (0-100)
.Premium.UnlimitedboolWhether premium quota is unlimited
.InlineCopilotUsageInline completions usage data
.Inline.UsedintNumber of inline completions used
.Inline.LimitintTotal inline completions available
.Inline.PercentCopilotPercentagePercentage of inline quota used (0-100)
.Inline.RemainingCopilotPercentagePercentage of inline quota remaining (0-100)
.Inline.UnlimitedboolWhether inline quota is unlimited
.ChatCopilotUsageChat usage data
.Chat.UsedintNumber of chat interactions used
.Chat.LimitintTotal chat interactions available
.Chat.PercentCopilotPercentagePercentage of chat quota used (0-100)
.Chat.RemainingCopilotPercentagePercentage of chat quota remaining (0-100)
.Chat.UnlimitedboolWhether chat quota is unlimited
.BillingCycleEndstringEnd date of current billing cycle

CopilotPercentage Methods

The CopilotPercentage type provides additional functionality beyond just the numeric value:

MethodReturnsDescription
.Gauge()stringVisual gauge showing remaining capacity using 5 bar blocks (▰▰▰▰▱)
.String()stringNumeric percentage value (e.g., "75" for use in templates)

Example gauge visualization (shows remaining capacity):

  • 0% used (100% remaining): ▰▰▰▰▰
  • 20% used (80% remaining): ▰▰▰▰▱
  • 40% used (60% remaining): ▰▰▰▱▱
  • 60% used (40% remaining): ▰▰▱▱▱
  • 80% used (20% remaining): ▰▱▱▱▱
  • 100% used (0% remaining): ▱▱▱▱▱

Example template with gauge:

"template": "{{ .Premium.Percent.Gauge() }} {{ .Premium.Used }}/{{ .Premium.Limit }}"

Authentication

This segment requires authentication with GitHub to access Copilot usage data. Use the built-in OAuth device code flow:

oh-my-posh auth copilot

This will:

  1. Display a device code and verification URL
  2. Open your browser to GitHub's authorization page
  3. Prompt you to enter the device code
  4. Store the access token securely for future use

The token is stored securely and will be used automatically by the segment.