Track internal financial movements.
Features:
- Purchase transactions
- Customer payments
- Expenses
- Refunds
- Adjustments
- Cash flow visibility
- Profitability reporting
Support multiple currencies for financial operations.
Features:
- Fiat currencies
- Cryptocurrency currencies
- Custom exchange rates
- Historical conversion support
- USD-based financial reporting
Track operational wallets used for purchasing services.
Features:
- Multiple wallets
- Currency and network tracking
- Transaction movement visibility
Track important administrative changes.
Features:
- Automatic audit logging
- Field-level change history
- User activity tracking
- Sensitive credential protection
- Permission-based API key access
TokenLedger includes an Unfold-powered Django administration dashboard with:
- Revenue overview
- Cost overview
- Net cash flow
- Credit inventory
- Customer summaries
- Provider profitability
- Expiring credits
- Wallet movements
TokenLedger intentionally does not provide:
- AI API proxying
- Token usage tracking
- Request forwarding
- Customer self-service portal
- Billing automation
- Payment gateway integration
These features can be integrated separately when needed.
The Docker image installs GNU gettext and runs python manage.py compilemessages before Gunicorn starts, so Persian admin translations are available in the container. Rebuild the web image after changing files under locale/:
docker compose build web
docker compose up -d- Python 3.12
- Django 5.2 LTS
- Django Unfold administration interface
- MySQL
- mysqlclient
- django-environ
- WhiteNoise
- Gunicorn
TokenLedger follows a Django domain-based architecture:
apps/ ├── core ├── providers ├── wallets ├── customers ├── credits ├── transactions ├── currencies └── customer_credentials
python -m venv .venv
source .venv/bin/activatepip install -r requirements.txt
cp .env.example .env
Configure MySQL:
DB_NAME
DB_USER
DB_PASSWORD
DB_HOST
DB_PORT
API credentials are operational credentials stored in the database.
Access to full API keys is controlled through Django permissions:
view_sensitive_api_key
Only trusted administrators should receive this permission.
- Run migrations python manage.py migrate
- Create administrator python manage.py createsuperuser
- Run development server python manage.py runserver
Admin panel:
Production Deployment
Production requires:
DEBUG=False
SECRET_KEY
ALLOWED_HOSTS
MySQL configuration
HTTPS
Production enables:
Secure cookies CSRF protection HSTS support Clickjacking protection MIME sniffing protection
Validate deployment:
DJANGO_SETTINGS_MODULE=config.settings.production python manage.py check --deploy
python manage.py makemigrations --check --dry-run
python manage.py migrate --plan
python manage.py collectstatic --noinput
Docker
Start services:
docker compose up --build
Create administrator:
docker compose exec web python manage.py createsuperuser
Persistent data:
MySQL data: mysql_data Uploaded media: media_data Project Status
TokenLedger is actively evolving as an internal management platform for AI API resellers.
Current focus areas:
provider management customer management credit inventory financial tracking profitability visibility operational reporting License
TokenLedger is released under the MIT License.