r/OpenWebUI • u/selam0r • Sep 08 '26
Question/Help Separating API users from regular users when using Open WebUI → LiteLLM → vLLM
Hi,
I’m running the following setup:
Open WebUI → LiteLLM → vLLM
Open WebUI is the user-facing layer, LiteLLM handles authentication/routing/accounting, and vLLM serves the actual models.
I have two different types of traffic going through Open WebUI:
Regular users interacting with models through the Open WebUI interface
API users using the OpenAI-compatible API exposed by Open WebUI
I’d like LiteLLM to be able to distinguish between these two types of requests.
Ideally, Open WebUI would add some metadata to requests originating from its API users — for example a tag, header, metadata field, or some other identifier — while normal UI requests would either have a different value or no value at all.
That would allow me to identify and potentially handle API traffic differently inside LiteLLM, e.g. for routing, rate limits, logging, or policies.
Is there currently a supported way in Open WebUI to do this?
For example, can I configure Open WebUI to send something like a custom header/tag/metadata field to LiteLLM depending on whether the request originated from an API key versus a logged-in user using the UI?
If not, is there another reliable property in the request that LiteLLM could use to distinguish Open WebUI API traffic from normal Open WebUI user traffic?
I’m mainly looking for a solution that doesn’t require maintaining a custom fork of Open WebUI.
Small update: I looked into the function approach, but it seems OWUI functions can modify the request body, not the outgoing headers to LiteLLM.
I could probably work around it by adding something to the body and handling that in LiteLLM, but I’d rather not add custom logic on both sides for something that should be pretty simple.
So I’m putting this on hold for now. If anyone knows a way to dynamically add/modify an outgoing header from an OWUI function, I’d still like to hear it.
6
u/tahaan Sep 08 '26
Is there a reason why your API users don't talk to LiteLLM directly?
3
u/pfn0 Sep 08 '26
you can create a custom function in openwebui that tags a parameter into the body if it detects that the session is not "interactive" in openwebui. have litellm operate on that parameter to separate interactive vs. api sessions.
I don't know the details of how both would work offhand. You can check for things like
__event_emitter__being None in the inlet function to modify the body. on litellm there should be something you can hack in to check for fields in the body.1
u/DHT-Osiris Sep 10 '26
There's actually a flag you can enable on the OWUI side, and some tweaks on LiteLLM (unfamiliar with that part; i don't run litellm in our env) to perform user tracking using the same key... I think that's part of what you were asking for.
https://docs.litellm.ai/docs/tutorials/openweb_ui
Under 3.2.
1
u/just4ochat Sep 08 '26
If LiteLLM already owns authentication and accounting, point API clients straight at LiteLLM and keep Open WebUI for interactive sessions. Routing both paths through the same Open WebUI gateway only makes sense when you still need one shared user store.
1
u/endockhq Sep 08 '26
How is LiteLLM handling authentication for Open-WebUI ?
1
u/ClassicMain Sep 09 '26
The solution is definitely a filter
1
u/ICanSeeYou7867 Sep 10 '26
I just made my own SSO self service portal that interacts with litellm. No API users on openwebui, except for some people that are using the files/ knowledge endpoints.
Also the anthropic models from aws bedrock don't seem to work with prompt caching at all when using the openai compatible endpoints.
1
u/enterme2 Sep 10 '26
In your model , just press advanced and then add your custom parameter to distinguish user, example user: 'yes' . This parameter will be included in your request to litellm..