Skip to main content

tokenroute (Python CLI)

Agent-first CLI for tokenroute — the OpenAI-compatible LLM API gateway with smart routing and transparent token billing.

Install

pip install tokenroute
# or, run once without installing:
uvx tokenroute --help
pipx run tokenroute --help

Quickstart

tokenroute login                                 # OAuth device-flow, opens browser
tokenroute whoami                                # current user + balance
tokenroute keys create --name my-app             # create new sk-tr-* key
tokenroute balance                               # current credit

All commands accept --json (or env TOKENROUTE_JSON=1) for machine-parseable output that's friendly to agents and CI.

Agent / sub-agent usage (no interactive login)

For automation, skip tokenroute login and call the OpenAI-compatible API directly with a pre-issued key:

export TOKENROUTE_API_KEY=sk-tr-...
curl https://api.tokenroute.io/v1/chat/completions \
  -H "Authorization: Bearer $TOKENROUTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"openai/gpt-4o-mini","messages":[{"role":"user","content":"hi"}]}'

Configuration

Env var Default Purpose
TOKENROUTE_API_URL https://api.tokenroute.io Override gateway base URL
TOKENROUTE_API_KEY (unset) sk-tr-* key for LLM calls — skips login
TOKENROUTE_JSON (unset) Set to 1 to force JSON output globally

Credentials from tokenroute login are stored at ~/.paradigx/auth.json (owner-readable only on POSIX) — shared with other Paradigx CLIs (e.g. botu) and auto-refreshed, so login is a one-time step per machine. Upgrading from 0.1.x migrates the old ~/.tokenroute/credentials.json automatically on first run.

License

MIT

Metadata

Release files for tokenroute 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tokenroute 0.2.0
File Size Uploaded Provenance
tokenroute-0.2.0.tar.gz 8.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for tokenroute 0.2.0
File Interpreter ABI Platform
tokenroute-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.3 kB

Release files / tokenroute-0.2.0.tar.gz

Download URL tokenroute-0.2.0.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
fbc9382b6e01a1885efc4c6abd86ee713669bca0c7d2ae42e53691ad6d891a92
BLAKE2b-256 checksum
How to use checksums
89dabadaf3180e4e56580f6a529c221ca61bf3428e7c3c5d516e09ce828da8b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / tokenroute-0.2.0-py3-none-any.whl

Download URL tokenroute-0.2.0-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f4cb1b53e57f2ddf918f3606bd99628cd2f86966767e9e6a9e6cba3e1e21c00
BLAKE2b-256 checksum
How to use checksums
87a96f852c57bb500860820b9528be064b0eec4ddcb5c2bf2c54509bfd53b8a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for tokenroute 0.2.0

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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page