# Tokedex > Tokedex is a multi-provider token router: call any provider's models with the API your code already uses, directly or through a self-hosted gateway. ## Docs - [Overview](https://tokedex.artificialanalysis.ai/index.md): What Tokedex does and where to start. ## Get started with the gateway - [Gateway overview](https://tokedex.artificialanalysis.ai/gateway.md): What the self-hosted Tokedex gateway gives your apps and your team, and where each reader starts. - [Gateway quickstart](https://tokedex.artificialanalysis.ai/gateway/quickstart.md): Start the gateway on your own machine, connect a provider, send a first request and see what it cost. ## Call the gateway - [Connect your app](https://tokedex.artificialanalysis.ai/gateway/connect-your-app.md): Keep the OpenAI SDK, the Anthropic SDK, curl or the Tokedex SDK, and send its requests through the gateway by changing the base URL, API key and model ID. - [Connect a coding agent](https://tokedex.artificialanalysis.ai/gateway/coding-agents.md): Point Claude Code, Codex, Copilot, Cursor or another coding agent at the gateway with the setup the dashboard generates, check that it works and fix what goes wrong. - [Find a model](https://tokedex.artificialanalysis.ai/gateway/models.md): List the model IDs your API key can call on your client's API, read what each row says, see which model answered a request, and find out why a model is missing or refused. - [Errors, limits and request IDs](https://tokedex.artificialanalysis.ai/gateway/errors-and-limits.md): Tell an error worth retrying from one that is not, know what a rate limit, a spent budget and a failed stream send back, and label requests so they are easy to find later. - [API reference](https://tokedex.artificialanalysis.ai/gateway/api-reference.md): Look up the gateway's endpoints for each client API, where your API key goes, the headers the gateway reads and returns, and what it does with each request field. ## Access and spend - [People and workspaces](https://tokedex.artificialanalysis.ai/gateway/people-and-workspaces.md): Invite people with a role, keep each team's or project's keys and spend in its own workspace, and change, pause or remove access. - [API keys](https://tokedex.artificialanalysis.ai/gateway/api-keys.md): Create an API key for each app or person, find the keys that need attention, rotate, disable or revoke them, and give scripts an admin key. - [Model access and limits](https://tokedex.artificialanalysis.ai/gateway/model-access-and-limits.md): Choose which workspaces can call each model and provider, cap how long keys live and how fast they call, and review a change before it takes access away. - [Budgets](https://tokedex.artificialanalysis.ai/gateway/budgets.md): Set budgets for keys, people, workspaces, the organisation and models, and see what callers get back when a budget is used up. - [Budget alerts](https://tokedex.artificialanalysis.ai/gateway/budget-alerts.md): Know when spend crosses a budget's thresholds, read alerts in the dashboard or from a script, send them by email, and check what was delivered. - [Spend and usage](https://tokedex.artificialanalysis.ai/gateway/spend-and-usage.md): Read what each workspace, key, person and model spent in a month, and explore calls, tokens and cost over any time range. ## Models and providers - [Provider credentials](https://tokedex.artificialanalysis.ai/gateway/provider-credentials.md): Save the API keys the gateway uses to call each provider, supply them through the environment instead, check which are set, replace one and keep them safe. - [Routers and fallback](https://tokedex.artificialanalysis.ai/gateway/router.md): Create a model ID that sends each request to one of several models and falls back to the next when one fails, and manage the built-in routers. - [Your own model server](https://tokedex.artificialanalysis.ai/gateway/custom-models.md): Serve a model from your own server under a model ID you choose, test it before it serves, and serve any model under an ID of your own. ## Observe - [Find and inspect a request](https://tokedex.artificialanalysis.ai/gateway/requests-and-sessions.md): Find a request by the ID a caller sends you, see which provider and model served it, what it cost and why it failed, and follow a session of related requests. - [What the gateway records](https://tokedex.artificialanalysis.ai/gateway/recording-and-retention.md): Know what the gateway records for each request, turn text capture on, set how long traces are kept, keep content private, check that recording works, and review the audit log. - [Export traces with OpenTelemetry](https://tokedex.artificialanalysis.ai/gateway/export-traces.md): Send a span for every request the gateway serves to your own OpenTelemetry collector or to a service such as Braintrust, Datadog or Langfuse. ## Deploy and operate - [Deploy to production](https://tokedex.artificialanalysis.ai/gateway/deploy.md): Run the gateway in production on Kubernetes with the Helm chart and managed Postgres and Redis, and check that it is ready. - [HTTPS and reverse proxies](https://tokedex.artificialanalysis.ai/gateway/https.md): Serve the gateway over HTTPS through a Kubernetes ingress or NGINX, set its public URL and trusted proxies, and check that sign-in and streaming work through the proxy. - [Single sign-on](https://tokedex.artificialanalysis.ai/gateway/single-sign-on.md): Connect an OpenID Connect identity provider to the gateway, check it and test sign-in, map groups to roles, then require single sign-on. - [Backup and restore](https://tokedex.artificialanalysis.ai/gateway/backup-restore.md): Back up the gateway's state, restore it into a clean place, and check the result before clients return. - [Upgrades and migrations](https://tokedex.artificialanalysis.ai/gateway/upgrades.md): Move the gateway to a new release, apply its database migrations, review what its model catalogue changes, check it, and recover a failed upgrade. - [Recover dashboard access](https://tokedex.artificialanalysis.ai/gateway/recover-access.md): Get back into the dashboard after a refused address, a failed sign-in, a lost master key, password pepper, verifier root or key-encryption key, or unreadable configuration. - [Troubleshooting](https://tokedex.artificialanalysis.ai/gateway/troubleshooting.md): Find the symptom you see on a running gateway, its cause and the fix, and what to put in a report. ## Get started with the SDK - [SDK overview](https://tokedex.artificialanalysis.ai/sdk.md): One Router object that speaks the API your code already uses, for models from OpenAI, Anthropic, Google and other providers, directly or through a gateway. - [SDK quickstart](https://tokedex.artificialanalysis.ai/sdk/quickstart.md): Install the Tokedex SDK, set one provider key and make your first model call in TypeScript, Python or Rust. ## Capabilities - [Generate text](https://tokedex.artificialanalysis.ai/sdk/generate-text.md): Send a request on OpenAI Responses, OpenAI Chat Completions, Anthropic Messages or Gemini GenerateContent, read the reply, and set instructions and generation settings. - [Stream a reply](https://tokedex.artificialanalysis.ai/sdk/streaming.md): Print a model's reply as it is written, on OpenAI Responses, OpenAI Chat Completions, Anthropic Messages or Gemini GenerateContent, and stop, cancel or time out a stream. - [Structured output](https://tokedex.artificialanalysis.ai/sdk/structured-output.md): Ask a model for JSON that matches your schema and get back a typed, validated value. - [Images and files](https://tokedex.artificialanalysis.ai/sdk/images-and-files.md): Send an image or a file, such as a PDF, with your prompt, by URL, from a local file or by a file ID the provider already stores. - [Conversations](https://tokedex.artificialanalysis.ai/sdk/conversations.md): Continue a conversation across calls, with turns the Router stores for you on OpenAI Responses or history you send yourself on the other APIs. - [Batch jobs](https://tokedex.artificialanalysis.ai/sdk/batch.md): Submit many requests as one job on a provider's Batch API with router.batches, then check the job, read its results or cancel it. ## Models and routing - [Choose a model](https://tokedex.artificialanalysis.ai/sdk/models.md): List the models you can call, see which APIs serve each one, call a router and check what a model accepts. - [Translation between APIs](https://tokedex.artificialanalysis.ai/sdk/translation.md): How the Router carries a request written in one API to a provider that speaks another, and how to choose what happens to a field with no equivalent. - [Custom models](https://tokedex.artificialanalysis.ai/sdk/custom-models.md): Add your own model server, such as Ollama or LM Studio, to the Router under a model ID you choose. - [Provider keys](https://tokedex.artificialanalysis.ai/sdk/provider-keys.md): Give the Router a key for each provider whose models you call, from the environment or in code. ## Production - [Run through a gateway](https://tokedex.artificialanalysis.ai/sdk/gateway.md): Send the same Router calls through a Tokedex gateway by changing one line, then send and read its headers, run tools on its models and handle its errors. - [Errors, retries and timeouts](https://tokedex.artificialanalysis.ai/sdk/errors-and-retries.md): Tell a refused call from a failed one, know what the Router retries and when it moves to another provider, and set a timeout or cancel a call. - [Observability](https://tokedex.artificialanalysis.ai/sdk/observability.md): See which provider and model the Router chose for each call, how long it took and how it failed, send call metadata to your own collector, or read the gateway's records instead. ## Your own router - [Routes and failover](https://tokedex.artificialanalysis.ai/sdk/routes-and-failover.md): Build a router from your own provider clients and models, in your order, so a failed call retries or moves to the next route. - [Hooks and sinks](https://tokedex.artificialanalysis.ai/sdk/hooks-and-sinks.md): Change every call on your own routes with hooks, and log or measure every call with sinks. ## Get started with the CLI - [CLI overview](https://tokedex.artificialanalysis.ai/cli.md): What the tdx command does for a running gateway, how to install it and sign in from the browser, and which commands do which job. - [CLI quickstart](https://tokedex.artificialanalysis.ai/cli/quickstart.md): Install tdx, sign in to your gateway from the browser, check the connection and list its workspaces. ## Use the CLI - [Scripts and agents](https://tokedex.artificialanalysis.ai/cli/scripts-and-agents.md): Run tdx from CI jobs, scripts and coding agents. Find the commands, read the JSON output and exit codes, preview writes, retry safely and pass credentials. ## Command reference - [Command reference](https://tokedex.artificialanalysis.ai/cli/reference.md): Every tdx command group, and the flags, environment variables, exit codes and behaviour all commands share. - [tdx admin](https://tokedex.artificialanalysis.ai/cli/reference/admin.md): Inspect gateway administration capabilities. - [tdx alert-channels](https://tokedex.artificialanalysis.ai/cli/reference/alert-channels.md): Alert destinations and Slack setup (dashboard only). - [tdx alerts](https://tokedex.artificialanalysis.ai/cli/reference/alerts.md): Read and mark spend alerts in your inbox. - [tdx api](https://tokedex.artificialanalysis.ai/cli/reference/api.md): Send an admin HTTP request. - [tdx api-keys](https://tokedex.artificialanalysis.ai/cli/reference/api-keys.md): Manage API keys (tokedex_ik_). - [tdx audit](https://tokedex.artificialanalysis.ai/cli/reference/audit.md): Read and follow the audit log (the dashboard's Events tab). - [tdx auth](https://tokedex.artificialanalysis.ai/cli/reference/auth.md): Sign in with the browser or a token, and manage saved profiles. - [tdx budgets](https://tokedex.artificialanalysis.ai/cli/reference/budgets.md): Manage spend budgets. - [tdx completion](https://tokedex.artificialanalysis.ai/cli/reference/completion.md): Generate shell completion. - [tdx config](https://tokedex.artificialanalysis.ai/cli/reference/config.md): Inspect compiled gateway configuration. - [tdx doctor](https://tokedex.artificialanalysis.ai/cli/reference/doctor.md): Check connection, auth, catalogue and backend information. - [tdx guide](https://tokedex.artificialanalysis.ai/cli/reference/guide.md): Print bundled agent getting-started material. - [tdx identity-settings](https://tokedex.artificialanalysis.ai/cli/reference/identity-settings.md): Inspect sign-in and session settings. - [tdx invites](https://tokedex.artificialanalysis.ai/cli/reference/invites.md): Manage one-shot invitation links. - [tdx limits](https://tokedex.artificialanalysis.ai/cli/reference/limits.md): Read the calling API key's budgets and rate limits. - [tdx models](https://tokedex.artificialanalysis.ai/cli/reference/models.md): Models callers can request from this gateway. - [tdx observability](https://tokedex.artificialanalysis.ai/cli/reference/observability.md): Read inference traces and calls, the store status and its switch. - [tdx open](https://tokedex.artificialanalysis.ai/cli/reference/open.md): Print or open the logged-in host dashboard. - [tdx pricing](https://tokedex.artificialanalysis.ai/cli/reference/pricing.md): Inspect prices and manage price overrides. - [tdx profile](https://tokedex.artificialanalysis.ai/cli/reference/profile.md): Your own gateway account profile (not a local connection profile). - [tdx providers](https://tokedex.artificialanalysis.ai/cli/reference/providers.md): Manage provider credentials. - [tdx schema](https://tokedex.artificialanalysis.ai/cli/reference/schema.md): Print the command tree. - [tdx sessions](https://tokedex.artificialanalysis.ai/cli/reference/sessions.md): Inspect sessions; interactive revocation is unavailable. - [tdx spend](https://tokedex.artificialanalysis.ai/cli/reference/spend.md): Read spend counters and settlements. - [tdx sso-providers](https://tokedex.artificialanalysis.ai/cli/reference/sso-providers.md): Inspect SSO (OIDC sign-in) providers. - [tdx usage](https://tokedex.artificialanalysis.ai/cli/reference/usage.md): Read usage reports. - [tdx users](https://tokedex.artificialanalysis.ai/cli/reference/users.md): Manage people and their role assignments. - [tdx workspaces](https://tokedex.artificialanalysis.ai/cli/reference/workspaces.md): Manage workspaces, their policy and spend. ## Resources - [For agents](https://tokedex.artificialanalysis.ai/for-agents.md): A compact guide for coding agents: the machine-readable docs, the SDK, gateway and CLI quickstarts, and how to check a setup.