TokenLab Python SDK
Lightweight Python client for TokenLab discovery, OpenAI-compatible APIs, and native endpoint families.
Install from PyPI:
pip install tokenlab-ai
Usage
from tokenlab import TokenLabClient
with TokenLabClient(api_key="YOUR_TOKENLAB_API_KEY") as tokenlab:
models = tokenlab.list_models(category="chat")
response = tokenlab.create_response({
"model": "gpt-5.5",
"input": "Hello from TokenLab",
})
Native Endpoints
tokenlab.create_anthropic_message({
"model": "claude-sonnet-5",
"max_tokens": 512,
"messages": [{"role": "user", "content": "Hello"}],
})
tokenlab.create_gemini_content("gemini-3.5-flash", {
"contents": [{"role": "user", "parts": [{"text": "Hello"}]}],
})
Discovery Helpers
tokenlab.get_models_json()
tokenlab.get_pricing_json()
tokenlab.get_integrations_json()
System One decisions
Discover tokenlab.list_models(category="decision") and inspect the selected model with get_model() first. Decision models declare the systemone public operation, not a chat format.
with TokenLabClient(timeout=60.0) as tokenlab:
decision = tokenlab.evaluate_decisions({
"model": "jev-1.13",
"state": {"ticket": "Please refund my duplicate charge."},
"questions": {"refund": {"type": "noul", "instructions": "Is a refund requested?"}},
})
print(decision["answers"], decision["usage"])
The client reads TOKENLAB_API_KEY from the environment. This synchronous /v1/systemone call preserves typed answers, probabilities, optional confidence, and usage. It is not Chat, streaming, or Batch. A decision does not authorize a refund or another side effect. Errors are returned without automatic resubmission. Available in SDK 0.1.2+.
Base URLs
- API:
https://api.tokenlab.sh - OpenAI-compatible SDK base URL:
https://api.tokenlab.sh/v1 - OpenAPI:
https://tokenlab.sh/docs/openapi.json
Metadata
Release files for tokenlab-ai 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tokenlab_ai-0.1.4.tar.gz | 4.0 kB | Without provenance | Details for tokenlab_ai-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tokenlab_ai-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for tokenlab_ai-0.1.4-py3-none-any.whl |
Total release size: 8.2 kB
Release files / tokenlab_ai-0.1.4.tar.gz
| Download URL | tokenlab_ai-0.1.4.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9aa4e7727de6a3884dc683b68e847aaad3170e77090f2d94c1ac80e7a74b4caa
|
|
BLAKE2b-256 checksum How to use checksums |
8d059c60dbfd9cdcea0429e520e4ed82405cfa12b02141a655f58959ccc020b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / tokenlab_ai-0.1.4-py3-none-any.whl
| Download URL | tokenlab_ai-0.1.4-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7b042604c04604ed61885ec801f6c3cac0f1ae4c0b9fb8c17f1d75fcdcc19421
|
|
BLAKE2b-256 checksum How to use checksums |
3012ef03b9433683871f66d1c552a86fdcd9a2e1a7d025131d1306810d37198c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Security for tokenlab-ai 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.