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

print(tokeydokey.generate())
print(tokeydokey.generate(n=5))
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.1.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.1-py3-none-any.whl (318.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tokeydokey-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 88b650f2aea4ec9eee35c5304df863d84bf9ea546889a174468a12bd2a1d7395
MD5 86233f6ce0fc7d09813dfc27cec11bfd
BLAKE2b-256 ae1f9bc1bf854bcaf2b7a9f08853307b51c2bae638d0027221c11df3aa9b1cf2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tokeydokey-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 318.6 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1c02874bbc82cdd71267c2b57f7c6db004d8781bf59555fa2daea8471a08f4ce
MD5 403fa80997f819ee4f363cb3be24216a
BLAKE2b-256 bf97b08ca9cb54f1def4eb6072040856534e75cb38df4d9eeaf834cd3f9dde03

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