Feat/add litellm provider#334
Open
RheagalFire wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds LiteLLM as a first-class inference provider, enabling access to 100+ LLM providers (OpenAI, Anthropic, Google Gemini, AWS Bedrock, Azure OpenAI, Mistral, Cohere, and more) through automaton's existing inference routing system.
Changes
src/conway/inference.ts- Added LiteLLM as a recognizedInferenceBackend, routed throughchatViaOpenAiCompatiblewith provider-specific error messages (401/429/404), streaming opt-in viaopts.streamsrc/index.ts- LiteLLM provider startup: readsLITELLM_BASE_URL/LITELLM_API_KEYenv vars, auto-discovers available models from proxy viaGET /v1/models, populates the model registrysrc/types.ts- Added"litellm"toModelProviderunion type, addedlitellmBaseUrl/litellmApiKeyto configsrc/inference/registry.ts- Registered litellm in the provider registrysrc/__tests__/inference-router.test.ts- 4 unit tests covering model registry, auto-disable skip, model discovery, fallback routingTests
Unit tests (68/68 passing):
All existing tests plus 4 new LiteLLM-specific tests pass.
Risk / Compatibility
LITELLM_BASE_URLenv var./v1/modelspopulates available models at startup.opts.stream(same as other backends).Example usage
1. Configure the LiteLLM proxy connection:
Or in your automaton config:
{ "litellmBaseUrl": "http://localhost:4000", "litellmApiKey": "sk-your-litellm-key" }**2. Any model served by your LiteLLM proxy is registered with
provider: "litellm"and available for inference routing. The startup log shows:3. Use any LiteLLM-routed model in inference calls:
4. Model routing is automatic. Once registered, models route to the LiteLLM backend based on the model registry lookup - no manual backend selection needed. The inference router picks the right backend (conway, openai, anthropic, ollama, or litellm) based on the model's registered provider.