Simple AI chat client with memory and multi-model support
Project description
khazai
Unofficial Python client for AI chat — simple, lightweight, with memory.
from khazai import Client
ai = Client(system="Kamu adalah asisten yang membantu.")
print(ai(prompt="Halo!", memory=True))
Features
- Simple API — just
Client()+ai(prompt="...") - System prompt — set persona once or override per-call
- Memory — conversation history with automatic summarization & session rotation
- Multiple models — GPT, Claude, Gemini, DeepSeek, Grok, Qwen
- Streaming — real-time token generation
- Auto session — fresh cookies & CSRF on limit (2000 tokens) or rate-limit (429)
Install
pip install khazai
Usage
Quick start
from khazai import Client
ai = Client()
reply = ai(prompt="hello")
print(reply)
With system prompt
ai = Client(system="You are a helpful assistant. Be concise.")
reply = ai(prompt="explain quantum computing")
Memory mode
ai = Client(system="You are a friendly chatbot.")
ai(prompt="my name is Rizky", memory=True)
ai(prompt="what is my name?", memory=True)
# "Your name is Rizky."
Change model
# Short names
ai = Client(model="gpt") # default
ai = Client(model="claude")
ai = Client(model="gemini")
ai = Client(model="deepseek")
ai = Client(model="grok")
# Override per-call
ai(prompt="hello", model="claude")
# Full model ID
ai = Client(model="openai/gpt-4o-mini")
Available: gpt, claude, gemini, deepseek, grok, qwen.
Streaming
for chunk in ai(prompt="tell me a story", stream=True):
print(chunk, end="", flush=True)
Per-call system prompt
ai(prompt="who are you?", system="You are a French assistant. Answer in French.")
# "Je suis votre assistant virtuel..."
Stateless (no memory)
reply = ai(prompt="hello") # memory=False by default
reply = ai(prompt="hello", memory=False)
Each stateless call rotates the session and discards history.
CLI
python -m khazai "your prompt here"
python -m khazai
> hello
Hello! How can I help you?
> /quit
Interactive example
from khazai import Client
ai = Client(system="Kamu adalah customer service yang ramah.")
while True:
msg = input("> ")
if msg == "quit":
break
print(ai(prompt=msg, memory=True))
Models
| Short name | Full ID |
|---|---|
gpt |
openai/gpt-4o-mini |
claude |
anthropic/claude-haiku-4-5 |
gemini |
google/gemini-2.0-flash-001 |
deepseek |
deepseek/deepseek-chat-v3-0324 |
grok |
x-ai/grok-3-mini-beta |
qwen |
qwen/qwen-2.5-72b-instruct |
License
MIT
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
khazai-0.1.0.tar.gz
(7.8 kB
view details)
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 khazai-0.1.0.tar.gz.
File metadata
- Download URL: khazai-0.1.0.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e96e5020b0bbdaf3e048423154cd778ec64a4ee24d0ac45ef6e06aedd1ad5a35
|
|
| MD5 |
c27c874d8586f0825982e39b06c2a7fb
|
|
| BLAKE2b-256 |
6bf12408c217885654938a3c23ab4ef06a7896534e7bd5f69227885ba750d8d6
|
File details
Details for the file khazai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: khazai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d68ad2cb1b969f19e95d2753e8e707ca202264577a4983cd0b3001bb9598381e
|
|
| MD5 |
5632a1a674394a9553e0bdcc7e56a130
|
|
| BLAKE2b-256 |
22f2d73a59d532e2a9ac83f7d0088254f090d1c4a69c6b64e8a22eee0143cb9c
|