ccusage

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package ccusage provides integration with ccusage CLI tool for token usage tracking.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatCost

func FormatCost(cost float64) string

FormatCost formats the cost as a string for display

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client provides methods to interact with ccusage CLI

func NewClient

func NewClient() *Client

NewClient creates a new ccusage client

func (*Client) GetTodayUsage

func (c *Client) GetTodayUsage(ctx context.Context) Usage

GetTodayUsage retrieves today's usage from ccusage Returns empty Usage with Available=false if ccusage is not installed or fails

type DailyUsage

type DailyUsage struct {
	Date      string  `json:"date"`
	TotalCost float64 `json:"totalCost"`
}

DailyUsage represents a single day's usage from ccusage JSON output

type Usage

type Usage struct {
	TodayCost float64 // Today's cost in USD
	Available bool    // Whether ccusage is available
}

Usage represents the usage data from ccusage

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL