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

Uploaded Python 3

File details

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

File metadata

  • Download URL: llm7token-2025.9.151718.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.151718.tar.gz
Algorithm Hash digest
SHA256 0dbd106804860c4eee4b5f7ee87f16d02e37023eae63f7f9af7cd34bdd015be6
MD5 648f1d3a7e26caddcebec69d28dc681a
BLAKE2b-256 9e7123fda1680289ec7f7cf5e159190e7e4b49f0bf45b87cbf265555aa8e1c11

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llm7token-2025.9.151718-py3-none-any.whl
Algorithm Hash digest
SHA256 4aa7a5f9baf9303a01870af76906c35401c1558faa2b991a34ea109a01ef120e
MD5 92f192a538e7c84a036c300f0bf6077d
BLAKE2b-256 355c3872291f3af9f2ab448716f7199b1beb2943e771bbd527b3a0b5eac12a15

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