feat: add LiteLLM as a unified LLM gateway provider#198
Open
RheagalFire wants to merge 1 commit into
Open
Conversation
Route to 100+ LLM providers (OpenAI, Anthropic, Azure, Bedrock, Vertex AI, Ollama, etc.) through a single interface via LiteLLM. Adds LiteLLMConfig for Summarizer and DeepResearch, LLMProvider.LITELLM for PR review, agentic review, and commit generation, plus CLI support.
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 new LLM provider across all of kit's LLM call paths (Summarizer, PR Review, Agentic Review, Commit Generation, Deep Research, and CLI). LiteLLM acts as a unified gateway that routes to 100+ LLM providers (OpenAI, Anthropic, Azure, AWS Bedrock, Vertex AI, Ollama, Groq, etc.) through a single
litellm.completion()interface.Changes
11 files changed, +458 / -11 lines
pyproject.tomllitellm>=1.80.0,<1.87.0optional dep group, included inallsrc/kit/summaries.pyLiteLLMConfigdataclass +litellm.completion()branches insummarize_file,summarize_function,summarize_classsrc/kit/__init__.pyLiteLLMConfigsrc/kit/llm_client_factory.pycreate_litellm_client()factory + config/review-config dispatchsrc/kit/pr_review/config.pyLLMProvider.LITELLMenum,litellm/prefix detection, config loading, example configsrc/kit/pr_review/reviewer.py_analyze_with_litellm_enhanced()with cost trackingsrc/kit/pr_review/agentic_reviewer.py_run_agentic_analysis_litellm()with OpenAI-compatible tool callingsrc/kit/pr_review/commit_generator.py_generate_with_litellm()src/kit/deep_research.py_init_llm_client()andresearch()src/kit/cli.pytests/test_llm_client_factory.pyUsage
Python SDK (Summarizer)
PR Review (config file)
CLI
Design decisions
import litellmhappens at call time, not module load. Kit imports cleanly without the optional dep installeddrop_params=True: Silently drops provider-unsupported kwargs (e.g.,seedon Anthropic). Critical for cross-provider compatibility without per-provider param filteringModelResponsewith the same.choices[0].message.contentshape as OpenAI, so response handling mirrors the existing OpenAI providerpip install 'cased-kit[litellm]'keeps the base install lightweight>=1.80.0,<1.87.0: Floor covers all features used (drop_params, tool calling, async). Ceiling avoids surprise breakage from LiteLLM's weekly releasesTests
Unit tests (25 tests touching LiteLLM paths, all pass)
Ruff lint
Live E2E (Summarizer path)
Live E2E (DeepResearch path)
Testing instructions