MoonshotAI / MoonshotAI/kimi-cli

Feature Request: Add show_tps_meter config and /tps command for TPS display

Open
#1,760 0 comments 0 reactions 0 assignees View on GitHub

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:

  1. UI State Module (ui/tps_meter.py): Global getter/setter for the toggle state
  2. Config Field (config.py): show_tps_meter: bool = Field(default=False)
  3. Slash Command (ui/shell/slash.py): /tps on|off with persistence
  4. TPS Tracking (soul/kimisoul.py): Rolling 3-second window with CJK-aware token estimation
  5. 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.py for 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.