Tokedex
Open-source token router and gateway from Artificial Analysis that routes, observes and budgets requests to language models across providers.
At a Glance
About Tokedex
Tokedex is an open-source router and token management gateway from Artificial Analysis, released under the MIT license. It sits between applications or coding agents and model providers, routing requests, recording traces and enforcing spend budgets. It can be run as a self-hosted gateway container or used as an SDK in TypeScript, Python and Rust.
What It Is
Tokedex is a token router with two ways to use it. The gateway is a self-hosted server that holds provider credentials, while clients call it with API keys you issue. The SDK is a library that calls providers from your own process, reading provider keys from your environment. The same code can run through a gateway by changing the line that creates the Router.
The gateway works with the Tokedex SDK, OpenAI and Anthropic clients, and coding agents such as Claude Code, Codex and Cursor. It accepts OpenAI Chat Completions, OpenAI Responses and Anthropic Messages API formats, so an agent like Claude Code can be pointed at models from other providers.
Benchmark-based routing
Tokedex uses Artificial Analysis intelligence, speed and cost benchmarks to pick a model automatically for a given constraint. One example from the docs is choosing the cheapest model scoring 50+ on the Intelligence Index. Routes can also include smart retries and fallback models to keep agents available, and users can build a router from their own routes, with hooks and sinks.
Observability, budgets and teams
The gateway records a trace of every request with its model, tokens, latency and cost, and the project states that no data is sent to a third party. Teams get workspaces with their own API keys, roles and budgets. Spend budgets and alerts, scoped API keys and SSO are documented. A dashboard also generates setup for connecting coding agents.
Setup path
The gateway is started from the repository with Docker Compose (or npm), and it prints a master key to sign in to the dashboard at port 4000. For production, a Helm chart is documented for Kubernetes deployment. The SDK installs via npm, uv or cargo. The project accepts issues but not outside pull requests.
Collections
Popular collections
- Pick Up Where Your Agent Left Off
Collection by @caiovalverde
- UI Design Skills for Coding Agents
Collection by @mayachen
- Find the Ways Your AI App Can Fail Before Launch
Collection by @samirhaddad
- Give Your AI Agent the Meaning Behind Your Database
Collection by @danielokafor
Add Tokedex to one of your collections.
Community Discussions
Be the first to start a conversation about Tokedex
Share your experience with Tokedex, ask questions, or help others learn from your insights.
Pricing
Open Source (MIT)
Self-hosted open-source token router gateway and SDKs under the MIT license. Provider/inference costs are paid separately to the model providers.
- MIT licensed gateway and SDKs (TypeScript, Python, Rust)
- Run the gateway as a container in your cloud
- Routing on Artificial Analysis benchmarks
- Observability, spend budgets and alerts
- Workspaces, API keys, roles and SSO
Capabilities
Key Features
- Use OpenAI Chat Completions, OpenAI Responses or Anthropic Messages APIs with any model
- Use Claude Code and other coding agents with models from other providers
- Routing on Artificial Analysis intelligence, speed and cost benchmarks
- Request traces with model, tokens, latency and cost
- Spend budgets and alerts
- Scoped API keys, roles, SSO and team workspaces
- Smart retries and fallback models
- SDKs for TypeScript, Python and Rust with streaming, structured output and tool calling
- Self-hosted gateway via Docker or Kubernetes Helm chart
- MIT-licensed open source
