MoonshotAI / MoonshotAI/kimi-cli
Feature Request: Add show_tps_meter config and /tps command for TPS display
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 11.4k
- Forks
- 1.3k
- Avg merge
- 9h 47m
- Merged PRs (30d)
- 2
Description
Summary
Add ability to display tokens-per-second (TPS) meter in the status bar during LLM streaming via config option and slash command.
PR is https://github.com/MoonshotAI/kimi-cli/pull/1759
Motivation
Currently, users have no visibility into how fast tokens are being streamed. This feature helps users:
- Monitor streaming performance in real-time
- Understand when the model is actively generating vs idle
- Compare speeds across different models/providers
- It's cool to see. - inspired by This Extension of Opencode
Proposed Solution
Config Option
In ~/.kimi/config.toml:
show_tps_meter = true # Default: false
Slash Command
In kimi shell:
/tps on # Enable TPS meter
/tps off # Disable TPS meter
/tps # Show current status
Behavior
| Scenario | TPS Display |
|---|---|
show_tps_meter = false (default) |
Hidden |
show_tps_meter = true, streaming |
Shows "· 85.3 tok/s" in status bar |
show_tps_meter = true, not streaming |
Hidden (no tokens flowing) |
/tps on during session |
Enables immediately, persists to config |
/tps off during session |
Disables immediately, persists to config |
Implementation Approach
The implementation mirrors the existing theme pattern for global UI state:
- UI State Module (
ui/tps_meter.py): Global getter/setter for the toggle state - Config Field (
config.py):show_tps_meter: bool = Field(default=False) - Slash Command (
ui/shell/slash.py):/tps on|offwith persistence - TPS Tracking (
soul/kimisoul.py): Rolling 3-second window with CJK-aware token estimation - Display Integration (
visualize.py,prompt.py): Conditional display in status bar and bottom toolbar
Technical Details
- Rolling Window: 3-second sliding window for TPS calculation (configurable)
- Token Estimation: CJK-aware heuristic (1.5 tokens per CJK char, 0.25 per ASCII char)
- Performance: Zero overhead when disabled (short-circuit evaluation)
- Pattern: Mirrors
theme.pyfor consistency with existing codebase conventions
Checklist
- CLI slash command (
/tps) - Config option (
show_tps_meter) - Proper precedence logic (runtime toggle > config > default)
- Session persistence (config saved on toggle)
- Unit tests (19 tests covering calculation, state, slash command, display)
- Type checking passes (pyright)
- Linting passes (ruff)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The proposed work spans ui/tps_meter.py, config.py, ui/shell/slash.py, soul/kimisoul.py, visualize.py, and prompt.py, with 19 tests mentioned. Review pull request #1759 first to understand the implementation status; the issue is complete or already under way rather than a fresh contribution opportunity.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 20/100