Skip to content
Token Controller Docs
Docs / Self-hosting / Configuration

Configuration

The service reads its settings from environment variables. It refuses to start when a required one is missing or wrong, and names the variable to fix.

Variables

Variable Meaning
DATABASE_URL The Postgres connection string. Required.
TC_DATABASE_POOL_SIZE The most database connections one copy of the service opens, from 1 to 100. The default is 10. When you run several copies, keep their sum under your database's connection limit.
TC_PUBLIC_URL The address people and local tools use, starting with https:// or http://. Required.
TC_SECRET_KEY A random string of at least 32 characters for signing sessions and tokens, such as from openssl rand -hex 32. Required.
TC_SMTP_URL The mail server for sign-in links, invites and reminders, such as smtps://user:password@smtp.example.com:465. Required for magic links.
TC_SMTP_FROM The sender of that mail, such as Token Controller <tc@example.com>. Without it, mail comes from noreply@ and the host of TC_PUBLIC_URL.
TC_PRICE_TABLE Optional. The path of your own price table file, a CSV with provider, model, kind, price per million and valid from. Its rows come on top of the built-in table: a row with the same provider, model, kind and valid-from date replaces the built-in one, and a later valid-from date takes over from that day. The file is read at start and again every 15 minutes, so a changed file needs no restart. The service refuses to start on a file it cannot read. See Price table.
TC_RATES_REFRESH on (the default) or off. off stops the daily exchange rate refresh, for instances without internet access. Bills in another currency then need their exchange rate.
TC_CLASSIFIER_URL A System 1 classifier API as the estimator and for deviation labels, such as OpenAI's Decisions API at https://api.openai.com/v1 or a model server of your own. Without it, the instance has no estimates from a classifier and no labels; people still type estimates. Needs TC_CLASSIFIER_MODEL. A self-hosted classifier learns from that instance's data only.
TC_CLASSIFIER_MODEL The classifier model, such as gpt-6-luna. Needs TC_CLASSIFIER_URL.
TC_CLASSIFIER_KEY The API key for TC_CLASSIFIER_URL, if it needs one.
SENTRY_DSN A Sentry project to send the service's errors to. Without it, the service reports errors nowhere. Only errors go: no request bodies, no personal data, no performance samples.
SENTRY_ENVIRONMENT The environment name Sentry shows, such as production. Optional.
RUST_LOG How much the service logs, such as info (the default) or debug.

Without a mail server, someone with access to the container can still sign a member in. This prints a sign-in link that works once and for 15 minutes:

docker compose exec tokencontroller tokencontroller sign-in-link ana@example.com

Every usage endpoint stores what it received for 400 days. After an upgrade whose release notes say it reads more of the telemetry, you may read an organization's stored OpenTelemetry records again. It adds only the model calls and activities not on record yet:

docker compose exec tokencontroller tokencontroller reread 0e000000-0000-4000-8000-000000000001

Every command of the tokencontroller program is listed under CLI.

Price table

Every edition comes with the built-in price table: LiteLLM's price list with our own rows on top, as of the image's build. Newer prices come with the next image. For prices of your own across the instance, write them in a CSV file (the format is under Price tables), point TC_PRICE_TABLE at it and mount it into the container. An org manager can still add rows and overrides in the web app, and those win over the file.

Enterprise plan settings

These switch on the Enterprise plan features in the Enterprise image. The open-source image ignores them.

Variable Meaning
TC_LICENSE_KEY The license key that comes with the contract. Without a valid key, the image works like the open-source one. From 30 days before the key's last day of support, org managers see a renewal notice. The features keep working for 30 days after that day.
TC_TELEMETRY_FORWARD_URL Your collector's OTLP HTTP endpoint, such as https://otel.example.com:4318. Every telemetry batch the service accepts goes there unchanged, before the service removes content text; the signal path, such as /v1/logs, is added.
TC_TELEMETRY_FORWARD_HEADERS Headers for your collector, as name=value,name2=value2, the same as OTEL_EXPORTER_OTLP_HEADERS.

Cloud bill connectors

Each cloud bill connector is on when its settings are set. Once a day it fetches last month's bill and this month's so far; changed figures make a new bill for the range and reverse the old one. A cloud bill is metered and goes to that cloud's only metered contract, or creates one named after it, such as aws_bedrock. Clouds still restate the first days after a month ends, so last month's bill is final from the 6th; move the cutoff after that.

Variable Meaning
TC_BEDROCK_ACCESS_KEY_ID, TC_BEDROCK_SECRET_ACCESS_KEY An AWS access key allowed only ce:GetCostAndUsage. AWS charges a cent per request. TC_BEDROCK_SESSION_TOKEN is for temporary keys.
TC_VERTEX_SERVICE_ACCOUNT, TC_VERTEX_BILLING_TABLE A Google Cloud service account key (JSON) with BigQuery Job User on its project and BigQuery Data Viewer on the billing export dataset, and the export table as project.dataset.table. Google Cloud has no cost API, so the connector reads the billing export.
TC_FOUNDRY_TENANT_ID, TC_FOUNDRY_CLIENT_ID, TC_FOUNDRY_CLIENT_SECRET, TC_FOUNDRY_SCOPE An Entra app registration with Cost Management Reader on the scope, and the scope, such as /subscriptions/<id>.
TC_BEDROCK_SERVICES, TC_VERTEX_SERVICES, TC_FOUNDRY_SERVICES Optional. Comma-separated parts of service names that count as model usage. Defaults: Bedrock bedrock; Vertex vertex ai, claude, gemini; Foundry foundry, azure openai, cognitive services, claude, anthropic.
Last updated 27 November 2026 · Edit this page© 2026 Jan Beck · Privacy · Imprint