Skip to main content

A lightweight terminal client for OpenRouter's free AI models

Project description

KuroCode

KuroCode CLI is a Python-based terminal application that allows developers to access and interact with OpenRouter's free AI models directly from the command line. The goal is to provide a lightweight, fast, and developer-friendly alternative to web-based AI interfaces, enabling model discovery, interactive chatting, model switching, conversation history, and streaming responses entirely within the terminal.

Installation

KuroCode can be installed locally from the repository. We recommend using a virtual environment:

# Clone the repository
git clone <your-repo-url>
cd KuroCode

# Install dependencies and the package
pip install -e .

Configuration

Before you start, you must configure your OpenRouter API key. You can do this via an environment variable, a .env file, or by using the config command.

# Option 1: Using the config command (saved to ~/.config/kurocode/config.toml)
kurocode config set api_key "sk-or-v1-..."

# Option 2: Environment Variable
export KUROCODE_API_KEY="sk-or-v1-..."

You can view your current resolved configuration by running:

kurocode config list

User Guide & Command Surface

1. One-Shot Queries (ask)

For quick questions or scripting tasks, use the ask command. It is pipe-friendly and supports raw JSON outputs.

# Basic query (defaults to openai/gpt-4o-mini)
kurocode ask "Explain async/await in Python"

# Specify a different model
kurocode ask "What is the capital of France?" --model anthropic/claude-3-haiku

# Pipe friendly: Read from stdin
cat main.py | kurocode ask "Find the bug in this code"

# JSON output mode (ideal for jq)
kurocode --output-format json --no-stream ask "Explain async/await" | jq .content

2. Interactive REPL (chat)

Launch an interactive, persistent chat session powered by prompt_toolkit.

# Start a new chat session
kurocode chat

# Start a chat with a specific model
kurocode chat --model anthropic/claude-3-haiku

# Resume a previous conversation by ID
kurocode chat --resume <conversation_id>

Inside the Chat REPL:

  • Press Ctrl+C while the AI is responding to cleanly interrupt the stream. The partial response will be saved into history.
  • Press Ctrl+D or Ctrl+C at the prompt to exit the chat.
  • Use slash commands to control the session:
    • /help: Show available commands.
    • /switch <model_id> (or /model <model_id>): Switch the current model seamlessly.
    • /clear: Clear the session's context without exiting.
    • /save <filename>: Save the current session transcript to a markdown file.

3. Model Discovery (models)

Explore and search through the available free models on OpenRouter.

# List all free models (rendered as a rich table)
kurocode models list

# Force refresh the models cache from OpenRouter
kurocode models list --refresh

# Search for models by name or ID
kurocode models search "mistral"

# Get detailed information about a specific model
kurocode models info openai/gpt-4o-mini

4. Conversation History (history)

KuroCode persists your interactive conversations locally in an SQLite database (by default at ~/.local/share/kurocode/history.db).

# List recent conversations
kurocode history list --limit 20

# View the full transcript of a specific conversation
kurocode history view <conversation_id>

# Export a conversation to markdown
kurocode history export <conversation_id> --format markdown > transcript.md

5. Global Options

KuroCode supports several global flags that can be applied to the base kurocode command before the subcommand:

  • --profile <name>: Load a specific configuration profile from your TOML file.
    kurocode --profile work config list
    
  • --output-format <rich|plain|json>: Change the output rendering style.
    kurocode --output-format plain models list
    
  • --no-stream: Wait for the full response instead of streaming tokens (useful for scripting).
    kurocode --no-stream ask "Tell me a joke"
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kurocode_cli-0.1.0.tar.gz (28.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kurocode_cli-0.1.0-py3-none-any.whl (34.5 kB view details)

Uploaded Python 3

File details

Details for the file kurocode_cli-0.1.0.tar.gz.

File metadata

  • Download URL: kurocode_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 28.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kurocode_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 93ae7a100668788d9c0d7d2edfad053b0b1d8212c5b5a32d66acdbe965bbbd65
MD5 7893caf3d3d4f4940151e28dbf60a827
BLAKE2b-256 f2136e7a2a57f74c251c2a306eb682c7aada2e800d8d8e4fbbde44a95d95838b

See more details on using hashes here.

Provenance

The following attestation bundles were made for kurocode_cli-0.1.0.tar.gz:

Publisher: publish.yml on KuroCodexyz/kurocode-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kurocode_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: kurocode_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 34.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kurocode_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 742c1f65ee4464539577f6fa7274c583b7cf0befb48c5ba9f64a54da376a4c71
MD5 1fff6292eea2bc0d29e250bd3d33b374
BLAKE2b-256 9e0bc5535dd9cf23f4d8dc18f4a267852ec9cdb286ed533a38c7b37bb24b7708

See more details on using hashes here.

Provenance

The following attestation bundles were made for kurocode_cli-0.1.0-py3-none-any.whl:

Publisher: publish.yml on KuroCodexyz/kurocode-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page