Skip to main content

Overview

SaveGate is fully compatible with LiteLLM, making it easy to use multiple AI providers through a single, unified interface. Simply point LiteLLM to SaveGate’s API endpoint.

Why Use LiteLLM with SaveGate?

LiteLLM provides a unified interface across providers, while SaveGate removes rate limits and reduces costs by 30-50%. Together, they’re a powerful combination.

Installation

Install LiteLLM via pip:

Basic Usage

Method 1: Set API Base Globally

Method 2: Per-Request Configuration

Using Different Models

LiteLLM with SaveGate supports all major providers:

Streaming Responses

LiteLLM streaming works seamlessly with SaveGate:

Async Support

Use LiteLLM’s async functions for concurrent requests:

Router for Load Balancing

Use LiteLLM’s Router with SaveGate for advanced load balancing:

Fallback Between Models

Configure fallbacks to try alternative models if one fails:

Caching with LiteLLM

Enable caching to reduce costs and improve speed:

Function Calling

Use LiteLLM’s function calling with SaveGate:

Error Handling

Handle errors gracefully:

Best Practices

Store credentials securely:
Debug issues with LiteLLM’s built-in logging:
Process multiple requests concurrently:
Track usage through SaveGate dashboard:
  • View costs by model
  • Set budget alerts
  • Analyze usage patterns
  • Optimize model selection

Complete Example

Here’s a full example combining multiple features:

Migration Guide

From OpenAI SDK to LiteLLM + SaveGate

Resources

LiteLLM Documentation

Official LiteLLM documentation

LiteLLM GitHub

LiteLLM source code and examples

SaveGate Models

Complete list of supported models

API Reference

SaveGate API documentation