Skip to content

Litellm ryan apr 4 - #25156

Merged
ryan-crabbe-berri merged 9 commits into
mainfrom
litellm_ryan-apr-4
Apr 4, 2026
Merged

Litellm ryan apr 4#25156
ryan-crabbe-berri merged 9 commits into
mainfrom
litellm_ryan-apr-4

Conversation

Adds tenant_id, client_id, and client_secret to the Azure provider entry
in provider_create_fields.json so the credential add/edit modals and the
add-model form surface Service Principal auth as an alternative to api_key.
The Azure handler already reads these fields from litellm_params at request
time via get_azure_ad_token(); this change makes them inputtable from the
UI without code changes to the React components (the form is driven by
GET /public/providers/fields).
Exposes the backend's existing model_tpm_limit/model_rpm_limit fields
(which lived in team.metadata) through a new "Model-Specific Rate Limits"
form section on the team Settings tab. Limits round-trip through the
team-update API and render on the Overview card and Settings view.

Model picker is scoped to the team's currently-selected models (unfurls
wildcards, falls back to userModels for all-proxy-models / all-team-models).
Previously, a row with a model selected but both limits blank was
silently dropped on save (neither model_tpm_limit nor model_rpm_limit
got the key), so the row disappeared on reload with no feedback.
Now the TPM field's validator blocks submission with "Set at least
one of TPM or RPM" when a row has a model but neither limit filled.
… api_key_breakdown

The export utility always extracted team_id from api_key_breakdown
metadata to populate the entity label/ID columns. This worked for
team exports (where entity key = team_id) but was wrong for every
other entity type — tags, orgs, customers, agents, users all
showed the API key's team name (e.g. "admins") instead of the
actual entity value.

Replace extractTeamIdFromApiKeyBreakdown with resolveEntityDisplay
which uses the entity key directly. For teams the teamAliasMap
still resolves a human-readable alias; for all other types the
entity key itself is the correct label.
The previous fix (9dca431) switched the export display logic to use the
entity key directly, but left the unit tests asserting the old behavior
where id/alias were extracted from api_key_breakdown metadata.

Rename mock entity keys from entity1/entity2 to "team-1"/"team-2" to
reflect the real shape of team-export payloads (breakdown.entities is
keyed by the entity identifier). Replace three tests whose assertions
documented the removed behavior:

- "should use key alias when available" → entity key is the alias when
  no team alias map is supplied
- "should use team alias map when key alias is not available" → team
  alias map resolves from the entity key
- "should use dash when team id is not available" → entity key itself
  is the fallback label (illustrated with a tag export)
feat(ui): expose Azure Entra ID credential fields in provider form
…l-rate-limit-ui

feat(ui): add per-model rate limits to team edit/info views
fix(ui): use entity key for usage export display
@vercel

vercel Bot commented Apr 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
litellm Ready Ready Preview, Comment Apr 4, 2026 11:41pm

Request Review

@codspeed-hq

codspeed-hq Bot commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 16 untouched benchmarks


Comparing litellm_ryan-apr-4 (e87f6ca) with main (693ad49)

Open in CodSpeed

@greptile-apps

greptile-apps Bot commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR bundles three independent UI improvements, all well-scoped and clean:

  • Azure Entra ID credential fieldstenant_id, client_id, and client_secret are added to the Azure provider entry in provider_create_fields.json, making Service Principal authentication configurable from the provider form UI. A matching unit test verifies field presence, field_type, and required flags.
  • Per-model rate limits in TeamInfo — The team edit and info tabs now expose model_tpm_limit / model_rpm_limit stored in team metadata. The edit form uses an Ant Design Form.List with duplicate-model validation; the view tabs render per-model limits from info.metadata?.model_tpm_limit and info.metadata?.model_rpm_limit. The backend correctly moves these top-level fields into metadata via _update_metadata_fields, and the UI strips them from the raw metadata JSON textarea to avoid double-editing.
  • Entity key used directly for usage export display — The new resolveEntityDisplay helper uses the entity key as both id and alias (falling back to the key when no team alias map entry exists). This fixes exports for non-team entity types (tags, orgs, customers) where the entity key is already the canonical label.

Issues found:

  • One vacuous test in utils.test.ts (see inline comment) — no assertions run under the new logic, but coverage is maintained by the adjacent replacement test.

Confidence Score: 5/5

Safe to merge — no correctness bugs, security issues, or data-loss risks found

All findings are P2 (one vacuous test). Logic changes are correct, well-tested, and consistent with backend contracts.

utils.test.ts has one vacuous test that should ideally be updated, but does not block merge

Important Files Changed

Filename Overview
ui/litellm-dashboard/src/components/EntityUsageExport/utils.ts Introduces resolveEntityDisplay helper to use entity key directly for display; all export functions updated consistently
ui/litellm-dashboard/src/components/EntityUsageExport/utils.test.ts Tests updated for new entity-key display behavior; one pre-existing test is now vacuous
ui/litellm-dashboard/src/components/team/TeamInfo.tsx Adds per-model rate limits UI editor and read-only display; metadata serialization correctly excludes model_tpm_limit/model_rpm_limit from raw textarea
litellm/proxy/public_endpoints/provider_create_fields.json Azure provider gains tenant_id, client_id, client_secret fields for Entra ID auth; none are individually required
tests/test_litellm/proxy/public_endpoints/test_public_endpoints.py New test verifies all three Entra ID fields are present, client_secret is password type, and fields are non-required; uses TestClient only

Sequence Diagram

sequenceDiagram
    participant UI as TeamInfo Edit Tab
    participant API as /team/update
    participant Backend as team_endpoints.py
    participant DB as Prisma DB
    participant UIv as TeamInfo View Tab

    UI->>API: PATCH {model_tpm_limit, model_rpm_limit, metadata}
    API->>Backend: UpdateTeamRequest (model limits as top-level fields)
    Backend->>Backend: _update_metadata_fields(updated_kv)
    Note over Backend: Moves model_tpm_limit/model_rpm_limit into metadata
    Backend->>DB: update team row (metadata contains model limits)
    DB-->>Backend: Updated row
    Backend-->>UI: 200 OK
    UI->>API: GET /team/info (fetchTeamInfo)
    API-->>UIv: team_info.metadata.model_tpm_limit/model_rpm_limit
    UIv->>UIv: Render per-model limits in Rate Limits card
Loading

Comments Outside Diff (1)

  1. ui/litellm-dashboard/src/components/EntityUsageExport/utils.test.ts, line 379-386 (link)

    P2 Vacuous test — inner assertion never runs

    After the resolveEntityDisplay refactor, Team ID is always the entity key string (never null, undefined, or "-"), so entryWithoutTeamId is always undefined and the expect inside the if block never executes. The test trivially passes while providing zero coverage.

    The new test at line 388 already covers the correct fallback behavior. Consider replacing this test with one that exercises the new behavior:

    Rule Used: What: Flag any modifications to existing tests and... (source)

Reviews (1): Last reviewed commit: "chore: poetry lock" | Re-trigger Greptile

@ryan-crabbe-berri
ryan-crabbe-berri merged commit 6bc4b46 into main Apr 4, 2026
111 of 116 checks passed
@ryan-crabbe-berri
ryan-crabbe-berri deleted the litellm_ryan-apr-4 branch April 4, 2026 23:56
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
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.

2 participants