Skip to content
Back to skills

Arabic Token Cost

ASecurity

Use when estimating or comparing how many tokens Arabic text costs across LLM tokenizers, or when Arabic prompts seem expensive, truncated or slow compared with English.

  • 24 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added October 5, 2026
ai-agentspythongo

Works with

  • mcp

Security analysis

A92/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 2 files and shows the line behind each finding

Scanned October 5, 2026

npx -y skills add h9-tec/arabic-ai-atlas --skill arabic-token-cost --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Arabic Token Cost?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Arabic Token Cost
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/h9-tec-arabic-token-cost/badge)](https://www.skillsdirectory.com/skills/h9-tec-arabic-token-cost)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: arabic-token-cost
description: Use when estimating or comparing how many tokens Arabic text costs across LLM tokenizers, or when Arabic prompts seem expensive, truncated or slow compared with English.
---

# Arabic Token Cost

Measures tokenizer fertility (tokens per word) on Arabic text against an English reference of the same word count.

## Run

```
python ${CLAUDE_PLUGIN_ROOT}/skills/arabic-token-cost/token_cost.py --text "النص العربي هنا" [--tokenizers id,id]
```

Use `--file path` for longer samples (at least a few hundred words gives stable numbers). Default tokenizers: `gpt2`, `meta-llama/Llama-3.1-8B`, `Qwen/Qwen2.5-7B`, `inceptionai/jais-family-590m`, `google/gemma-2-2b`.

It needs `transformers`. If missing it prints an install hint (`uv pip install transformers`) and exits 2. Tokenizers download from Hugging Face on first use; gated ones (such as Llama) may fail, and that row prints an error while the rest continue.

## Reading the table

Columns: `tokenizer | tokens | tokens/word | ratio vs English`.

- Under 1.5 tokens/word: efficient.
- 1.5 to 2.5: acceptable.
- Over 2.5: expensive. Context fills about twice as fast and cost and latency rise accordingly.
- Ratio vs English shows the Arabic penalty for that tokenizer; compare it across rows, not in absolute terms.

## Procedure

1. Run the script on a representative sample of the user's real text, not a single sentence.
2. Report the table and flag every tokenizer over 2.5 tokens/word.
3. If cost matters, call the MCP tool `search(query="tokenizer")` and recommend Arabic-aware tokenizers or models the atlas returns, with license and link.

## Rules

- Fertility depends on the text (dialect and diacritics raise it). State the sample used.
- Do not recommend models that the atlas did not return.

Files in this skill

  • SKILL.md1.8 KB
  • token_cost.py2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.