Skip to main content

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 add tokeydokey
uv run python - <<'PY'
import tokeydokey

print(tokeydokey.generate())
# e.g. "cache.Enable-Thread.sort" (4 by default)
print(tokeydokey.generate(n=5))
# e.g. "db.Connection-Reset.queue.ready"
PY

Development

uv sync --group dev
uv run pytest

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


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.2.tar.gz (357.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tokeydokey-1.0.2-py3-none-any.whl (318.7 kB view details)

Uploaded Python 3

File details

Details for the file tokeydokey-1.0.2.tar.gz.

File metadata

  • Download URL: tokeydokey-1.0.2.tar.gz
  • Upload date:
  • Size: 357.5 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

Hashes for tokeydokey-1.0.2.tar.gz
Algorithm Hash digest
SHA256 eb8227cd93ddf5e9f217b5eae2a6c8b0b847224320a774d64424b20fafaf61b8
MD5 a0a98da6fa2b0b5d2b6f305dce3e61bc
BLAKE2b-256 7d17804fbb8aa9fbe097098c4aa15a5f04e7d72d2f8d8455f691462f2ee15196

See more details on using hashes here.

File details

Details for the file tokeydokey-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: tokeydokey-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 318.7 kB
  • Tags: Python 3
  • 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

Hashes for tokeydokey-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 27f9766a790d9bf8ec8e82418a0862b6a2dff3dc51a980b4c559d9acd67fb6cd
MD5 0a6388b82f0ffe6410507bf8472d75fc
BLAKE2b-256 29d37d9b2924c931018fe17aa07cb81dc1a8e42e6173806a9ce4d96004337656

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page