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 ~/.tokenroute/credentials.json (owner-readable only on POSIX).

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.1.0.tar.gz (12.3 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.1.0-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tokenroute-0.1.0.tar.gz
Algorithm Hash digest
SHA256 72cd28f50abc241afe19f6754e9b64f6e47fa0cfff0fe44eaf68fee13878f16e
MD5 2f8bf9ea7eda153d8ce268faa76fc39f
BLAKE2b-256 1a245529b78c8be11807ab1d457b4a1ebc7da7a667b118b949c3366d41e7a697

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tokenroute-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.1 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e300b64f7a3adcf294619cff1dd993c629b046e69a5529a14207e823edd9a352
MD5 f1b0e590dc614bfa58f50dee5c2ad2a8
BLAKE2b-256 58262ed258ea1c9207acc5b82bd50233411d3fbe252eef129c05865f3e8dd5d2

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