Skip to content

Support discovering gemini, anthropic, xai models by calling their /v1/model endpoint #9530

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Mar 28, 2025

Conversation

krrishdholakia
Copy link
Contributor

@krrishdholakia krrishdholakia commented Mar 25, 2025

Title

Enables SDK user to check what all models a key can call

from litellm import get_valid_models

valid_models = get_valid_models(
    check_provider_endpoint=True, custom_llm_provider="gemini"
)
assert len(valid_models) > 0

print(valid_models) # ["gemini/gemini-1.5-flash", ..]

Relevant issues

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
  • I have added a screenshot of my new test passing locally
  • My PR passes all unit tests on (make test-unit)[https://docs.litellm.ai/docs/extras/contributing_code]
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

Type

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

Changes

  • fix: initial commit for adding provider model discovery to gemini

  • feat(gemini/): add model discovery for gemini/ route

  • docs(set_keys.md): update docs to show you can check available gemini models as well

  • feat(anthropic/): add model discovery for anthropic api key

  • feat(xai/): add model discovery for XAI

enables checking what models an xai key can call

  • ci: bump ci config yml

  • fix(topaz/common_utils.py): fix linting error

  • fix: fix linting error for python38

Copy link

vercel bot commented Mar 25, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
litellm ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 28, 2025 5:51am

enables checking what models an xai key can call
@krrishdholakia krrishdholakia merged commit ccbac69 into main Mar 28, 2025
5 of 6 checks passed
@krrishdholakia krrishdholakia deleted the litellm_dev_03_25_2025_p1 branch March 28, 2025 20:17
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