Skip to main content

PyPI version License: MIT Downloads LinkedIn

llm7token

llm7token is a lightweight Python utility for working with encrypted access tokens issued by the LLM7 API. It allows local validation, existence checking, and usage stat submission without requiring database access.

Installation

To install llm7token, use pip:

pip install llm7token

Usage

Set required environment variables:

export LLM7_SECRET_KEY="your-secret"
export LLM7_TOKEN_URL="https://llm7-api.chigwel137.workers.dev"
export LLM7_SALT="some-salt"

Validate token (decrypt and check expiration)

from llm7token import is_token_valid

valid = is_token_valid("your_token_string")
print(valid)  # True or False

Introspect a token via API

from llm7token import introspect_token

info = introspect_token("your_token_string")
print(info)  # e.g., {"email": "...", "sub": 1} or {"error": "..."}

Check if token exists remotely

from llm7token import token_exists

exists = token_exists("your_token_string")
print(exists)  # True or False

Submit usage stats to the API

from llm7token import record_usage

success = record_usage(
    email="user@example.com",
    token_value="your_token_string",
    model="gpt-4",
    tokens_in=123,
    tokens_out=456
)
print(success)  # True or False

Features

  • Secure AES-GCM token decryption using PBKDF2 with SHA-256
  • Offline token expiration validation
  • Remote token introspection via /tokens/introspect
  • Remote token existence check
  • API usage logging via /admin/stats endpoint
  • Minimal dependencies: cryptography, requests

Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.

License

llm7token is licensed under the MIT License.

Metadata

Release files for llm7token 2025.12.51256

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llm7token 2025.12.51256
File Size Uploaded Provenance
llm7token-2025.12.51256.tar.gz 16.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for llm7token 2025.12.51256
File Interpreter ABI Platform
llm7token-2025.12.51256-py3-none-any.whl Python 3 none any Details

Total release size: 32.4 kB

Release files / llm7token-2025.12.51256.tar.gz

Download URL llm7token-2025.12.51256.tar.gz
Size 16.2 kB
Tags Source
SHA-256 checksum
How to use checksums
34eb6b55ea587c169c59118286df7f0725013d12df97e40efa8200110513b7d1
BLAKE2b-256 checksum
How to use checksums
0dc0ae6fa9650e9eb7586d9e57f3e2af7472bfd9042e7abc721b90dd645bd299
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.11

Release files / llm7token-2025.12.51256-py3-none-any.whl

Download URL llm7token-2025.12.51256-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a394f0123825999578d2793d736464012266871ea08a480975500f44b60885e8
BLAKE2b-256 checksum
How to use checksums
ae4268ec99c5819905f9e82f9861c38a51e857fb3d42fb8c2ae3886b405e3f33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.11

Security for llm7token 2025.12.51256

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page