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.151721.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.151721-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llm7token-2025.9.151721.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.151721.tar.gz
Algorithm Hash digest
SHA256 d983436e4963a642937e4dcc42e5636b1a3d099cc3fe134d0010d79366b76da6
MD5 3a82ddd173f696290923dfaf4c3774a4
BLAKE2b-256 7a39f29a209b80c23a9d5ccce079ea0f3d25e1a7b64a05b7c9bdb84e0c83f2c6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llm7token-2025.9.151721-py3-none-any.whl
Algorithm Hash digest
SHA256 5dcba06637b162ce7da371db6fb626b1f7ec6eec636c4d636cd14d25ff02a5d7
MD5 dc2aad84b74cac5303d1fdd7deafc37a
BLAKE2b-256 b62ccba27e236b55cde1ea09203f8697a4356788e61f245b3625a34b69b401f4

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