litellm - 💡(How to fix) Fix [Bug]: Projects not working as expected [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#23861Fetched 2026-04-08 00:54:16
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
1
Author
Participants
Timeline (top)
labeled ×2

Code Example

sorry, no logs...
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

What happened?

a) When trying to add an existing key to a project, there is no option to select an appropriate project in the key settings.

b) When creating a new virtual key, I can select a project, but after saving the key-settings, I can't change the project any longer. The project-field is grayed out.

c) When adding a new virtual key to an existing project, the specific key isn't listed in the project's overview.

Steps to Reproduce

to a:
    - go to virtual keys
    - select an existing key
    - go to settings -> edit settings
    -> you won't find a field for selecting an existing project

to b:
    - go to Virtual Keys
    - Create New Key
    - Select a Project in the Key Form
    - click Create Key
    - select this key
    - go to settings -> edit settings
    - scroll down to team ID and project
    -> you will see team ID and project is grayed out and can't be changed.

to c:
    - go to projects
    - select the team used under b)
    -> the keys section is empty.

Actual Result The project assignment and changing opportunities are not working as expected

Expected Result - after creating a project and assigning this project to a team, I want to be able to add this project to existing keys - I want to be able to change a project assignment afterwards if the key's owner works on another project

Relevant log output

sorry, no logs...

What part of LiteLLM is this about?

UI Dashboard

What LiteLLM version are you on ?

v1.82.3

Twitter / LinkedIn details

No response

extent analysis

Fix Plan

To resolve the issues with project assignment and changing opportunities for virtual keys, we need to make the following changes:

  • Update the key settings form to include a project selection field.
  • Enable editing of the project field after key creation.
  • Ensure that newly added keys are listed in the project's overview.

Code Changes

# Update key settings form to include project selection field
def get_key_settings_form(key):
    form = KeySettingsForm()
    form.fields['project'] = forms.ModelChoiceField(queryset=Project.objects.all())
    return form

# Enable editing of project field after key creation
def edit_key_settings(request, key_id):
    key = Key.objects.get(id=key_id)
    if request.method == 'POST':
        form = KeySettingsForm(request.POST, instance=key)
        if form.is_valid():
            form.save()
            return redirect('key_settings')
    else:
        form = KeySettingsForm(instance=key)
    return render(request, 'key_settings.html', {'form': form})

# Ensure newly added keys are listed in project's overview
def get_project_keys(project):
    keys = Key.objects.filter(project=project)
    return keys

Configuration Changes

  • Update the Key model to include a project field.
  • Update the Project model to include a keys field.

Verification

  1. Create a new virtual key and assign it to a project.
  2. Edit the key settings and verify that the project field can be changed.
  3. Add the key to a project and verify that it is listed in the project's overview.

Extra Tips

  • Ensure that the project field is properly validated and handled in the key settings form.
  • Consider adding a permission check to ensure that only authorized users can edit the project field.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING