Skip to content

Moshe-ship/khalas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

khalas (خلص) — Arabic Prompt Optimizer

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

Why

Same prompt costs 2-5x more in Arabic. Tokenizers fragment Arabic characters into byte sequences, inflating token counts and API bills.

khalas compares Arabic vs English side by side, then optimizes the Arabic prompt to use fewer tokens without losing quality.

Install

pip install khalas

Quick Start

khalas compare "الذكاء الاصطناعي يغير العالم" "AI is changing the world" --provider openai

Commands

Command Description
compare Side-by-side AR vs EN token count and cost
optimize Rewrite Arabic prompt to reduce tokens
savings Show how much you save after optimization
explain Break down where tokens are wasted
config Set default provider and API keys

Optimization Techniques

Technique What it does
Language Hint Prepend language context to guide tokenizer
Simplify Replace complex Arabic structures with simpler equivalents
English Backbone Keep instructions in English, content in Arabic
Bilingual Instruction Mix EN structure with AR key terms
Shorten Remove filler words and redundancy

Supported Providers

Provider Model (March 2026)
OpenAI gpt-5.4
Anthropic claude-opus-4-6
Google gemini-3.1-pro
DeepSeek deepseek-v3.2
Mistral mistral-large-3
Groq groq-llama-4
Qwen qwen-3.5
xAI grok-2

مقدمة من مجتمع الذكاء الاصطناعي السعودي للعرب أولا وللعالم أجمع

Brought to you by the Saudi AI Community — for Arabs first, and the world at large.

The Series

  • artok — Arabic Token Tax Calculator
  • bidi-guard — Trojan Source Attack Scanner
  • arabench — Arabic LLM Benchmark
  • majal — Arabic AI Tools Hub
  • khalas — Arabic Prompt Optimizer

License

MIT — Musa the Carpenter

About

Arabic Prompt Optimizer — compare AR vs EN, optimize for fewer tokens

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages