6 views
-/https://github.com/berriai/litellm/issues/33123
GitHub · issue

#33123 Make CORS expose_headers configurable (LITELLM_CORS_EXPOSE_HEADERS) so browser clients can read x-litellm-* response headers

  • State: open
  • Author: @astefanutti
  • Labels: llm translation

Allow configuring the proxy's `Access-Control-Expose-Headers` — e.g. via a new `LITELLM_CORS_EXPOSE_HEADERS` env var (comma-separated), mirroring the existing `LITELLM_CORS_ORIGINS` — so browser-based clients calling the proxy cross-origin can read the useful `x-litellm-*` response headers (notably `x-litellm-response-cost` and `x-litellm-model-api-base`).

Today `expose_headers` is hardcoded:

> `app.add_middleware(CORSMiddleware, allow_origins=origins, allow_credentials=allow_cors_credentials, allow_methods=["*"], allow_headers=["*"], expose_headers=LITELLM_UI_ALLOW_HEADERS)`

`origins`/credentials are env-configurable (`LITELLM_CORS_ORIGINS`, `LITELLM_CORS_ALLOW_CREDENTIALS`), but `expose_headers` is fixed to the `LITELLM_UI_ALLOW_HEADERS` constant with no override. On v1.84.0 the actual exposed set is only:

> `access-control-expose-headers: x-litellm-semantic-filter, x-litellm-semantic-filter-tools, x-litellm-adaptive-router-model`

**Motivation / pitch**

A browser app that talks to the proxy directly (OpenAI-compatible client) can't read cost or backend info, even though the proxy already returns it on every completion:

> `x-litellm-response-cost: 6.5e-05` > `x-litellm-mode…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (1 events)
#0 of 0 · 31d18h24m17s ago — entered · #import:https:::github.com:berriai:litellm post #2443
The right issue spans Helm templating, migration command wiring, CLI configuration, deployment compatibility, and validation across release paths, creating substantially more integration risk. The left issue is a localized middleware configuration change with comparatively narrow testing and documentation needs.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search