Token-Optimized Serialization Format for AI-Native Applications
Project description
Tokon v1.1
Token-Optimized Serialization Format for AI-Native Applications
Tokon is a dual-mode, schema-driven data serialization format designed for maximum token efficiency and human readability.
Inspired by the TOON format, but completely redesigned for AI-native workflows with dual-mode architecture and schema-driven optimization.
Features
- 78% token reduction vs JSON in compact mode
- 53% token reduction vs JSON in human mode
- Dual representation - readable for humans, compact for LLMs
- Schema-driven - stable symbols across projects
- Type-safe - built-in validation
- Streaming-ready - incremental parsing support
- Zero dependencies - pure Python
Installation
pip install tokon
Quick Start
from tokon import encode, decode
# Encode to human-readable format
data = {"name": "Alice", "age": 30, "active": True}
tokon_h = encode(data, mode='h')
print(tokon_h)
# name Alice
# age 30
# active true
# Decode back
decoded = decode(tokon_h, mode='h')
See QUICK_START.md for more examples.
Modes
Tokon-H (Human Mode)
Clean, readable format:
user
name Alice
age 30
active true
Tokon-C (Compact Mode)
Ultra-compact with schemas:
u[n:Alice a:30 x:1]
Documentation
- QUICK_START.md - Get started in 5 minutes
- INSTALLATION.md - Installation guide
- USAGE.md - Complete usage guide
- TOKON_SPEC.md - Full specification
- KNOWN_LIMITATIONS.md - Edge cases
Command Line
# Encode JSON to Tokon
echo '{"name": "Alice"}' | tokon encode -m h
# Decode Tokon to JSON
echo 'name Alice' | tokon decode
Performance
- Token Efficiency: 53-78% reduction vs JSON
- Speed: Comparable to JSON
- Memory: Efficient for large datasets
Requirements
- Python 3.8+
- No dependencies
License
MIT License - see LICENSE file for details.
Version
Tokon v1.1.0 - Production Ready
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tokon-1.1.0.tar.gz.
File metadata
- Download URL: tokon-1.1.0.tar.gz
- Upload date:
- Size: 20.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d0c0bc8754418657735ace59bcc7bc9c653d2fa9349a9415fdd7db71c2c68bb
|
|
| MD5 |
9612723bbac064ef219204aa80211d42
|
|
| BLAKE2b-256 |
7ce75a8a705e6dc3f59955b452defb8a7be8011b2010d8397fec177dd178a9f8
|
File details
Details for the file tokon-1.1.0-py3-none-any.whl.
File metadata
- Download URL: tokon-1.1.0-py3-none-any.whl
- Upload date:
- Size: 21.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e9b07543f56295f298225f68c82cf07a3a9c5927f0224eb1c953ae9c103dbca
|
|
| MD5 |
2ba58cafec692d3521f66327009ead74
|
|
| BLAKE2b-256 |
48f023c9e8e6d9a9ab8c8d0b9084f0c8fb0644bc8f77aa0ecd6614274658cbb1
|