Skip to main content

Connect LiteLLM

LiteLLM is a self-hosted LLM gateway that routes requests to model providers and meters the cost of every call. The LiteLLM integration brings that spend into DoiT Cloud Intelligence — one event per model call, labeled by provider, model, virtual key, team, feature, and end customer — so you can analyze your LLM spend in Cloud Analytics next to your cloud bill.

Because LiteLLM runs in your own infrastructure, this integration works differently from other connectors: instead of DoiT pulling data from a vendor API, you run a small open-source exporter — the litellm-datahub-exporter — next to your proxy. The exporter polls your proxy's spend APIs and pushes events to the DataHub API. Your LiteLLM admin key never leaves your network, DoiT needs no network access into your environment, and the exporter never reads or transmits prompt or response content.

Estimated spend

LiteLLM computes cost from its model price map multiplied by reported tokens — including any custom per-model pricing you configured — rather than from provider invoices. Treat LiteLLM data as showback, not billable actuals. Every event carries a cost_basis: estimated system label, and you can reconcile against provider-side billing using the Anthropic and OpenAI integrations.

Prerequisites

  • A self-hosted LiteLLM proxy, version 1.65 or later, with the database (spend logging) enabled.

  • A DataHub subscription included in your DoiT tier.

  • A DoiT account with the DataHub Admin permission to create the API token.

  • Somewhere to run one small container or binary beside your proxy: Kubernetes, docker-compose, or a VM.

Create a DoiT API token

  1. Sign in to the DoiT console, select your avatar, and then select Profile.

  2. Open the API tab and select Create token.

  3. Select the DataHubAdmin scope, give the token a descriptive name, and copy the displayed token. The full token is shown only once.

Run the exporter

The exporter needs three settings: your proxy URL, a LiteLLM admin virtual key (used only against your own proxy), and the DoiT API token.

docker run -d --name litellm-datahub-exporter \
-e LITELLM_BASE_URL=http://litellm:4000 \
-e LITELLM_API_KEY=sk-... \
-e DOIT_API_KEY=... \
-v litellm-exporter-state:/state -e STATE_FILE=/state/state.json \
ghcr.io/doitintl/litellm-datahub-exporter:latest

On Kubernetes, use the Helm chart from the exporter repository, and run one exporter per LiteLLM deployment — replicated proxy pods share one database, so a single exporter covers them all. See the exporter README for the Helm chart, docker-compose, systemd, and air-gapped deployment options, plus the full configuration reference (poll interval, backfill depth, high-volume daily aggregation mode, and more).

The exporter is open source (Apache-2.0), so your security team can review every line that runs in your environment. Container images and static binaries are published per release, built by a public CI workflow, and signed with keyless cosign — see Verifying a release for the verification commands. If you prefer a binary over a container, download it from the repository's Releases page.

To verify the setup, run a single export cycle with the --once flag. Within about 15 minutes, your spend appears in the DoiT console under DataHub > Datasets > LiteLLM, and in Cloud Analytics reports under the LiteLLM provider.

Label your traffic

Attribution labels come from how your applications call LiteLLM:

  • Customer: set the OpenAI user parameter on each request to your end-customer identifier.

  • Feature: pass metadata: {"spend_logs_metadata": {"feature": "your-feature-name"}} on the request.

  • Team and Virtual key: derived automatically from the LiteLLM key the call was made with. Set key aliases in LiteLLM for readable names.

  • Tag: LiteLLM request tags, from the request body or the x-litellm-tags header.

Reporting dimensions

Cloud Analytics dimensionLiteLLM valueExample
ProviderThe DataHub dataset nameLiteLLM
ServiceThe upstream model provideranthropic, openai, bedrock
SKUThe model name callers requestclaude-sonnet-5

In addition to standard dimensions, the following labels are available:

LabelDescription
provider / modelUpstream provider and model
virtual_keyThe LiteLLM virtual key (alias when set)
teamThe LiteLLM team the key belongs to
featureYour feature name from spend_logs_metadata
customerYour end-customer identifier from the user parameter
tagLiteLLM request tags

Metrics include Cost (estimated), Usage (total tokens), and the DataHub metrics Prompt Tokens and Completion Tokens.

Note

LiteLLM costs appear in the GenAI Intelligence dashboard alongside other supported GenAI providers.

Data refresh and backfill

The exporter polls your proxy every five minutes by default, and events become visible in Cloud Analytics about 15 minutes after they are sent. On first run, set BACKFILL_DAYS to import history; backfill depth is bounded by your LiteLLM spend-log retention settings and DataHub's two-year window. Re-runs are idempotent — restarting the exporter or re-exporting a window updates existing events instead of double-counting them.

Delete your LiteLLM data

Stop the exporter, then delete the LiteLLM dataset under DataHub > Datasets in the DoiT console. Deleting the dataset removes all its events from Cloud Analytics.