yaptax 0.3.1__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.
- yaptax-0.3.1/LICENSE +21 -0
- yaptax-0.3.1/PKG-INFO +150 -0
- yaptax-0.3.1/README.md +118 -0
- yaptax-0.3.1/pyproject.toml +38 -0
- yaptax-0.3.1/setup.cfg +4 -0
- yaptax-0.3.1/src/yaptax/__init__.py +3 -0
- yaptax-0.3.1/src/yaptax/__main__.py +5 -0
- yaptax-0.3.1/src/yaptax/cli.py +331 -0
- yaptax-0.3.1/src/yaptax/data/index-v0.json +1 -0
- yaptax-0.3.1/src/yaptax/detect.py +70 -0
- yaptax-0.3.1/src/yaptax/index.py +71 -0
- yaptax-0.3.1/src/yaptax/router/__init__.py +1 -0
- yaptax-0.3.1/src/yaptax/router/config.py +107 -0
- yaptax-0.3.1/src/yaptax/router/dashboard.html +151 -0
- yaptax-0.3.1/src/yaptax/router/demo.py +116 -0
- yaptax-0.3.1/src/yaptax/router/demo_prompts.json +73 -0
- yaptax-0.3.1/src/yaptax/router/engine.py +128 -0
- yaptax-0.3.1/src/yaptax/router/mock.py +72 -0
- yaptax-0.3.1/src/yaptax/router/server.py +228 -0
- yaptax-0.3.1/src/yaptax/router/store.py +97 -0
- yaptax-0.3.1/src/yaptax/tokenizers.py +50 -0
- yaptax-0.3.1/src/yaptax.egg-info/PKG-INFO +150 -0
- yaptax-0.3.1/src/yaptax.egg-info/SOURCES.txt +28 -0
- yaptax-0.3.1/src/yaptax.egg-info/dependency_links.txt +1 -0
- yaptax-0.3.1/src/yaptax.egg-info/entry_points.txt +2 -0
- yaptax-0.3.1/src/yaptax.egg-info/requires.txt +22 -0
- yaptax-0.3.1/src/yaptax.egg-info/top_level.txt +1 -0
- yaptax-0.3.1/tests/test_router_engine.py +114 -0
- yaptax-0.3.1/tests/test_router_server.py +127 -0
- yaptax-0.3.1/tests/test_yaptax.py +84 -0
yaptax-0.3.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 NeuroTitan Labs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
yaptax-0.3.1/PKG-INFO
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: yaptax
|
|
3
|
+
Version: 0.3.1
|
|
4
|
+
Summary: Measure the language tax in your AI prompts: how many more tokens your non-English users cost.
|
|
5
|
+
Author: NeuroTitan Labs
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://neurotitan.in/cost
|
|
8
|
+
Project-URL: Source, https://github.com/NeuroTitan-Hub/yaptax
|
|
9
|
+
Project-URL: Issues, https://github.com/NeuroTitan-Hub/yaptax/issues
|
|
10
|
+
Keywords: llm,tokens,tokenizer,multilingual,cost
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: tiktoken>=0.7
|
|
17
|
+
Provides-Extra: hf
|
|
18
|
+
Requires-Dist: tokenizers>=0.19; extra == "hf"
|
|
19
|
+
Requires-Dist: huggingface_hub>=0.23; extra == "hf"
|
|
20
|
+
Provides-Extra: router
|
|
21
|
+
Requires-Dist: fastapi>=0.110; extra == "router"
|
|
22
|
+
Requires-Dist: uvicorn>=0.29; extra == "router"
|
|
23
|
+
Requires-Dist: httpx>=0.27; extra == "router"
|
|
24
|
+
Requires-Dist: tomli>=2; python_version < "3.11" and extra == "router"
|
|
25
|
+
Provides-Extra: test
|
|
26
|
+
Requires-Dist: pytest>=7; extra == "test"
|
|
27
|
+
Requires-Dist: fastapi>=0.110; extra == "test"
|
|
28
|
+
Requires-Dist: uvicorn>=0.29; extra == "test"
|
|
29
|
+
Requires-Dist: httpx>=0.27; extra == "test"
|
|
30
|
+
Requires-Dist: tomli>=2; python_version < "3.11" and extra == "test"
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# yaptax
|
|
34
|
+
|
|
35
|
+
*Every language at English price.* (Formerly `langtax`.)
|
|
36
|
+
|
|
37
|
+
**Measure the language tax in your AI prompts.** The same meaning takes more tokens outside English, and you pay per token. `yaptax` counts your own prompts per language, on the tokenizers your models use, and tells you how many of those tokens English would not need.
|
|
38
|
+
|
|
39
|
+
Everything runs on your machine. Your text is never uploaded.
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
pip install yaptax
|
|
43
|
+
yaptax measure prompts.jsonl
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
Language Records Label o200k tokens o200k extra cl100k tokens cl100k extra
|
|
48
|
+
--------------------------------- ------- -------- ------------ ----------- ------------- ------------
|
|
49
|
+
Hindi (hin_Deva) 2 labelled 47 36% 142 79%
|
|
50
|
+
Spanish (spa_Latn) 2 labelled 33 24% 38 34%
|
|
51
|
+
English (eng_Latn) 2 labelled 31 0% 31 0%
|
|
52
|
+
Tamil (tam_Taml) 1 labelled 28 50% 114 87%
|
|
53
|
+
...
|
|
54
|
+
|
|
55
|
+
o200k: 207 tokens. The same meaning in English would take about 148, so about 59 (29%) are language tax.
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
That is `examples/support.jsonl`, ten short customer-support messages.
|
|
59
|
+
|
|
60
|
+
## Commands
|
|
61
|
+
|
|
62
|
+
| Command | What it does |
|
|
63
|
+
|---|---|
|
|
64
|
+
| `yaptax measure FILE` | Tokens per language in a file, and how many are language tax |
|
|
65
|
+
| `yaptax measure FILE --spend 2000` | Also shows the tax in money for a monthly spend |
|
|
66
|
+
| `yaptax measure FILE --lang hi` | Treat every record as one language |
|
|
67
|
+
| `yaptax measure FILE --tokenizers o200k,qwen3` | Choose tokenizers (see below) |
|
|
68
|
+
| `yaptax measure FILE --json` | Machine-readable output |
|
|
69
|
+
| `yaptax ratios Tamil` | The Index's ratios for one language, on all 8 tokenizers |
|
|
70
|
+
| `yaptax demo --open` | The router on a fake provider, with a live savings dashboard (needs `yaptax[router]`) |
|
|
71
|
+
| `yaptax router --config router.toml` | The router in front of your real models, with your own keys |
|
|
72
|
+
|
|
73
|
+
**Input:** `.jsonl`, `.json`, `.csv`, `.tsv`, or plain text with one prompt per line (`-` reads stdin).
|
|
74
|
+
- Text is taken from a `text`, `prompt`, `content`, `input`, `message`, `query` or `question` field, or from chat `messages`. Use `--text-field` for another name.
|
|
75
|
+
- Language is taken from a `lang`, `language` or `locale` field if there is one (`hi`, `hi-IN`, `hin_Deva` and `Hindi` all work). Use `--lang-field` for another name.
|
|
76
|
+
- Without a label, the language is guessed from the writing system. All Devanagari is scored as Hindi, for example. Latin-script text is only scored as English if it looks like English; otherwise it is counted but not scored. Label your data for exact results.
|
|
77
|
+
|
|
78
|
+
## yaptax Router: cut the tax automatically
|
|
79
|
+
|
|
80
|
+
Measuring is step one. The router is step two: an OpenAI-compatible endpoint that sends each request to the cheapest model you allow for its language, and shows what that saved.
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
pip install "yaptax[router]"
|
|
84
|
+
yaptax demo --open
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
`yaptax demo` runs the router against a built-in fake provider, sends 34 multilingual support messages through it and opens a live savings dashboard. Every model gets the same demo price, so the saving you see comes only from tokens. No real model is called and nothing is paid. On the demo set, routing saves 53% against sending every language to Qwen3:
|
|
88
|
+
|
|
89
|
+
| Language | Routed to | Saved |
|
|
90
|
+
|---|---|---|
|
|
91
|
+
| Hindi | gpt-4o | 64% |
|
|
92
|
+
| Tamil | gpt-4o | 68% |
|
|
93
|
+
| Telugu | gpt-4o | 72% |
|
|
94
|
+
| Thai | deepseek-v3 | 31% |
|
|
95
|
+
| Arabic | mistral-nemo | 24% |
|
|
96
|
+
| Amharic, English | qwen3 (baseline) | 0% |
|
|
97
|
+
|
|
98
|
+
For real traffic, write a config with your models, your prices and your keys (see [`examples/router.toml`](https://github.com/NeuroTitan-Hub/yaptax/blob/main/examples/router.toml)), then:
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
yaptax router --config router.toml
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
from openai import OpenAI
|
|
106
|
+
client = OpenAI(base_url="http://127.0.0.1:8787/v1", api_key="unused")
|
|
107
|
+
reply = client.chat.completions.create(model="yaptax-auto", messages=[{"role": "user", "content": "मेरा ऑर्डर कहाँ है?"}])
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
How it decides:
|
|
111
|
+
- **Language:** the `x-yaptax-lang` header if you send one; otherwise a guess from the user's text.
|
|
112
|
+
- **Cost:** for each allowed model, input tokens on its tokenizer times its input price, plus an expected answer length on its tokenizer times its output price. OpenAI's tokenizers are counted exactly; others are estimated from the Language Cost Index. It picks the cheapest. On a tie it stays on your baseline.
|
|
113
|
+
- **Pinning:** send a configured model name instead of `yaptax-auto` and the router uses that model, logging it like any other request.
|
|
114
|
+
- **Safety:** per-language `allow`/`deny` rules (from an audit of answer quality). If the chosen model is down (5xx), it retries on your baseline.
|
|
115
|
+
- **Accounting:** the actual cost uses the provider's reported usage. The baseline cost is an estimate of the same request on your baseline, with the answer converted to its tokenizer using the Index ratios.
|
|
116
|
+
- **Privacy:** the log keeps language, models, token counts, costs and timing. No prompt or answer text, and keys stay in your environment.
|
|
117
|
+
- **Endpoints:** `POST /v1/chat/completions` (streaming supported), `GET /v1/models`, `GET /stats`, and the dashboard at `/`.
|
|
118
|
+
|
|
119
|
+
What it doesn't do yet: judge answer quality by itself (use per-language rules), or route by latency.
|
|
120
|
+
|
|
121
|
+
## Tokenizers
|
|
122
|
+
|
|
123
|
+
| ID | Used by | Needs |
|
|
124
|
+
|---|---|---|
|
|
125
|
+
| `o200k` | GPT-4o, GPT-4.1, GPT-5, o3 | built in |
|
|
126
|
+
| `cl100k` | GPT-4, GPT-3.5 | built in |
|
|
127
|
+
| `gpt2` | GPT-2 | built in |
|
|
128
|
+
| `utf8-bytes` | byte-level models | built in |
|
|
129
|
+
| `qwen3`, `deepseek-v3`, `mistral-nemo`, `bloom` | those open models | `pip install 'yaptax[hf]'`; fetched from Hugging Face at the exact revisions the Index used |
|
|
130
|
+
|
|
131
|
+
Anthropic and Google do not publish their tokenizers as files, so they are not here yet.
|
|
132
|
+
|
|
133
|
+
## How "extra tokens" is computed
|
|
134
|
+
|
|
135
|
+
For each language, yaptax divides your token count by that language's ratio to English in the [Language Cost Index](https://neurotitan.in/cost): the same 1,012 FLORES-200 sentences, measured in 204 languages on 8 tokenizers. The difference is the language tax. It is an average, so a single short text can differ.
|
|
136
|
+
|
|
137
|
+
**Checked:** on FLORES-200 devtest, `yaptax measure` gives exactly the token totals published with the Index for Hindi, Tamil and English on o200k, cl100k, Qwen3 and BLOOM.
|
|
138
|
+
|
|
139
|
+
**What it does not tell you:** fewer tokens is not the same as a cheaper or better model. Prices per token differ between models, and so does answer quality in each language. Measuring those on your own traffic is what our Language Cost Audit does: write to the address on [neurotitan.in](https://neurotitan.in).
|
|
140
|
+
|
|
141
|
+
## Develop
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
pip install -e ".[test]"
|
|
145
|
+
pytest
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
MIT licence. The bundled Index data comes from [Sentence-cost-in-Electron](https://github.com/NeuroTitan-Hub/Sentence-cost-in-Electron); FLORES-200 is by Meta AI (CC BY-SA 4.0).
|
|
149
|
+
|
|
150
|
+
By [NeuroTitan Labs](https://neurotitan.in).
|
yaptax-0.3.1/README.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# yaptax
|
|
2
|
+
|
|
3
|
+
*Every language at English price.* (Formerly `langtax`.)
|
|
4
|
+
|
|
5
|
+
**Measure the language tax in your AI prompts.** The same meaning takes more tokens outside English, and you pay per token. `yaptax` counts your own prompts per language, on the tokenizers your models use, and tells you how many of those tokens English would not need.
|
|
6
|
+
|
|
7
|
+
Everything runs on your machine. Your text is never uploaded.
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
pip install yaptax
|
|
11
|
+
yaptax measure prompts.jsonl
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
Language Records Label o200k tokens o200k extra cl100k tokens cl100k extra
|
|
16
|
+
--------------------------------- ------- -------- ------------ ----------- ------------- ------------
|
|
17
|
+
Hindi (hin_Deva) 2 labelled 47 36% 142 79%
|
|
18
|
+
Spanish (spa_Latn) 2 labelled 33 24% 38 34%
|
|
19
|
+
English (eng_Latn) 2 labelled 31 0% 31 0%
|
|
20
|
+
Tamil (tam_Taml) 1 labelled 28 50% 114 87%
|
|
21
|
+
...
|
|
22
|
+
|
|
23
|
+
o200k: 207 tokens. The same meaning in English would take about 148, so about 59 (29%) are language tax.
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
That is `examples/support.jsonl`, ten short customer-support messages.
|
|
27
|
+
|
|
28
|
+
## Commands
|
|
29
|
+
|
|
30
|
+
| Command | What it does |
|
|
31
|
+
|---|---|
|
|
32
|
+
| `yaptax measure FILE` | Tokens per language in a file, and how many are language tax |
|
|
33
|
+
| `yaptax measure FILE --spend 2000` | Also shows the tax in money for a monthly spend |
|
|
34
|
+
| `yaptax measure FILE --lang hi` | Treat every record as one language |
|
|
35
|
+
| `yaptax measure FILE --tokenizers o200k,qwen3` | Choose tokenizers (see below) |
|
|
36
|
+
| `yaptax measure FILE --json` | Machine-readable output |
|
|
37
|
+
| `yaptax ratios Tamil` | The Index's ratios for one language, on all 8 tokenizers |
|
|
38
|
+
| `yaptax demo --open` | The router on a fake provider, with a live savings dashboard (needs `yaptax[router]`) |
|
|
39
|
+
| `yaptax router --config router.toml` | The router in front of your real models, with your own keys |
|
|
40
|
+
|
|
41
|
+
**Input:** `.jsonl`, `.json`, `.csv`, `.tsv`, or plain text with one prompt per line (`-` reads stdin).
|
|
42
|
+
- Text is taken from a `text`, `prompt`, `content`, `input`, `message`, `query` or `question` field, or from chat `messages`. Use `--text-field` for another name.
|
|
43
|
+
- Language is taken from a `lang`, `language` or `locale` field if there is one (`hi`, `hi-IN`, `hin_Deva` and `Hindi` all work). Use `--lang-field` for another name.
|
|
44
|
+
- Without a label, the language is guessed from the writing system. All Devanagari is scored as Hindi, for example. Latin-script text is only scored as English if it looks like English; otherwise it is counted but not scored. Label your data for exact results.
|
|
45
|
+
|
|
46
|
+
## yaptax Router: cut the tax automatically
|
|
47
|
+
|
|
48
|
+
Measuring is step one. The router is step two: an OpenAI-compatible endpoint that sends each request to the cheapest model you allow for its language, and shows what that saved.
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
pip install "yaptax[router]"
|
|
52
|
+
yaptax demo --open
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
`yaptax demo` runs the router against a built-in fake provider, sends 34 multilingual support messages through it and opens a live savings dashboard. Every model gets the same demo price, so the saving you see comes only from tokens. No real model is called and nothing is paid. On the demo set, routing saves 53% against sending every language to Qwen3:
|
|
56
|
+
|
|
57
|
+
| Language | Routed to | Saved |
|
|
58
|
+
|---|---|---|
|
|
59
|
+
| Hindi | gpt-4o | 64% |
|
|
60
|
+
| Tamil | gpt-4o | 68% |
|
|
61
|
+
| Telugu | gpt-4o | 72% |
|
|
62
|
+
| Thai | deepseek-v3 | 31% |
|
|
63
|
+
| Arabic | mistral-nemo | 24% |
|
|
64
|
+
| Amharic, English | qwen3 (baseline) | 0% |
|
|
65
|
+
|
|
66
|
+
For real traffic, write a config with your models, your prices and your keys (see [`examples/router.toml`](https://github.com/NeuroTitan-Hub/yaptax/blob/main/examples/router.toml)), then:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
yaptax router --config router.toml
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
from openai import OpenAI
|
|
74
|
+
client = OpenAI(base_url="http://127.0.0.1:8787/v1", api_key="unused")
|
|
75
|
+
reply = client.chat.completions.create(model="yaptax-auto", messages=[{"role": "user", "content": "मेरा ऑर्डर कहाँ है?"}])
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
How it decides:
|
|
79
|
+
- **Language:** the `x-yaptax-lang` header if you send one; otherwise a guess from the user's text.
|
|
80
|
+
- **Cost:** for each allowed model, input tokens on its tokenizer times its input price, plus an expected answer length on its tokenizer times its output price. OpenAI's tokenizers are counted exactly; others are estimated from the Language Cost Index. It picks the cheapest. On a tie it stays on your baseline.
|
|
81
|
+
- **Pinning:** send a configured model name instead of `yaptax-auto` and the router uses that model, logging it like any other request.
|
|
82
|
+
- **Safety:** per-language `allow`/`deny` rules (from an audit of answer quality). If the chosen model is down (5xx), it retries on your baseline.
|
|
83
|
+
- **Accounting:** the actual cost uses the provider's reported usage. The baseline cost is an estimate of the same request on your baseline, with the answer converted to its tokenizer using the Index ratios.
|
|
84
|
+
- **Privacy:** the log keeps language, models, token counts, costs and timing. No prompt or answer text, and keys stay in your environment.
|
|
85
|
+
- **Endpoints:** `POST /v1/chat/completions` (streaming supported), `GET /v1/models`, `GET /stats`, and the dashboard at `/`.
|
|
86
|
+
|
|
87
|
+
What it doesn't do yet: judge answer quality by itself (use per-language rules), or route by latency.
|
|
88
|
+
|
|
89
|
+
## Tokenizers
|
|
90
|
+
|
|
91
|
+
| ID | Used by | Needs |
|
|
92
|
+
|---|---|---|
|
|
93
|
+
| `o200k` | GPT-4o, GPT-4.1, GPT-5, o3 | built in |
|
|
94
|
+
| `cl100k` | GPT-4, GPT-3.5 | built in |
|
|
95
|
+
| `gpt2` | GPT-2 | built in |
|
|
96
|
+
| `utf8-bytes` | byte-level models | built in |
|
|
97
|
+
| `qwen3`, `deepseek-v3`, `mistral-nemo`, `bloom` | those open models | `pip install 'yaptax[hf]'`; fetched from Hugging Face at the exact revisions the Index used |
|
|
98
|
+
|
|
99
|
+
Anthropic and Google do not publish their tokenizers as files, so they are not here yet.
|
|
100
|
+
|
|
101
|
+
## How "extra tokens" is computed
|
|
102
|
+
|
|
103
|
+
For each language, yaptax divides your token count by that language's ratio to English in the [Language Cost Index](https://neurotitan.in/cost): the same 1,012 FLORES-200 sentences, measured in 204 languages on 8 tokenizers. The difference is the language tax. It is an average, so a single short text can differ.
|
|
104
|
+
|
|
105
|
+
**Checked:** on FLORES-200 devtest, `yaptax measure` gives exactly the token totals published with the Index for Hindi, Tamil and English on o200k, cl100k, Qwen3 and BLOOM.
|
|
106
|
+
|
|
107
|
+
**What it does not tell you:** fewer tokens is not the same as a cheaper or better model. Prices per token differ between models, and so does answer quality in each language. Measuring those on your own traffic is what our Language Cost Audit does: write to the address on [neurotitan.in](https://neurotitan.in).
|
|
108
|
+
|
|
109
|
+
## Develop
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
pip install -e ".[test]"
|
|
113
|
+
pytest
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
MIT licence. The bundled Index data comes from [Sentence-cost-in-Electron](https://github.com/NeuroTitan-Hub/Sentence-cost-in-Electron); FLORES-200 is by Meta AI (CC BY-SA 4.0).
|
|
117
|
+
|
|
118
|
+
By [NeuroTitan Labs](https://neurotitan.in).
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "yaptax"
|
|
7
|
+
version = "0.3.1"
|
|
8
|
+
description = "Measure the language tax in your AI prompts: how many more tokens your non-English users cost."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
authors = [{ name = "NeuroTitan Labs" }]
|
|
13
|
+
requires-python = ">=3.10"
|
|
14
|
+
dependencies = ["tiktoken>=0.7"]
|
|
15
|
+
keywords = ["llm", "tokens", "tokenizer", "multilingual", "cost"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Environment :: Console",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[project.optional-dependencies]
|
|
22
|
+
hf = ["tokenizers>=0.19", "huggingface_hub>=0.23"]
|
|
23
|
+
router = ["fastapi>=0.110", "uvicorn>=0.29", "httpx>=0.27", "tomli>=2; python_version < '3.11'"]
|
|
24
|
+
test = ["pytest>=7", "fastapi>=0.110", "uvicorn>=0.29", "httpx>=0.27", "tomli>=2; python_version < '3.11'"]
|
|
25
|
+
|
|
26
|
+
[project.urls]
|
|
27
|
+
Homepage = "https://neurotitan.in/cost"
|
|
28
|
+
Source = "https://github.com/NeuroTitan-Hub/yaptax"
|
|
29
|
+
Issues = "https://github.com/NeuroTitan-Hub/yaptax/issues"
|
|
30
|
+
|
|
31
|
+
[project.scripts]
|
|
32
|
+
yaptax = "yaptax.cli:main"
|
|
33
|
+
|
|
34
|
+
[tool.setuptools.packages.find]
|
|
35
|
+
where = ["src"]
|
|
36
|
+
|
|
37
|
+
[tool.setuptools.package-data]
|
|
38
|
+
yaptax = ["data/*.json", "router/*.json", "router/*.html"]
|
yaptax-0.3.1/setup.cfg
ADDED