Skip to main content
Send a per-user identifier with completion requests so LiteLLM can attribute spend and apply customer budgets. This is attribution only. Langdock does not authenticate to LiteLLM with each user’s token, and it does not show LiteLLM spend back in Langdock. The setup is the same on Cloud and Dedicated until you create the model key. Dedicated keys also show Authentication method. Keep API Key for spend attribution.
User identifier appears on completion models only, in the catalog and in manual setup. Image and embedding wizards do not include it.

Prerequisites

  • Admin access to your Langdock workspace
  • A LiteLLM proxy reachable over HTTPS
  • The model alias from your LiteLLM config
  • An API key if your proxy requires authentication
Langdock blocks requests to private IPs, localhost, and internal hostnames. Contact support@langdock.com if you need to reach an internal LiteLLM endpoint.

Connect LiteLLM

1. Open the model wizard

Go to Workspace Settings -> Models and click Add custom model. Models page with All, Completion, Image, and Custom filters, search, and Add custom model

2. Start from the catalog or set up manually

Pick a completion model from the catalog if LiteLLM serves a model Langdock already ships. Otherwise click set up manually. Add model wizard on Select Models, with catalog cards and set up manually in the footer For a manual model, fill Model Name and Provider Model Name. Those names are what Langdock shows in the picker. The LiteLLM alias belongs on the deployment in the next steps.

3. Set User identifier

On Configure, open Advanced and set User identifier. Choose Microsoft UPN when LiteLLM customers are keyed by Microsoft login. User identifier set to Microsoft UPN, with the dropdown open on None, User ID, E-Mail, and Alternative email Click Continue.

4. Add the LiteLLM key

On Deployment, click New Key. Set Provider SDK to OpenAI Compatible, Base URL to your proxy (for example https://litellm.example.com/v1), API Key to the proxy key, and Hosting Provider to a name your team will recognize.
Cloud keys do not show Authentication method. The proxy key is enough.Create new API key for OpenAI Compatible with Base URL https://litellm.example.com/v1, API Key, and Hosting Provider LiteLLM
Set Model Name / ID to the LiteLLM alias (the same value you put in LiteLLM model_name).
Custom headers on the model key are fixed text. They cannot include a per-user placeholder. Do not try to send x-litellm-end-user-id that way.
Click Save key, then Test & continue.

5. Save the model

On Review, confirm the deployment and that User identifier is set. Click Save model. Review step showing LiteLLM GPT-4o, the gpt-4o deployment on LiteLLM proxy, and User identifier set to userPrincipalName For the rest of the OpenAI-compatible fields, see Setup Guides.

Choose a User identifier

Microsoft UPN is the right choice when LiteLLM customers are keyed by Microsoft login. Langdock stores that value from Microsoft sign-in. Other login methods may leave UPN empty.

Map the identifier in LiteLLM

The header name is always x-user-id. You cannot change it. If the model uses the OpenAI or Azure SDK, Langdock also sends a request-body user field when the identifier is non-empty. LiteLLM treats that body field as the customer ID with no extra config. LiteLLM through OpenAI Compatible sends the header only. Map it in the LiteLLM config.yaml:
After this mapping, LiteLLM can track spend and apply customer budgets per identifier. See LiteLLM customers. If LiteLLM validate_end_user_id_in_db is on, the identifier is accepted only when it already matches a LiteLLM customer or an internal user’s ID or email. Create those customer records in LiteLLM before you rely on that setting.
On OpenAI Compatible, Langdock sends the identifier only as x-user-id. Map that header in LiteLLM. The user field in the request body is not sent on this SDK.

Limits

  • Each completion model sends one identifier. You cannot send two fields at once.
  • Empty x-user-id values (missing UPN or alternative email) still include the header. How LiteLLM treats an empty customer ID is up to your proxy.
  • This does not replace per-user gateway tokens. Attribution and token-based auth are separate.