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

Uploaded Python 3

File details

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

File metadata

  • Download URL: llm7token-2025.9.160752.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.160752.tar.gz
Algorithm Hash digest
SHA256 435f128bd793f3e141dbebf9005c5433d27f8e54a243c9bded13e8cc85605868
MD5 fd36cfc1391bc4e65122016589fb283d
BLAKE2b-256 08ac420379a985731f5889015454aab08c5540be80cf7c60c574076694c253d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llm7token-2025.9.160752-py3-none-any.whl
Algorithm Hash digest
SHA256 c87444b49d470eb0ecb8b60b2db4b7cf6a04f3e5ba40002a8904623ffe137e76
MD5 14af5dca69308a5f9b46e627ee96c4de
BLAKE2b-256 71bce16037c676f8698b5605a1f2fe9a60dd70d6e4a28d4f5548966c52d292df

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