Create random identifiers using a fixed number of non-overlapping LLM tokens.
Project description
tokeydokey
Create random identifiers using a fixed number of non-overlapping LLM tokens.
Quick start
uv sync
uv run python - <<'PY'
import tokeydokey
print(tokeydokey.generate())
print(tokeydokey.generate(n=5))
PY
Regenerate pools
uv run python scripts/generate_pools.py
uv run python scripts/generate_pools.py --encoding cl100k_base --out src/tokeydokey/_pools.py
Example pool math (o200k_base, dot/dash union)
Start pool N = 3.89×104 (alnum tokens), next pool M = 6.38×103 (".word" or "-word").
| Tokens | Combinations | Tokens | Combinations | Tokens | Combinations |
|---|---|---|---|---|---|
| 1 | 3.89×104 (~215) | 5 | 6.46×1019 (~266) | 9 | 1.07×1035 (~2116) |
| 2 | 2.49×108 (~228) | 6 | 4.12×1023 (~278) | 10 | 6.83×1038 (~2129) |
| 3 | 1.59×1012 (~241) | 7 | 2.63×1027 (~291) | 11 | 4.36×1042 (~2142) |
| 4 | 1.01×1016 (~253) | 8 | 1.68×1031 (~2104) | 12 | 2.78×1046 (~2154) |
Note: For ~128 bits of entropy, base64 needs 22 chars (132 bits) which average ~15.2 tokens in o200k_base; dot/dash union needs ~10 tokens. This is roughly 50% more token-efficient than random base64 identifiers.
Alternatives considered
- CamelTitle (Titlecase 2-12 chars): pool size 8,482, 100% compatible for concatenation.
- Word/(Word+Number) alternating: union pool size 9,482 (adds 0-999), 100% compatible.
- Dot-only: next pool 4,410, 100% compatible.
- Base62: around 8.6 bits per token in o200k_base; token count varies.
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
tokeydokey-1.0.0.tar.gz
(357.4 kB
view details)
File details
Details for the file tokeydokey-1.0.0.tar.gz.
File metadata
- Download URL: tokeydokey-1.0.0.tar.gz
- Upload date:
- Size: 357.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
912dface1b78929cd4ba39c3f88e164131d53defb2056c58692f3173c56e01ae
|
|
| MD5 |
83987f23263308caa09a703084403d4d
|
|
| BLAKE2b-256 |
71bc70469f9596ed24038a9f3c96b2cd3598d759cf337005a36799cda9545c63
|