Thank you for your interest in contributing to LiteLLM! We welcome contributions of all kinds - from bug fixes and documentation improvements to new features and integrations.
Here are the core requirements for any PR submitted to LiteLLM:
- Sign the Contributor License Agreement (CLA) - see details
- Keep scope isolated - Your changes should address 1 specific problem at a time
- Add testing - Adding at least 1 test is a hard requirement - see details
- Ensure your PR passes all checks:
- Linting / Formatting -
make lint - The tests covering your change pass, e.g.
uv run pytest tests/test_litellm/<your_test_file>.py -v. CI runs the full unit test matrix, so you don't need to run the whole suite locally
- Linting / Formatting -
- Ensure the UI builds successfully -
npm run build - Ensure all UI unit tests pass -
npm run test - Add tests for new components or logic - If you are adding a new component or new logic, add corresponding tests
Before contributing code to LiteLLM, you must sign our Contributor License Agreement (CLA). This is a legal requirement for all contributions to be merged into the main repository.
Important: We strongly recommend reviewing and signing the CLA before starting work on your contribution to avoid any delays in the PR process.
# Fork the repository on GitHub (click the Fork button at https://github.com/BerriAI/litellm)
# Then clone your fork locally
git clone https://github.com/YOUR_USERNAME/litellm.git
cd litellm
# Create a new branch for your feature (see "Commit and Branch Conventions" below)
git checkout -b feature/your-feature
# Install development dependencies
make install-dev
# Install git hooks that enforce commit + branch conventions (one-time, opt-in)
make install-hooks
# Verify your setup works
make helpThat's it! Your local development environment is ready.
Commits follow Conventional Commits and branches follow Conventional Branches. Run make install-hooks once per clone to enable the local git hooks that enforce these — see the contributor docs for the full type list, examples, the protected-branch bypass list, and how to opt out.
Here's the recommended workflow for making changes:
# Make your changes to the code
# ...
# Format your code (auto-fixes formatting issues)
make format
# Run all linting checks (matches CI exactly)
make lint
# Run the tests covering your change (CI runs the full suite)
uv run pytest tests/test_litellm/<your_test_file>.py -v
# Commit your changes (must follow Conventional Commits — see above)
git add .
git commit -m "feat(scope): your descriptive commit message"
# Push and create a PR (branch must follow Conventional Branches — see above)
git push origin feature/your-featureAdding at least 1 test is a hard requirement for all PRs.
Add your tests to the tests/test_litellm/ directory.
- This directory mirrors the structure of the
litellm/directory - Only add mocked tests - no real LLM API calls in this directory
- For integration tests with real APIs, use the appropriate test directories
The tests/test_litellm/ directory follows the same structure as litellm/:
litellm/proxy/caching_routes.py→tests/test_litellm/proxy/test_caching_routes.pylitellm/utils.py→tests/test_litellm/test_utils.py
import pytest
from litellm import completion
def test_your_feature():
"""Test your feature with a descriptive docstring."""
# Arrange
messages = [{"role": "user", "content": "Hello"}]
# Act
# Use mocked responses, not real API calls
# Assert
assert expected_result == actual_resultRun the tests covering your change:
uv run pytest tests/test_litellm/test_your_file.py -vtests/test_litellm holds thousands of tests, so running all of it locally takes a long time. CI runs it as a parallel matrix (make test-unit-llms, make test-unit-proxy-core, and the other test-unit-* targets) on beefier boxes, so if, for whatever reason, you must run the whole suite, it's better to rely on CI to do that.
If you're running broader test suites, proxy tests, or anything that touches PostgreSQL-backed fixtures/plugins, install the full local test environment first:
make install-test-depsThis syncs the locked test environment used across the repo, including psycopg v3 plus psycopg-binary (used by pytest-postgresql), psycopg2-binary (used by some proxy E2E tests), and a generated Prisma client for DB-backed proxy tests, so pytest startup matches CI without manual package installs.
Run all linting checks (matches CI exactly):
make lintIndividual linting commands:
make format-check # Check Black formatting
make lint-ruff # Run Ruff linting
make lint-basedpyright # Run basedpyright type checking
make check-circular-imports # Check for circular imports
make check-import-safety # Check import safetyApply formatting (auto-fixes issues):
make formatBlack formatting is enforced in CI. All PRs must pass the Black formatting check.
- AI coding agents (Claude Code, Copilot, Cursor, etc.):
AGENTS.mdandCLAUDE.mdinstruct agents to runpoetry run black .before committing.- VS Code users: Install the Black Formatter extension and enable format-on-save:
{ "[python]": { "editor.defaultFormatter": "ms-python.black-formatter", "editor.formatOnSave": true } }
To ensure your changes will pass CI, run the exact same checks locally:
# This runs the same checks as the GitHub workflows
make lint
make test-unitFor exact CI compatibility (pins OpenAI version like CI):
make install-dev-ci # Installs exact CI dependenciesRun make help to see all available commands:
make help # Show all available commands
make install-dev # Install development dependencies
make install-proxy-dev # Install proxy development dependencies
make install-test-deps # Install the full local test environment
make format # Apply Black code formatting
make format-check # Check Black formatting (matches CI)
make lint # Run all linting checks
make test-unit # Run unit tests
make test-integration # Run integration tests
make test-unit-helm # Run Helm unit testsLiteLLM follows the Google Python Style Guide.
Our automated quality checks include:
- Black for consistent code formatting
- Ruff for linting and code quality
- basedpyright for static type checking
- Circular import detection
- Import safety validation
All checks must pass before your PR can be merged.
If make lint fails:
- Formatting issues: Run
make formatto auto-fix - Ruff issues: Check the output and fix manually
- basedpyright issues: Add proper type hints
- Circular imports: Refactor import dependencies
- Import safety: Fix any unprotected imports
If make test-unit fails:
- Check if you broke existing functionality
- Add tests for your new code
- Ensure tests use mocks, not real API calls
- Check test file naming conventions
- Use type hints: basedpyright requires proper type annotations
- Write descriptive commit messages: Help reviewers understand your changes
- Keep PRs focused: One feature/fix per PR
- Test edge cases: Don't just test the happy path
- Update documentation: If you change APIs, update docs
To run the proxy server locally:
# Install proxy dependencies
make install-proxy-dev
# Start the proxy server
uv run litellm --config your_config.yamlIf you want to build the Docker image yourself:
# Build using the non-root Dockerfile
docker build -f docker/Dockerfile.non_root -t litellm_dev .
# Run with your config
docker run \
-v $(pwd)/proxy_config.yaml:/app/config.yaml \
-e LITELLM_MASTER_KEY="sk-1234" \
-p 4000:4000 \
litellm_dev \
--config /app/config.yaml --detailed_debug# Clone the repo (if you haven't already)
git clone https://github.com/YOUR_USERNAME/litellm.git
cd litellm
# Navigate to the UI dashboard directory
cd ui/litellm-dashboard
# Install dependencies
npm install
# Start the development server
npm run devIf you are adding a new component or new logic, you must add corresponding tests.
npm run testEnsure the UI builds successfully before submitting your PR:
npm run build- Push your branch:
git push origin your-feature-branch - Create a PR: Go to GitHub and open a pull request against
litellm_internal_staging, which is the default base branch. Do not targetmain. - Fill out the PR template: Provide clear description of changes
- Wait for review: Maintainers will review and provide feedback
- Address feedback: Make requested changes and push updates
- Merge: Once approved, your PR will be merged!
If you need help:
- 💬 Join our Discord
- 💬 Join our Slack
- 📧 Email us: ishaan@berri.ai / krrish@berri.ai
- 🐛 Create an issue
Looking for ideas? Check out:
- 🐛 Good first issues
- 🚀 Feature requests
- 📚 Documentation improvements
- 🧪 Test coverage improvements
- 🔌 New LLM provider integrations
Thank you for contributing to LiteLLM! 🚀