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

Uploaded Python 3

File details

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

File metadata

  • Download URL: llm7token-2025.9.151722.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.151722.tar.gz
Algorithm Hash digest
SHA256 c739fbb620ead12dfacb86ab5257b6d2c50be554b8467cf28ada4e6262eca3ee
MD5 2d1e96c4ff3c8c4427c4bba6c3eab1d1
BLAKE2b-256 314a7b1696e150a0f93e9d2d10e1ad7abc0a958c2b91df555fad82ffd99371c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llm7token-2025.9.151722-py3-none-any.whl
Algorithm Hash digest
SHA256 bda18dcd82d20f6cffe44e69602af84e13de3c02131121c186c4dab99f8035a6
MD5 4899f8b83b0e5b54d0d145e0e1be3427
BLAKE2b-256 d8d2d0ad4a84ede3d40141cdbf7475a9d8a4bd368567b29997f3af424c7e14ef

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