Skip to content

Let workers use the organization's LiteLLM proxy through the broker; release 0.20.0 - #102

Merged
nielsrolf merged 1 commit into
mainfrom
litellm-broker
Nov 20, 2026
Merged

nielsrolf merged 1 commit into
mainfrom
litellm-broker

Conversation

@nielsrolf

Copy link
Copy Markdown
Collaborator

Last of the four planned steps (TODO.md). Details in docs/release-0.20.0.md.

What changes

An organization sets the secret LITELLM_API_KEY and the (visible) setting LITELLM_BASE_URL in the dashboard. Its workers then get

LITELLM_BASE_URL = <broker url>/litellm
LITELLM_API_KEY  = <the worker's own token>

and the broker forwards each request to the organization's proxy with the real key, streaming the answer back. LITELLM_API_KEY was never passed to workers, so organizations that do not set it see no change.

Secret flow

Where it is
Real LITELLM_API_KEY secret store → broker, in memory only
In the pod the worker token: works only through the broker, dies with the worker
LITELLM_BASE_URL (not a secret) organization setting → manager → api_tokens.broker_settings on the worker token → broker

The broker has no database credential; it reads the address with the worker token's own JWT. A worker token cannot write api_tokens, so job code cannot redirect the broker.

Where the broker may forward to

The address is organization-chosen, so checked_upstream requires https, a host name, and that every resolved address is public. The broker never forwards Metadata-Flavor and never follows redirects. Known limit (in the release notes and TODO.md): the name is resolved once for the check and again to connect.

Also

  • GET /health on the broker (Cloud Run's front end keeps /healthz).
  • Dashboard shows LITELLM_BASE_URL in full and refuses non-https values.

What a release requires

Apply migration 20261123000000_worker_token_broker_settings.sql (adds a column and a defaulted fourth argument to create_worker_token; compatible in both orders), publish 0.20.0, upgrade manager, broker and dashboard. No worker image changes.

Tests

tests/test_broker.py (29 tests in total) and tests/test_worker_tokens.py: the LiteLLM route against a stand-in proxy, the address check with a fake resolver, the manager's side, and the new argument against a real PostgreSQL. Full suite: 295 passed.

Not verified: a real LiteLLM proxy; it needs an organization with the two settings.

🤖 Generated with Claude Code

…release 0.20.0

With LITELLM_API_KEY in the secret store and LITELLM_BASE_URL in its
settings, an organization's workers get the broker's address and their own
token; the broker forwards to the organization's proxy with the real key.
The cluster manager writes the address onto each worker token
(api_tokens.broker_settings), which is where the broker reads it. The broker
only forwards to public https hosts.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@nielsrolf
nielsrolf merged commit 3cad23d into main Nov 20, 2026
1 check passed
@nielsrolf
nielsrolf deleted the litellm-broker branch November 20, 2026 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant