Skip to main content

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

Project description

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

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

tokenroute-0.2.0.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tokenroute-0.2.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file tokenroute-0.2.0.tar.gz.

File metadata

  • Download URL: tokenroute-0.2.0.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for tokenroute-0.2.0.tar.gz
Algorithm Hash digest
SHA256 fbc9382b6e01a1885efc4c6abd86ee713669bca0c7d2ae42e53691ad6d891a92
MD5 d604e1108f0ec8aff319d316fada0ebc
BLAKE2b-256 89dabadaf3180e4e56580f6a529c221ca61bf3428e7c3c5d516e09ce828da8b9

See more details on using hashes here.

File details

Details for the file tokenroute-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: tokenroute-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for tokenroute-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4f4cb1b53e57f2ddf918f3606bd99628cd2f86966767e9e6a9e6cba3e1e21c00
MD5 3fea4f7f2d1cd37d3f07ed23d70d170b
BLAKE2b-256 87a96f852c57bb500860820b9528be064b0eec4ddcb5c2bf2c54509bfd53b8a4

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