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+Cwhile the AI is responding to cleanly interrupt the stream. The partial response will be saved into history. - Press
Ctrl+DorCtrl+Cat 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93ae7a100668788d9c0d7d2edfad053b0b1d8212c5b5a32d66acdbe965bbbd65
|
|
| MD5 |
7893caf3d3d4f4940151e28dbf60a827
|
|
| BLAKE2b-256 |
f2136e7a2a57f74c251c2a306eb682c7aada2e800d8d8e4fbbde44a95d95838b
|
Provenance
The following attestation bundles were made for kurocode_cli-0.1.0.tar.gz:
Publisher:
publish.yml on KuroCodexyz/kurocode-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kurocode_cli-0.1.0.tar.gz -
Subject digest:
93ae7a100668788d9c0d7d2edfad053b0b1d8212c5b5a32d66acdbe965bbbd65 - Sigstore transparency entry: 1823525840
- Sigstore integration time:
-
Permalink:
KuroCodexyz/kurocode-cli@d32c66a749c8e78d2d21cf3127e35ec9c48ddd65 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/KuroCodexyz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d32c66a749c8e78d2d21cf3127e35ec9c48ddd65 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
742c1f65ee4464539577f6fa7274c583b7cf0befb48c5ba9f64a54da376a4c71
|
|
| MD5 |
1fff6292eea2bc0d29e250bd3d33b374
|
|
| BLAKE2b-256 |
9e0bc5535dd9cf23f4d8dc18f4a267852ec9cdb286ed533a38c7b37bb24b7708
|
Provenance
The following attestation bundles were made for kurocode_cli-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on KuroCodexyz/kurocode-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kurocode_cli-0.1.0-py3-none-any.whl -
Subject digest:
742c1f65ee4464539577f6fa7274c583b7cf0befb48c5ba9f64a54da376a4c71 - Sigstore transparency entry: 1823525946
- Sigstore integration time:
-
Permalink:
KuroCodexyz/kurocode-cli@d32c66a749c8e78d2d21cf3127e35ec9c48ddd65 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/KuroCodexyz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d32c66a749c8e78d2d21cf3127e35ec9c48ddd65 -
Trigger Event:
push
-
Statement type: