Open-source CLI

khalasخلص

artok shows you pay more. arabench shows you get less. khalas fixes it.

10 techniques · 8 providers · instant savings
$ pip install khalas
The Problem
Same prompt, different price.
Arabic prompts cost 2-5x more because tokenizers split Arabic into byte fragments. Same meaning, inflated bill. khalas compares the gap, then closes it.
Arabic
اكتب لي ملخصا عن الذكاء الاصطناعي
34
tokens · $0.17 / 1K calls
vs
English
Write me a summary about AI
7
tokens · $0.04 / 1K calls
After khalas optimize
12
tokens · 65% saved
Optimization
10 techniques to cut the tax.
Each technique reduces tokens differently. khalas picks the best combination for your prompt.
🏷️

Language Hint

Prepend language context to guide the tokenizer into Arabic-aware mode.

✂️

Simplify

Replace complex Arabic morphology with simpler equivalents. Same meaning, fewer fragments.

🏗️

English Backbone

Keep instructions in English, content in Arabic. Tokenizers handle the split cheaply.

🌐

Bilingual Instruction

Mix English structure with Arabic key terms. Best of both token economies.

Shorten

Remove filler words, redundancy, and verbose honorifics. Direct and cheap.

Supported Providers
8 providers. March 2026 models.
khalas works with the latest models from every major provider.
ProviderModelInput $/1MOutput $/1M
OpenAIgpt-5.4$2.50$10.00
Anthropicclaude-opus-4-6$5.00$25.00
Googlegemini-3.1-pro$1.25$10.00
DeepSeekdeepseek-v3.2$0.27$1.10
Mistralmistral-large-3$0.50$1.50
Groqgroq-llama-4$0.06$0.06
Qwenqwen-3.5$0.10$0.40
xAIgrok-2$2.00$10.00
Commands
5 commands. Zero waste.

compare

Side-by-side AR vs EN token count and cost for any prompt and provider.

optimize

Rewrite Arabic prompt to use fewer tokens. Picks the best technique automatically.

savings

Show how much you save after optimization — tokens, dollars, percentage.

explain

Break down where tokens are wasted. See which words cost the most.

config

Set default provider, API keys, and preferred optimization techniques.

Get Started
Four commands to savings.
# Install $ pip install khalas # Compare AR vs EN $ khalas compare "اكتب ملخصا عن الذكاء الاصطناعي" "Write a summary about AI" --provider openai # Optimize the Arabic prompt $ khalas optimize "اكتب لي ملخصا مفصلا وشاملا عن موضوع الذكاء الاصطناعي" --provider anthropic # See your savings $ khalas savings --last # Explain where tokens are wasted $ khalas explain "اكتب لي ملخصا مفصلا وشاملا عن موضوع الذكاء الاصطناعي"