Metadata-Version: 2.5
Name: kunji
Version: 0.1.4
Summary: Bring your own key. Every AI model in one clean, professional terminal.
Project-URL: Homepage, https://github.com/testwithsuraj/kunji
Project-URL: Issues, https://github.com/testwithsuraj/kunji/issues
Project-URL: Changelog, https://github.com/testwithsuraj/kunji/blob/main/CHANGELOG.md
Author: Kunji contributors
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: ai,anthropic,byok,cli,gemini,llm,ollama,openai,terminal
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Utilities
Requires-Python: >=3.11
Requires-Dist: cryptography>=42
Requires-Dist: httpx>=0.27
Requires-Dist: keyring>=25
Requires-Dist: platformdirs>=4
Requires-Dist: prompt-toolkit>=3.0.43
Requires-Dist: pyperclip
Requires-Dist: questionary>=2.0
Requires-Dist: rich>=13.7
Requires-Dist: tomli-w>=1.0
Requires-Dist: typer>=0.12
Provides-Extra: dev
Requires-Dist: pyinstaller>=6; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Description-Content-Type: text/markdown

<div align="center">

# kunji (कुंजी)

**Every AI model in one terminal, with your own keys. See what every answer costs.**

```bash
curl -fsSL https://kunji.iamsuraj.me/install.sh | sh
```

Windows: `irm https://kunji.iamsuraj.me/install.ps1 | iex`

