How to Get Help on a Specific kimi-cli Command: Complete Guide

Use the -h or --help flag after any kimi-cli command to display detailed usage information, options, and examples.

The kimi-cli tool from MoonshotAI provides built-in documentation for every command through its Typer-based architecture. Whether you need to understand global options or dive into a specific sub-command's parameters, the help system automatically generates usage guides from the source code. This guide explains how to access help for any command in the CLI hierarchy.

Accessing Help for Any Command

kimi-cli is built with Typer, which automatically creates help flags for the top-level CLI and every sub-command. In src/kimi_cli/cli/__init__.py, the cli instance explicitly enables both short and long help options through context_settings:

cli = typer.Typer(
    cls=LazySubcommandGroup,
    epilog=...,
    add_completion=False,
    context_settings={"help_option_names": ["-h", "--help"]},
    help="Kimi, your next CLI agent.",
)

Because of this global configuration, you can append -h or --help to any command regardless of nesting depth.

Top-Level vs. Command-Specific Help

To view available commands and global options, run:

kimi --help

# or

kimi -h

To get help on a specific command like login, append the help flag to that command:

kimi login --help
kimi login -h

This pattern works for all commands defined in the CLI, including those in submodules like src/kimi_cli/cli/plugin.py and src/kimi_cli/cli/mcp.py.

Practical Examples

Standard Commands

View help for the authentication command:

$ kimi login -h

Usage: kimi login [OPTIONS]

  Login to your Kimi account.

Options:
  --json      Emit OAuth events as JSON lines.  [default: False]
  -h, --help  Show this message and exit.

Advanced Usage Commands

For commands that accept extra arguments, such as term (which forwards unknown arguments), help still works normally:

kimi term --help

Even hidden or internal commands like __background-task-worker expose help:

kimi __background-task-worker --help

MCP and Plugin Commands

Commands defined in separate modules automatically inherit the help behavior. For example, the MCP server commands in src/kimi_cli/cli/mcp.py:

kimi mcp list --help
kimi mcp auth -h

How Help Text Is Generated

Typer constructs the help output dynamically from the Python source code. In src/kimi_cli/cli/__init__.py (lines 904-1007), commands are registered using the @cli.command decorator:

@cli.command()
def login(
    json_output: bool = typer.Option(False, "--json", help="Emit OAuth events as JSON lines.")
):
    """Login to your Kimi account."""
    ...

The help display includes:

  • Command description – extracted from the function's docstring
  • Options – rendered from typer.Option declarations with flags, defaults, and help text
  • Arguments – positional parameters with type hints
  • Usage examples – embedded in docstrings or README documentation

This auto-generation ensures that help content stays synchronized with the actual implementation in src/kimi_cli/cli/__init__.py and related modules.

Summary

  • Universal flags: Every command accepts -h and --help due to global context_settings in the Typer configuration.
  • Hierarchical access: Append the help flag to any command path (e.g., kimi login --help) to see specific documentation.
  • Auto-generated content: Help text derives from function docstrings and Typer option definitions in src/kimi_cli/cli/__init__.py.
  • Consistent interface: The help system works identically for standard commands, plugin commands, and hidden internal utilities.

Frequently Asked Questions

How do I get help for the kimi-cli login command?

Run kimi login --help or kimi login -h. The output displays the command's purpose ("Login to your Kimi account"), available options like --json, and the standard help flag. This information is generated from the login function definition in src/kimi_cli/cli/__init__.py.

Can I use -h instead of --help for all commands?

Yes. The kimi-cli explicitly configures context_settings={"help_option_names": ["-h", "--help"]} in the main Typer instance, making both forms available for every command and sub-command throughout the application.

Why does kimi-cli use Typer for help generation?

Typer automatically converts Python type hints and docstrings into formatted CLI documentation. This ensures that when developers add new commands in files like src/kimi_cli/cli/plugin.py or src/kimi_cli/cli/mcp.py, the help text updates automatically without manual maintenance.

How do I view help for hidden or internal commands?

Even hidden commands such as __background-task-worker expose help via the standard flags. Simply run kimi __background-task-worker --help to view their documentation, as the Typer framework applies help options universally across all registered commands.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →