Skip to content

reusable-credentials#22316

Open
atapia27 wants to merge 1 commit intoBerriAI:mainfrom
atapia27:reusable-credential-change
Open

reusable-credentials#22316
atapia27 wants to merge 1 commit intoBerriAI:mainfrom
atapia27:reusable-credential-change

Conversation

@atapia27
Copy link
Contributor

@atapia27 atapia27 commented Feb 27, 2026

Relevant issues

reusable-credentials.mp4

Edit: Moved to below tags
moved-location

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence Score of at least 4/5 before requesting a maintainer review

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • Branch creation CI run
    Link:

  • CI run for the last commit
    Link:

  • Merge / cherry-pick CI run
    Links:

Type

🆕 New Feature
🐛 Bug Fix
🧹 Refactoring
📖 Documentation
🚄 Infrastructure
✅ Test

Changes

@vercel
Copy link

vercel bot commented Feb 27, 2026

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

Project Deployment Actions Updated (UTC)
litellm Ready Ready Preview, Comment Feb 27, 2026 9:40pm

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 27, 2026

Greptile Summary

This PR adds a "reusable credentials" feature to the LiteLLM dashboard, allowing users to select existing credentials from a dropdown when editing model settings, rather than only via the JSON params textarea.

  • Adds a searchable "Existing Credentials" <Select> dropdown to the model info edit view, populated by credentialListCall
  • Strips litellm_credential_name from the litellm_extra_params JSON textarea in both the add-model and edit-model flows so the dedicated selector always takes precedence
  • Properly handles the credential value during save: sets it from the selector or removes it if cleared
  • Tests added for both prepareModelAddRequest and ModelInfoView to verify the credential override behavior

Issues found:

  • The "None" option in the credentials dropdown uses value: undefined, which is not a valid Ant Design Select option value and may cause the option to be non-selectable. Should use "" or null instead.

Note: The PR checklist indicates tests in tests/litellm/ directory are required but not checked. This PR only includes UI-level tests which are appropriate for the changes, but the pre-submission checklist should be updated accordingly.

Confidence Score: 3/5

  • UI-only changes with good test coverage, but one potentially broken dropdown option value
  • The core logic for stripping and re-applying litellm_credential_name is sound and well-tested. However, the value: undefined in the "None" option for the Ant Design Select is a functional bug that could prevent users from explicitly clearing a credential selection via the dropdown. The rest of the code is clean and follows existing patterns.
  • Pay close attention to ui/litellm-dashboard/src/components/model_info_view.tsx — the credentials dropdown "None" option may not work as expected.

Important Files Changed

Filename Overview
ui/litellm-dashboard/src/components/model_info_view.tsx Adds credential list fetching, a searchable "Existing Credentials" dropdown in edit mode, and ensures litellm_credential_name is stripped from the JSON textarea. One issue: the "None" option uses value: undefined which may not work reliably with Ant Design Select.
ui/litellm-dashboard/src/components/add_model/handle_add_model_submit.tsx Correctly strips litellm_credential_name from parsed litellm_extra_params JSON so the form selector value takes precedence. Clean, minimal change.
ui/litellm-dashboard/src/components/model_info_view.test.tsx Adds tests for the new "Existing Credentials" field visibility in edit mode and verifies that litellm_credential_name from JSON textarea is overridden by the selector. Mocks properly updated.
ui/litellm-dashboard/src/components/add_model/handle_add_model_submit.test.tsx Adds a test case verifying that litellm_credential_name injected via litellm_extra_params JSON is ignored in favor of the form-level field value.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[User opens Model Info View] --> B[Fetch credentials list via credentialListCall]
    A --> C[Load model data]
    B --> D[Populate Existing Credentials dropdown]
    C --> E[Strip litellm_credential_name from litellm_extra_params JSON]
    E --> F[Set litellm_credential_name as dedicated form field]
    
    G[User edits model] --> H{User modifies litellm_extra_params JSON?}
    H -->|Yes| I[Strip litellm_credential_name from parsed JSON]
    H -->|No| J[Keep existing values]
    
    G --> K{User selects credential from dropdown?}
    K -->|Yes| L[Set litellm_credential_name from selector]
    K -->|No / Cleared| M[Delete litellm_credential_name from params]
    
    I --> N[Save: Selector value always wins over JSON value]
    J --> N
    L --> N
    M --> N
    N --> O[Send modelPatchUpdateCall]
Loading

Last reviewed commit: 18bc0d4

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

(option?.label ?? "").toLowerCase().includes(input.toLowerCase())
}
options={[
{ value: undefined, label: "None" },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

undefined is not a valid Select option value

Ant Design's <Select> treats undefined as "no value" / uncontrolled state, so this option may not be selectable or may behave inconsistently (e.g., selecting "None" might not update the form field). Since allowClear is already enabled on this <Select>, users can clear the field via the clear button. Consider using null or an empty string instead so the option is reliably selectable:

Suggested change
{ value: undefined, label: "None" },
{ value: "", label: "None" },

Then in handleModelUpdate, check with if (values.litellm_credential_name) which already treats "" as falsy, so the downstream logic remains correct.

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