[![PyPI](https://img.shields.io/pypi/v/kunji?style=flat-square&labelColor=1f2328&color=2563eb)](https://pypi.org/project/kunji/)
[![Downloads](https://img.shields.io/pepy/dt/kunji?style=flat-square&label=Downloads&labelColor=1f2328&color=2563eb)](https://pepy.tech/projects/kunji)
[![CI](https://img.shields.io/github/actions/workflow/status/testwithsuraj/kunji/ci.yml?branch=main&style=flat-square&label=CI&labelColor=1f2328&color=2563eb)](https://github.com/testwithsuraj/kunji/actions/workflows/ci.yml)
[![License](https://img.shields.io/badge/license-Apache--2.0-2563eb?style=flat-square&labelColor=1f2328)](LICENSE)
[![Python](https://img.shields.io/badge/python-3.11%2B-2563eb?style=flat-square&labelColor=1f2328&logo=python&logoColor=white)](https://www.python.org/downloads/)
[![Providers](https://img.shields.io/badge/providers-10%2B-2563eb?style=flat-square&labelColor=1f2328)](#providers)
[![Platforms](https://img.shields.io/badge/windows%20%7C%20macos%20%7C%20linux-2563eb?style=flat-square&labelColor=1f2328&label=runs%20on)](#install)

<!-- Demo GIF hidden for now. Remove this comment wrapper to show it again.
<img src="https://raw.githubusercontent.com/testwithsuraj/kunji/main/assets/demo.gif" alt="kunji demo: the menu, a chat with Claude, switching to Groq mid-conversation with /model, and /cost" width="860">
-->

[Website](https://kunji.iamsuraj.me/) · [Documentation](https://kunji.iamsuraj.me/docs/) · [Install](#install) · [Commands](#commands) · *Kunji (कुंजी) means "key" in Hindi.*

</div>

Kunji is a terminal app for chatting with any AI model using **your own API keys**.
You pay each provider directly. Kunji never sees your bill, your keys or your prompts.

## Why kunji

- **One tool, every provider.** OpenAI, Anthropic, Google Gemini, Groq, OpenRouter,
  DeepSeek, Mistral, xAI, Together, Ollama (local), plus any OpenAI-compatible server.
- **Switch models mid-conversation** with `/model` — the conversation carries over.
- **Live cost meter.** Every reply shows tokens and cost. `/cost` and `kunji usage`
  show totals, in your currency.
- **Daily budgets.** Warns at 80%, blocks at 100%, per provider or overall.
- **Compare mode.** One prompt, several models, side by side — fastest and cheapest highlighted.
- **Automatic fallback.** Rate-limited or down? Kunji retries on your next model.
- **Keys in your OS keychain** (Windows Credential Manager, macOS Keychain, Secret Service),
  never in a plain-text file.
- **Pipes.** `npm test 2>&1 | kunji ask "why is this failing?"`
- **Saved prompts.** `kunji @commit` writes a commit message from your staged changes;
  `@explain`, `@review`, `@fix`, `@summarize`, `@translate`, `@tests` — or make your own.
- **Chat history.** Every chat is saved on your computer. Continue with `kunji chat -c`,
  search with `kunji history search`.
- **Attach files.** `/file app.py` in chat, or `kunji ask -f app.py "what does this do?"`.
- **Menu or commands.** Run `kunji` for an arrow-key menu that stays open until you exit;
  every action is also a command for scripts.
- **Looks professional.** Minimal monochrome design, responsive to any terminal size.

<!-- Demo clips hidden for now. Remove this comment wrapper to show them again.
<table>
<tr>
<td><img src="https://raw.githubusercontent.com/testwithsuraj/kunji/main/assets/compare.gif" alt="kunji compare: one prompt, three models, fastest and cheapest marked"><br><sub><b>Compare</b>: one prompt, several models</sub></td>
</tr>
</table>

<sub>Demos are recordings of the real CLI; answers come from a local mock server
(<code>scripts/demo/</code>), so no keys or money were used.</sub>
-->

## Install

One command. No Python needed, and `kunji` works in any folder afterwards.

**macOS / Linux**

```bash
curl -fsSL https://kunji.iamsuraj.me/install.sh | sh
```

**Windows** (PowerShell)

```powershell
irm https://kunji.iamsuraj.me/install.ps1 | iex
```

From Command Prompt instead:
`powershell -ExecutionPolicy ByPass -c "irm https://kunji.iamsuraj.me/install.ps1 | iex"`

The installer uses [uv](https://docs.astral.sh/uv/) to install kunji (and Python 3.11+ if you
don't have it) in its own folder, and adds `kunji` to your PATH. Open a new terminal and run
`kunji`. Update with `kunji upgrade`; uninstall with `uv tool uninstall kunji`.

<details>
<summary>Other ways: pip, pipx, uv, single file</summary>

| Method | Command |
| --- | --- |
| uv | `uv tool install kunji` |
| pipx | `pipx install kunji` |
| pip (Python 3.11+) | `python -m pip install kunji` (Windows: `py -m pip install kunji`) |
| Single file, no install | `kunji-windows-x64.exe` or `kunji-linux-x64` from the [latest release](https://github.com/testwithsuraj/kunji/releases/latest) |

With pip, if `kunji` isn't found afterwards ("not recognized" / "command not found"), pip put
it in a folder that isn't on your PATH. `python -m kunji` always works, or use the installer
above. The command is lowercase: `kunji`.

</details>

`winget`, Scoop and Homebrew packages are on the [roadmap](ROADMAP.md).

## Quick start

```bash
kunji                     # opens the menu: add a provider, then start a chat
```

Prefer commands? `kunji keys add`, then `kunji chat`.

Free and local? Install [Ollama](https://ollama.com), then `kunji keys add ollama`.

## Commands

| Command | What it does |
| --- | --- |
| `kunji` | Interactive menu (stays open until you choose Exit) |
| `kunji chat` | Chat (`-m provider:model`, `-s "system prompt"`, `-c` continue last, `--resume <id>`) |
| `kunji ask "…"` | One-shot answer. Reads piped input. `-f file` to attach, `--raw` for scripts |
| `kunji @name "…"` | Run a saved prompt, e.g. `kunji @commit`, `git diff \| kunji @review` |
| `kunji prompts` | List prompts; `add`, `edit`, `show`, `remove` your own |
| `kunji history` | Saved chats; `search`, `show`, `export`, `delete` |
| `kunji compare "…" -m a -m b` | Same prompt to several models, side by side |
| `kunji keys add [provider]` | Add or replace a key (verified, then saved to the keychain) |
| `kunji keys list` / `test` / `remove` | Manage keys (always masked) |
| `kunji models [provider]` | Live model list with prices |
| `kunji use provider:model` | Set your default model |
| `kunji providers` | Supported providers; `providers add` for custom servers |
| `kunji usage` | Tokens and cost per model (stored locally only) |
| `kunji budget set <provider\|all> <amount>` | Daily spending limit |
| `kunji config show` / `set` / `path` | Settings |
| `kunji doctor` | Check Python, config, keychain and providers |

### In chat

| Input | Action |
| --- | --- |
| `/help` | Show commands and shortcuts |
| `/model provider:model` | Switch model (tab completes) |
| `/models [filter]` | List models of the current provider |
| `/cost` | Session and today's cost |
| `/file path` | Attach a text file to your next message (tab completes paths) |
| `@name text` | Use a saved prompt, e.g. `@explain this error` |
| `/prompts` · `/history` | List saved prompts · recent chats |
| `/system …` | Set the system prompt |
| `/retry` · `/new` / `/clear` · `/save [file]` | Regenerate · new conversation · export markdown |
| `/copy` | Copy the latest assistant response to the clipboard |
| `/exit` · `/quit` · `/q` | Leave the chat |
| `enter` · `alt+enter` / `ctrl+j` | Send · new line |
| `ctrl+c` · `ctrl+d` | Stop the reply · quit |

## Providers

| ID | Provider | Key env variable |
| --- | --- | --- |
| `openai` | OpenAI | `OPENAI_API_KEY` |
| `anthropic` | Anthropic | `ANTHROPIC_API_KEY` |
| `gemini` | Google Gemini | `GEMINI_API_KEY` / `GOOGLE_API_KEY` |
| `groq` | Groq | `GROQ_API_KEY` |
| `openrouter` | OpenRouter | `OPENROUTER_API_KEY` |
| `deepseek` | DeepSeek | `DEEPSEEK_API_KEY` |
| `mistral` | Mistral | `MISTRAL_API_KEY` |
| `xai` | xAI | `XAI_API_KEY` |
| `together` | Together AI | `TOGETHER_API_KEY` |
| `ollama` | Ollama (local) | none |

Any OpenAI-compatible server (LM Studio, vLLM, LiteLLM proxy…):

```bash
kunji providers add lmstudio --base-url http://localhost:1234/v1 --no-key
```

## Security and privacy

- API keys are stored **only** in your operating system's credential store, or read from
  environment variables. They are sent **only** to the provider they belong to.
- Kunji's config file never contains keys. Errors are scrubbed so keys never appear on screen.
- Usage and cost history stay on your machine (`kunji config path`).
- Network calls kunji makes on its own: the public model price list (OpenRouter, plus this
  repo's `catalog/pricing.json`) and the PyPI version check. Neither sends anything about you.
  Turn them off with `kunji config set network.catalog false` and
  `kunji config set updates.check false`.
- Found a vulnerability? Please follow [SECURITY.md](SECURITY.md).

Details: [docs/PRIVACY.md](docs/PRIVACY.md).

## Configuration

```bash
kunji config set display.currency INR
kunji config set display.usd_rate 84          # your conversion rate
kunji budget set all 200                      # ₹200/day across every provider
kunji config set fallback '["groq:llama-3.3-70b-versatile", "ollama:qwen2.5"]'
```

All options: [docs/CONFIG.md](docs/CONFIG.md). Every command with examples: [docs/COMMANDS.md](docs/COMMANDS.md). Full documentation: **[kunji.iamsuraj.me/docs](https://kunji.iamsuraj.me/docs/)**.

## Free and Pro

Everything that runs on your machine is **free and open source, forever** — chat,
switching, keys, cost meter, budgets, compare, fallback, pipes. A future optional
**Pro** plan will add cloud features that need a server (sync across devices, shared team
keys with per-person budgets, a smart router). See [ROADMAP.md](ROADMAP.md).

## Contributing

Bug reports, ideas and pull requests are welcome — start with
[CONTRIBUTING.md](CONTRIBUTING.md). Architecture overview: [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md).

## Contributors

Thanks to everyone who has helped build kunji ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
  <tbody>
    <tr>
      <td align="center" valign="top" width="14.28%"><a href="https://github.com/testwithsuraj"><img src="https://github.com/testwithsuraj.png?size=100" width="100px;" alt="testwithsuraj"/><br /><sub><b>Suraj</b></sub></a><br /><a href="https://github.com/testwithsuraj/kunji/commits?author=testwithsuraj" title="Code">💻</a> <a href="#maintenance-testwithsuraj" title="Maintenance">🚧</a></td>
      <td align="center" valign="top" width="14.28%"><a href="https://github.com/imanr236"><img src="https://avatars.githubusercontent.com/u/66421964?v=4?s=100" width="100px;" alt="Iman Rashidi"/><br /><sub><b>Iman Rashidi</b></sub></a><br /><a href="#data-imanr236" title="Data">🔣</a> <a href="https://github.com/testwithsuraj/kunji/commits?author=imanr236" title="Tests">⚠️</a></td>
      <td align="center" valign="top" width="14.28%"><a href="https://github.com/cascade80"><img src="https://avatars.githubusercontent.com/u/191756690?v=4?s=100" width="100px;" alt="Ayush"/><br /><sub><b>Ayush</b></sub></a><br /><a href="https://github.com/testwithsuraj/kunji/commits?author=cascade80" title="Code">💻</a> <a href="https://github.com/testwithsuraj/kunji/commits?author=cascade80" title="Tests">⚠️</a></td>
      <td align="center" valign="top" width="14.28%"><a href="https://github.com/AlbertSabirzianov"><img src="https://github.com/AlbertSabirzianov.png?size=100" width="100px;" alt="AlbertSabirzianov"/><br /><sub><b>Albert Sabirzianov</b></sub></a><br /><a href="https://github.com/testwithsuraj/kunji/commits?author=AlbertSabirzianov" title="Code">💻</a> <a href="https://github.com/testwithsuraj/kunji/commits?author=AlbertSabirzianov" title="Tests">⚠️</a> <a href="https://github.com/testwithsuraj/kunji/commits?author=AlbertSabirzianov" title="Documentation">📖</a></td>
      <td align="center" valign="top" width="14.28%"><a href="https://github.com/HarshRajSinghania"><img src="https://github.com/HarshRajSinghania.png?size=100" width="100px;" alt="Harsh Raj Singhania"/><br /><sub><b>Harsh Raj Singhania</b></sub></a><br /><a href="https://github.com/testwithsuraj/kunji/commits?author=HarshRajSinghania" title="Documentation">📖</a></td>
      <td align="center" valign="top" width="14.28%"><a href="https://github.com/tushar22199"><img src="https://github.com/tushar22199.png?size=100" width="100px;" alt="tushar22199"/><br /><sub><b>Tushar</b></sub></a><br /><a href="https://github.com/testwithsuraj/kunji/commits?author=tushar22199" title="Code">💻</a></td>
    </tr>
  </tbody>
</table>

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://allcontributors.org) specification.
Contributions of any kind are welcome!

## License

[Apache-2.0](LICENSE). "kunji" and the kunji logo are not covered by the license; please
use a different name for forks.
