Fast, cross-platform, real-time token usage tracker and cost monitor for Gemini CLI / Claude Code / Codex CLI / Qwen Code / Cline / Roo Code / Kilo Code / GitHub Copilot / OpenCode / Pi Agent / Piebald.
git clone https://github.com/Piebald-AI/splitrail.gitFast, cross-platform, real-time token usage tracker and cost monitor for Gemini CLI / Claude Code / Codex CLI / Qwen Code / Cline / Roo Code / Kilo Code / GitHub Copilot / OpenCode / Pi Agent / Piebald.
[{"step":"Install and Configure SplitRail","action":"Run `npm install -g splitrail` or use the provided binary for your OS. Authenticate with your AI tool APIs (e.g., `splitrail auth --gemini` for Gemini CLI).","tip":"Ensure you have API keys for all tools you want to track. SplitRail supports most major AI coding tools out of the box."},{"step":"Start Real-Time Monitoring","action":"Run `splitrail monitor --interval 5m` to track token usage in real-time. Add `--budget 50` to set a daily budget alert for all tools combined.","tip":"Use `--tools claude,gcpilot` to monitor specific tools. The interval can be adjusted (e.g., `--interval 1m` for high-frequency tracking)."},{"step":"Generate Reports for Analysis","action":"Run `splitrail report --period 7d --format json` to get a detailed breakdown of token usage and costs. Use `--output report.json` to save the file.","tip":"For comparisons, run reports for different time periods (e.g., `splitrail report --period 30d`). Use `--group-by tool` to see per-tool breakdowns."},{"step":"Set Up Automated Alerts","action":"Configure alerts with `splitrail alert --tool claude --threshold 10000 --action notify` to get Slack/email alerts when a tool exceeds 10,000 tokens in a session.","tip":"Use `--action log` to log alerts to a file for auditing. Combine with `--daily-summary` to get a daily recap of your usage."},{"step":"Optimize Based on Insights","action":"Use the recommendations from the report (e.g., trim verbose prompts, switch tools) and re-run monitoring to measure the impact of your changes.","tip":"Track changes over time by saving reports with timestamps (e.g., `splitrail report --period 7d --output 2024-05-20_report.json`)."}]
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/Piebald-AI/splitrailCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Track and analyze my token usage and costs across [LIST_OF_TOOLS: e.g., Gemini CLI, Claude Code, GitHub Copilot] in real-time. Show me a breakdown of total tokens used, cost per tool, and trends over the past [TIME_PERIOD: e.g., 7 days, 30 days]. Flag any tools exceeding my budget or showing unusual spikes in usage. Provide actionable recommendations to optimize costs, such as reducing verbose prompts or switching to more cost-effective models.
### Token Usage & Cost Report (Last 7 Days) | Tool | Total Tokens | Cost (USD) | Avg Cost/1K Tokens | % of Total Cost | |-----------------|--------------|------------|--------------------|-----------------| | **Claude Code** | 425,000 | $12.75 | $0.030 | 45% | | **GitHub Copilot** | 380,000 | $7.60 | $0.020 | 27% | | **Gemini CLI** | 290,000 | $5.80 | $0.020 | 21% | | **Qwen Code** | 150,000 | $1.50 | $0.010 | 5% | | **OpenCode** | 55,000 | $0.55 | $0.010 | 2% | **Total** | **1,300,000**| **$28.20** | - | **100%** | #### Key Insights: 1. **Claude Code** is your highest-cost tool, contributing 45% of total spend despite having a mid-tier cost per 1K tokens ($0.030). This suggests high usage volume—likely due to long sessions or verbose prompts. 2. **GitHub Copilot** and **Gemini CLI** have identical cost-per-token rates ($0.020), but Copilot’s higher token count makes it the second-largest cost driver. Consider reviewing your Copilot usage for repetitive or low-value tasks. 3. **Qwen Code** and **OpenCode** are your most cost-effective options ($0.010/1K tokens). If you’re using them for critical tasks, consider migrating more workflows to these tools. #### Cost Optimization Recommendations: - **Reduce verbose prompts** in Claude Code: Your average prompt length is ~1,200 tokens, which is 3x the recommended length for most tasks. Try trimming instructions or using bullet points. - **Switch to Qwen/OpenCode for code reviews**: Replace 30% of your Copilot code reviews with Qwen Code, which offers identical functionality at half the cost. - **Set budget alerts**: Configure SplitRail to notify you when any tool exceeds $10/day or $100/month. #### Anomaly Detection: - **Spike Alert (Gemini CLI)**: On 2024-05-15, you used 18,000 tokens in a single session—5x your daily average. This was likely due to a large file upload or debugging session. Review the session logs to identify if this was a one-time task or a recurring inefficiency. Next Steps: 1. Run `splitrail analyze --tool claude --period 30d` to see if this trend continues over a longer period. 2. Export this report to CSV using `splitrail export --format csv` and share it with your team to align on tool usage policies. 3. Schedule a 15-minute review with your team to discuss the recommendations above.
Automate invoicing and financial reporting for streamlined business management.
AI assistant built for thoughtful, nuanced conversation
Manage feature flags and A/B tests while gaining real-time insights on product performance.
Google's multimodal AI model and assistant
Let’s build from here, together
Identity and access management for agents
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan