Skip to content

[Feature]: Allow extending litellm.custom_provider_map using entrypoints #7733

@joouha

Description

@joouha

The Feature

It would be neat to be able to distribute custom providers as Python packages, and have them automatically added to litellm.custom_provider_map through the use of entrypoints.

Motivation, pitch

I have written a custom LLM provider for LiteLLM and would like to be able to distribute it as a Python package.

I want this custom provider to be automatically available to users in programs which use litellm, such as aider.

Currently, to use the custom provider it has to be manually added to litellm.custom_provider_map at startup, which there is no way doing automatically.

My current solution is to include a .pth file in my wheel which runs code to register the custom provider at startup, but this is a bit-of-a-hack™.

The "correct" way to do this would be to use entry-points, so packages can register custom litellm providers, and they will automatically get loaded by litellm when required.

This would mean that installing a package containing a custom LiteLLM provider would make it available without having to add it manually.


If this is something you would like to have in your project I'd be very happy to work on a PR for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions