Skip to main content

Utilities for validating and reporting LLM7 API tokens.

Project description

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

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 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.

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

llm7token-2025.9.151720.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

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

llm7token-2025.9.151720-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file llm7token-2025.9.151720.tar.gz.

File metadata

  • Download URL: llm7token-2025.9.151720.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.11

File hashes

Hashes for llm7token-2025.9.151720.tar.gz
Algorithm Hash digest
SHA256 c850fe49a370eed616bc6661f52b39966af3b950ef4493e78a164bed3046349e
MD5 377d130815e8646b924fbceda4e793b7
BLAKE2b-256 c2c1656b287a16132886c82d79b43593cb2cf7be96e9f5eaea3f217f8a5981d1

See more details on using hashes here.

File details

Details for the file llm7token-2025.9.151720-py3-none-any.whl.

File metadata

File hashes

Hashes for llm7token-2025.9.151720-py3-none-any.whl
Algorithm Hash digest
SHA256 2cb4bcd7222eac7e62aa9a0a881da2ff4472abe709b2360c7b616d8ce546afec
MD5 c86321a0a22b863e01afc635eea3bc43
BLAKE2b-256 e3b5e5eb25a66c436fe0c1f2649f895e71f21e7473493ca34c56685b1ca52b93

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