kunji 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
kunji-0.1.0/.gitignore ADDED
@@ -0,0 +1,27 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ .venv/
6
+ venv/
7
+ build/
8
+ dist/
9
+ *.spec.bak
10
+ .pytest_cache/
11
+ .ruff_cache/
12
+ .coverage
13
+ htmlcov/
14
+
15
+ # Editors / OS
16
+ .vscode/
17
+ .idea/
18
+ .DS_Store
19
+ Thumbs.db
20
+
21
+ # Secrets — never commit these
22
+ .env
23
+ .env.*
24
+ *.pem
25
+ *.key
26
+ secrets/
27
+ kunji-chat-*.md
@@ -0,0 +1,37 @@
1
+ # Changelog
2
+
3
+ All notable changes are listed here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses
5
+ [semantic versioning](https://semver.org/).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.1.0] - 2026-11-02
10
+
11
+ ### Added
12
+ - Interactive chat with streaming markdown answers, slash commands and history.
13
+ - Providers: OpenAI, Anthropic, Gemini, Groq, OpenRouter, DeepSeek, Mistral, xAI, Together,
14
+ Ollama, and custom OpenAI-compatible servers.
15
+ - `/model` switching mid-conversation with tab completion.
16
+ - API keys in the OS keychain (or environment variables), verified before saving.
17
+ - Live cost meter, `kunji usage`, and daily budgets (warn at 80%, block at 100%).
18
+ - `kunji compare` — one prompt, several models, with fastest/cheapest summary.
19
+ - Automatic fallback to the next model on rate limits or outages.
20
+ - `kunji ask` with pipe support and `--raw` output for scripts.
21
+ - `kunji doctor`, `kunji models`, `kunji providers`, `kunji config`.
22
+ - Responsive, minimal theme that adapts to any terminal width.
23
+ - Update notice via PyPI and signed (Ed25519) cloud check-in client (off until a server URL
24
+ is configured).
25
+
26
+ ### Build
27
+ - Standalone downloads for Windows (`kunji-windows-x64.exe`) and Linux; macOS users install
28
+ with `pipx install kunji` (a macOS download can be switched on later).
29
+ - Releases run automatically when the version number changes, with notes taken from this
30
+ changelog.
31
+
32
+ ### Design
33
+ - Compact one-row summary tables (`Strip`) for the chat header, `/cost`, `keys add`,
34
+ `usage` totals and `version` — 5 lines instead of ~11, more room for the conversation.
35
+ - `kunji compare` summary is now a table: time, tokens, cost and fastest/cheapest badges
36
+ for every model.
37
+ - README badges restyled for readability on light and dark GitHub themes.
kunji-0.1.0/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
kunji-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,207 @@
1
+ Metadata-Version: 2.5
2
+ Name: kunji
3
+ Version: 0.1.0
4
+ Summary: Bring your own key. Every AI model in one clean, professional terminal.
5
+ Project-URL: Homepage, https://github.com/testwithsuraj/kunji
6
+ Project-URL: Issues, https://github.com/testwithsuraj/kunji/issues
7
+ Project-URL: Changelog, https://github.com/testwithsuraj/kunji/blob/main/CHANGELOG.md
8
+ Author: Kunji contributors
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Keywords: ai,anthropic,byok,cli,gemini,llm,ollama,openai,terminal
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Utilities
21
+ Requires-Python: >=3.11
22
+ Requires-Dist: cryptography>=42
23
+ Requires-Dist: httpx>=0.27
24
+ Requires-Dist: keyring>=25
25
+ Requires-Dist: platformdirs>=4
26
+ Requires-Dist: prompt-toolkit>=3.0.43
27
+ Requires-Dist: questionary>=2.0
28
+ Requires-Dist: rich>=13.7
29
+ Requires-Dist: tomli-w>=1.0
30
+ Requires-Dist: typer>=0.12
31
+ Provides-Extra: dev
32
+ Requires-Dist: pyinstaller>=6; extra == 'dev'
33
+ Requires-Dist: pytest>=8; extra == 'dev'
34
+ Requires-Dist: ruff>=0.6; extra == 'dev'
35
+ Description-Content-Type: text/markdown
36
+
37
+ <div align="center">
38
+
39
+ # kunji
40
+
41
+ **Bring your own key. Every AI model in one clean, professional terminal.**
42
+
43
+ *Kunji (कुंजी) means "key" in Hindi.*
44
+
45
+ [![CI](https://img.shields.io/github/actions/workflow/status/testwithsuraj/kunji/ci.yml?branch=main&style=flat-square&label=CI&labelColor=1f2328)](https://github.com/testwithsuraj/kunji/actions/workflows/ci.yml)
46
+ [![License](https://img.shields.io/badge/license-Apache--2.0-3ddc84?style=flat-square&labelColor=1f2328)](LICENSE)
47
+ [![Python](https://img.shields.io/badge/python-3.11%2B-3ddc84?style=flat-square&labelColor=1f2328&logo=python&logoColor=white)](https://www.python.org/downloads/)
48
+ [![Providers](https://img.shields.io/badge/providers-10%2B-3ddc84?style=flat-square&labelColor=1f2328)](#providers)
49
+ [![Platforms](https://img.shields.io/badge/windows%20%7C%20macos%20%7C%20linux-3ddc84?style=flat-square&labelColor=1f2328&label=runs%20on)](#install)
50
+
51
+ </div>
52
+
53
+ ```
54
+ ┌─ kunji chat ─────────────────────────────────────────────────┐
55
+ │ Provider Model Key Budget State │
56
+ │────────────────────────────────────────────────────────────────│
57
+ │ Anthropic claude-sonnet keychain $0.38 / $2 READY │
58
+ └────────────────────────────────────────────────────────────────┘
59
+ enter send · alt+enter newline · / commands · ctrl+d quit
60
+
61
+ › explain recursion in one line
62
+ A function that solves a problem by calling itself on a smaller
63
+ piece of it, until it reaches a case simple enough to answer.
64
+ claude-sonnet · 18 in · 31 out · $0.0005 · 1.2s
65
+
66
+ › /model groq:llama-3.3-70b-versatile
67
+ ✓ Switched to groq:llama-3.3-70b-versatile conversation kept
68
+ ```
69
+
70
+ Kunji is a terminal app for chatting with any AI model using **your own API keys**.
71
+ You pay each provider directly. Kunji never sees your bill, your keys or your prompts.
72
+
73
+ ## Why kunji
74
+
75
+ - **One tool, every provider.** OpenAI, Anthropic, Google Gemini, Groq, OpenRouter,
76
+ DeepSeek, Mistral, xAI, Together, Ollama (local), plus any OpenAI-compatible server.
77
+ - **Switch models mid-conversation** with `/model` — the conversation carries over.
78
+ - **Live cost meter.** Every reply shows tokens and cost. `/cost` and `kunji usage`
79
+ show totals, in your currency.
80
+ - **Daily budgets.** Warns at 80%, blocks at 100%, per provider or overall.
81
+ - **Compare mode.** One prompt, several models, side by side — fastest and cheapest highlighted.
82
+ - **Automatic fallback.** Rate-limited or down? Kunji retries on your next model.
83
+ - **Keys in your OS keychain** (Windows Credential Manager, macOS Keychain, Secret Service),
84
+ never in a plain-text file.
85
+ - **Pipes.** `npm test 2>&1 | kunji ask "why is this failing?"`
86
+ - **Looks professional.** Minimal monochrome design, responsive to any terminal size.
87
+
88
+ ## Install
89
+
90
+ Requires Python 3.11+.
91
+
92
+ ```bash
93
+ pipx install kunji # recommended
94
+ # or
95
+ uv tool install kunji
96
+ # or
97
+ python -m pip install --user kunji
98
+ ```
99
+
100
+ | System | Easiest way |
101
+ | --- | --- |
102
+ | Windows | `pipx install kunji`, or download `kunji-windows-x64.exe` from the [latest release](https://github.com/testwithsuraj/kunji/releases/latest) (no Python needed) |
103
+ | macOS | `pipx install kunji` |
104
+ | Linux | `pipx install kunji`, or download `kunji-linux-x64` from the latest release |
105
+
106
+ `winget`, Scoop and Homebrew packages are on the [roadmap](ROADMAP.md).
107
+
108
+ ## Quick start
109
+
110
+ ```bash
111
+ kunji keys add # pick a provider, paste your key, choose a default model
112
+ kunji # start chatting
113
+ ```
114
+
115
+ Free and local? Install [Ollama](https://ollama.com), then `kunji keys add ollama`.
116
+
117
+ ## Commands
118
+
119
+ | Command | What it does |
120
+ | --- | --- |
121
+ | `kunji` / `kunji chat` | Interactive chat (`-m provider:model`, `-s "system prompt"`) |
122
+ | `kunji ask "…"` | One-shot answer. Reads piped input. `--raw` for scripts |
123
+ | `kunji compare "…" -m a -m b` | Same prompt to several models, side by side |
124
+ | `kunji keys add [provider]` | Add or replace a key (verified, then saved to the keychain) |
125
+ | `kunji keys list` / `test` / `remove` | Manage keys (always masked) |
126
+ | `kunji models [provider]` | Live model list with prices |
127
+ | `kunji use provider:model` | Set your default model |
128
+ | `kunji providers` | Supported providers; `providers add` for custom servers |
129
+ | `kunji usage` | Tokens and cost per model (stored locally only) |
130
+ | `kunji budget set <provider\|all> <amount>` | Daily spending limit |
131
+ | `kunji config show` / `set` / `path` | Settings |
132
+ | `kunji doctor` | Check Python, config, keychain and providers |
133
+
134
+ ### In chat
135
+
136
+ | Input | Action |
137
+ | --- | --- |
138
+ | `/model provider:model` | Switch model (tab completes) |
139
+ | `/models [filter]` | List models of the current provider |
140
+ | `/cost` | Session and today's cost |
141
+ | `/system …` | Set the system prompt |
142
+ | `/retry` · `/clear` · `/save [file]` | Regenerate · new conversation · export markdown |
143
+ | `enter` · `alt+enter` / `ctrl+j` | Send · new line |
144
+ | `ctrl+c` · `ctrl+d` | Stop the reply · quit |
145
+
146
+ ## Providers
147
+
148
+ | ID | Provider | Key env variable |
149
+ | --- | --- | --- |
150
+ | `openai` | OpenAI | `OPENAI_API_KEY` |
151
+ | `anthropic` | Anthropic | `ANTHROPIC_API_KEY` |
152
+ | `gemini` | Google Gemini | `GEMINI_API_KEY` / `GOOGLE_API_KEY` |
153
+ | `groq` | Groq | `GROQ_API_KEY` |
154
+ | `openrouter` | OpenRouter | `OPENROUTER_API_KEY` |
155
+ | `deepseek` | DeepSeek | `DEEPSEEK_API_KEY` |
156
+ | `mistral` | Mistral | `MISTRAL_API_KEY` |
157
+ | `xai` | xAI | `XAI_API_KEY` |
158
+ | `together` | Together AI | `TOGETHER_API_KEY` |
159
+ | `ollama` | Ollama (local) | none |
160
+
161
+ Any OpenAI-compatible server (LM Studio, vLLM, LiteLLM proxy…):
162
+
163
+ ```bash
164
+ kunji providers add lmstudio --base-url http://localhost:1234/v1 --no-key
165
+ ```
166
+
167
+ ## Security and privacy
168
+
169
+ - API keys are stored **only** in your operating system's credential store, or read from
170
+ environment variables. They are sent **only** to the provider they belong to.
171
+ - Kunji's config file never contains keys. Errors are scrubbed so keys never appear on screen.
172
+ - Usage and cost history stay on your machine (`kunji config path`).
173
+ - Network calls kunji makes on its own: the public model price list (OpenRouter, plus this
174
+ repo's `catalog/pricing.json`) and the PyPI version check. Neither sends anything about you.
175
+ Turn them off with `kunji config set network.catalog false` and
176
+ `kunji config set updates.check false`.
177
+ - Found a vulnerability? Please follow [SECURITY.md](SECURITY.md).
178
+
179
+ Details: [docs/PRIVACY.md](docs/PRIVACY.md).
180
+
181
+ ## Configuration
182
+
183
+ ```bash
184
+ kunji config set display.currency INR
185
+ kunji config set display.usd_rate 84 # your conversion rate
186
+ kunji budget set all 200 # ₹200/day across every provider
187
+ kunji config set fallback '["groq:llama-3.3-70b-versatile", "ollama:qwen2.5"]'
188
+ ```
189
+
190
+ All options: [docs/CONFIG.md](docs/CONFIG.md).
191
+
192
+ ## Free and Pro
193
+
194
+ Everything that runs on your machine is **free and open source, forever** — chat,
195
+ switching, keys, cost meter, budgets, compare, fallback, pipes. A future optional
196
+ **Pro** plan will add cloud features that need a server (sync across devices, shared team
197
+ keys with per-person budgets, a smart router). See [ROADMAP.md](ROADMAP.md).
198
+
199
+ ## Contributing
200
+
201
+ Bug reports, ideas and pull requests are welcome — start with
202
+ [CONTRIBUTING.md](CONTRIBUTING.md). Architecture overview: [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md).
203
+
204
+ ## License
205
+
206
+ [Apache-2.0](LICENSE). "kunji" and the kunji logo are not covered by the license; please
207
+ use a different name for forks.
kunji-0.1.0/README.md ADDED
@@ -0,0 +1,171 @@
1
+ <div align="center">
2
+
3
+ # kunji
4
+
5
+ **Bring your own key. Every AI model in one clean, professional terminal.**
6
+
7
+ *Kunji (कुंजी) means "key" in Hindi.*
8
+
9
+ [![CI](https://img.shields.io/github/actions/workflow/status/testwithsuraj/kunji/ci.yml?branch=main&style=flat-square&label=CI&labelColor=1f2328)](https://github.com/testwithsuraj/kunji/actions/workflows/ci.yml)
10
+ [![License](https://img.shields.io/badge/license-Apache--2.0-3ddc84?style=flat-square&labelColor=1f2328)](LICENSE)
11
+ [![Python](https://img.shields.io/badge/python-3.11%2B-3ddc84?style=flat-square&labelColor=1f2328&logo=python&logoColor=white)](https://www.python.org/downloads/)
12
+ [![Providers](https://img.shields.io/badge/providers-10%2B-3ddc84?style=flat-square&labelColor=1f2328)](#providers)
13
+ [![Platforms](https://img.shields.io/badge/windows%20%7C%20macos%20%7C%20linux-3ddc84?style=flat-square&labelColor=1f2328&label=runs%20on)](#install)
14
+
15
+ </div>
16
+
17
+ ```
18
+ ┌─ kunji chat ─────────────────────────────────────────────────┐
19
+ │ Provider Model Key Budget State │
20
+ │────────────────────────────────────────────────────────────────│
21
+ │ Anthropic claude-sonnet keychain $0.38 / $2 READY │
22
+ └────────────────────────────────────────────────────────────────┘
23
+ enter send · alt+enter newline · / commands · ctrl+d quit
24
+
25
+ › explain recursion in one line
26
+ A function that solves a problem by calling itself on a smaller
27
+ piece of it, until it reaches a case simple enough to answer.
28
+ claude-sonnet · 18 in · 31 out · $0.0005 · 1.2s
29
+
30
+ › /model groq:llama-3.3-70b-versatile
31
+ ✓ Switched to groq:llama-3.3-70b-versatile conversation kept
32
+ ```
33
+
34
+ Kunji is a terminal app for chatting with any AI model using **your own API keys**.
35
+ You pay each provider directly. Kunji never sees your bill, your keys or your prompts.
36
+
37
+ ## Why kunji
38
+
39
+ - **One tool, every provider.** OpenAI, Anthropic, Google Gemini, Groq, OpenRouter,
40
+ DeepSeek, Mistral, xAI, Together, Ollama (local), plus any OpenAI-compatible server.
41
+ - **Switch models mid-conversation** with `/model` — the conversation carries over.
42
+ - **Live cost meter.** Every reply shows tokens and cost. `/cost` and `kunji usage`
43
+ show totals, in your currency.
44
+ - **Daily budgets.** Warns at 80%, blocks at 100%, per provider or overall.
45
+ - **Compare mode.** One prompt, several models, side by side — fastest and cheapest highlighted.
46
+ - **Automatic fallback.** Rate-limited or down? Kunji retries on your next model.
47
+ - **Keys in your OS keychain** (Windows Credential Manager, macOS Keychain, Secret Service),
48
+ never in a plain-text file.
49
+ - **Pipes.** `npm test 2>&1 | kunji ask "why is this failing?"`
50
+ - **Looks professional.** Minimal monochrome design, responsive to any terminal size.
51
+
52
+ ## Install
53
+
54
+ Requires Python 3.11+.
55
+
56
+ ```bash
57
+ pipx install kunji # recommended
58
+ # or
59
+ uv tool install kunji
60
+ # or
61
+ python -m pip install --user kunji
62
+ ```
63
+
64
+ | System | Easiest way |
65
+ | --- | --- |
66
+ | Windows | `pipx install kunji`, or download `kunji-windows-x64.exe` from the [latest release](https://github.com/testwithsuraj/kunji/releases/latest) (no Python needed) |
67
+ | macOS | `pipx install kunji` |
68
+ | Linux | `pipx install kunji`, or download `kunji-linux-x64` from the latest release |
69
+
70
+ `winget`, Scoop and Homebrew packages are on the [roadmap](ROADMAP.md).
71
+
72
+ ## Quick start
73
+
74
+ ```bash
75
+ kunji keys add # pick a provider, paste your key, choose a default model
76
+ kunji # start chatting
77
+ ```
78
+
79
+ Free and local? Install [Ollama](https://ollama.com), then `kunji keys add ollama`.
80
+
81
+ ## Commands
82
+
83
+ | Command | What it does |
84
+ | --- | --- |
85
+ | `kunji` / `kunji chat` | Interactive chat (`-m provider:model`, `-s "system prompt"`) |
86
+ | `kunji ask "…"` | One-shot answer. Reads piped input. `--raw` for scripts |
87
+ | `kunji compare "…" -m a -m b` | Same prompt to several models, side by side |
88
+ | `kunji keys add [provider]` | Add or replace a key (verified, then saved to the keychain) |
89
+ | `kunji keys list` / `test` / `remove` | Manage keys (always masked) |
90
+ | `kunji models [provider]` | Live model list with prices |
91
+ | `kunji use provider:model` | Set your default model |
92
+ | `kunji providers` | Supported providers; `providers add` for custom servers |
93
+ | `kunji usage` | Tokens and cost per model (stored locally only) |
94
+ | `kunji budget set <provider\|all> <amount>` | Daily spending limit |
95
+ | `kunji config show` / `set` / `path` | Settings |
96
+ | `kunji doctor` | Check Python, config, keychain and providers |
97
+
98
+ ### In chat
99
+
100
+ | Input | Action |
101
+ | --- | --- |
102
+ | `/model provider:model` | Switch model (tab completes) |
103
+ | `/models [filter]` | List models of the current provider |
104
+ | `/cost` | Session and today's cost |
105
+ | `/system …` | Set the system prompt |
106
+ | `/retry` · `/clear` · `/save [file]` | Regenerate · new conversation · export markdown |
107
+ | `enter` · `alt+enter` / `ctrl+j` | Send · new line |
108
+ | `ctrl+c` · `ctrl+d` | Stop the reply · quit |
109
+
110
+ ## Providers
111
+
112
+ | ID | Provider | Key env variable |
113
+ | --- | --- | --- |
114
+ | `openai` | OpenAI | `OPENAI_API_KEY` |
115
+ | `anthropic` | Anthropic | `ANTHROPIC_API_KEY` |
116
+ | `gemini` | Google Gemini | `GEMINI_API_KEY` / `GOOGLE_API_KEY` |
117
+ | `groq` | Groq | `GROQ_API_KEY` |
118
+ | `openrouter` | OpenRouter | `OPENROUTER_API_KEY` |
119
+ | `deepseek` | DeepSeek | `DEEPSEEK_API_KEY` |
120
+ | `mistral` | Mistral | `MISTRAL_API_KEY` |
121
+ | `xai` | xAI | `XAI_API_KEY` |
122
+ | `together` | Together AI | `TOGETHER_API_KEY` |
123
+ | `ollama` | Ollama (local) | none |
124
+
125
+ Any OpenAI-compatible server (LM Studio, vLLM, LiteLLM proxy…):
126
+
127
+ ```bash
128
+ kunji providers add lmstudio --base-url http://localhost:1234/v1 --no-key
129
+ ```
130
+
131
+ ## Security and privacy
132
+
133
+ - API keys are stored **only** in your operating system's credential store, or read from
134
+ environment variables. They are sent **only** to the provider they belong to.
135
+ - Kunji's config file never contains keys. Errors are scrubbed so keys never appear on screen.
136
+ - Usage and cost history stay on your machine (`kunji config path`).
137
+ - Network calls kunji makes on its own: the public model price list (OpenRouter, plus this
138
+ repo's `catalog/pricing.json`) and the PyPI version check. Neither sends anything about you.
139
+ Turn them off with `kunji config set network.catalog false` and
140
+ `kunji config set updates.check false`.
141
+ - Found a vulnerability? Please follow [SECURITY.md](SECURITY.md).
142
+
143
+ Details: [docs/PRIVACY.md](docs/PRIVACY.md).
144
+
145
+ ## Configuration
146
+
147
+ ```bash
148
+ kunji config set display.currency INR
149
+ kunji config set display.usd_rate 84 # your conversion rate
150
+ kunji budget set all 200 # ₹200/day across every provider
151
+ kunji config set fallback '["groq:llama-3.3-70b-versatile", "ollama:qwen2.5"]'
152
+ ```
153
+
154
+ All options: [docs/CONFIG.md](docs/CONFIG.md).
155
+
156
+ ## Free and Pro
157
+
158
+ Everything that runs on your machine is **free and open source, forever** — chat,
159
+ switching, keys, cost meter, budgets, compare, fallback, pipes. A future optional
160
+ **Pro** plan will add cloud features that need a server (sync across devices, shared team
161
+ keys with per-person budgets, a smart router). See [ROADMAP.md](ROADMAP.md).
162
+
163
+ ## Contributing
164
+
165
+ Bug reports, ideas and pull requests are welcome — start with
166
+ [CONTRIBUTING.md](CONTRIBUTING.md). Architecture overview: [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md).
167
+
168
+ ## License
169
+
170
+ [Apache-2.0](LICENSE). "kunji" and the kunji logo are not covered by the license; please
171
+ use a different name for forks.
@@ -0,0 +1,33 @@
1
+ # Packaging
2
+
3
+ | Channel | How | Users install with |
4
+ | --- | --- | --- |
5
+ | PyPI | Automatic: `.github/workflows/release.yml` on a `v*` tag | `pipx install kunji` |
6
+ | GitHub Releases | Automatic: Windows + Linux binaries + `SHA256SUMS.txt` (macOS: set repo variable `BUILD_MACOS=true`) | download |
7
+ | winget | `wingetcreate` with the release `.exe` (see `winget/`) | `winget install testwithsuraj.kunji` |
8
+ | Scoop | Copy `scoop/kunji.json` into a `scoop-bucket` repo | `scoop bucket add kunji https://github.com/testwithsuraj/scoop-bucket` then `scoop install kunji` |
9
+ | Homebrew | Copy `homebrew/kunji.rb` into a `homebrew-tap` repo | `brew install testwithsuraj/tap/kunji` |
10
+
11
+ Build a binary locally:
12
+
13
+ ```bash
14
+ python -m pip install -e ".[dev]"
15
+ pyinstaller packaging/kunji.spec --noconfirm --clean
16
+ ./dist/kunji --version
17
+ ```
18
+
19
+ ## Releasing a new version
20
+
21
+ 1. Set the new version in `src/kunji/__init__.py` (e.g. `__version__ = "0.2.0"`).
22
+ 2. Add `## [0.2.0] - YYYY-MM-DD` to `CHANGELOG.md` — that section becomes the release notes.
23
+ 3. Commit and push to `main`.
24
+ 4. GitHub → Actions → **Release** → **Review deployments** → `pypi` → **Approve and deploy**.
25
+
26
+ The workflow then publishes to PyPI, creates the `v0.2.0` tag and the GitHub Release with
27
+ the downloads. Pushing to `main` without changing the version never releases anything.
28
+
29
+ ### Turning on the macOS download later
30
+
31
+ GitHub → Settings → Secrets and variables → Actions → **Variables** → New repository
32
+ variable: `BUILD_MACOS` = `true`. Nothing else to change; if a Mac build ever fails, the
33
+ release still goes out without it.