<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: SilverFox AI</title>
    <description>The latest articles on DEV Community by SilverFox AI (@silverfoxai).</description>
    <link>https://dev.to/silverfoxai</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3477251%2F06cd4449-4569-4b42-900e-12c49247b35c.png</url>
      <title>DEV Community: SilverFox AI</title>
      <link>https://dev.to/silverfoxai</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/silverfoxai"/>
    <language>en</language>
    <item>
      <title>LiteLLM Proxy Setup Guide for macOS with UV (Beginner-Friendly)</title>
      <dc:creator>SilverFox AI</dc:creator>
      <pubDate>Wed, 03 Sep 2025 12:34:09 +0000</pubDate>
      <link>https://dev.to/silverfoxai/litellm-proxy-setup-guide-for-macos-with-uv-beginner-friendly-pac</link>
      <guid>https://dev.to/silverfoxai/litellm-proxy-setup-guide-for-macos-with-uv-beginner-friendly-pac</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;🎯 &lt;strong&gt;Goal:&lt;/strong&gt; Quickly set up LiteLLM proxy on Mac in 15-20 minutes using the modern UV package manager without creating a formal project structure.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  📋 What You'll Need
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  Mac with macOS 10.15 or newer&lt;/li&gt;
&lt;li&gt;  Internet connection&lt;/li&gt;
&lt;li&gt;  20 minutes of your time&lt;/li&gt;
&lt;li&gt;  One API key (OpenAI, Anthropic, Groq, or other)&lt;/li&gt;
&lt;li&gt;  Short demo &lt;a href="https://youtu.be/oTD73jJ1IJA?si=Is6Z-CHaLjtFNwIE" rel="noopener noreferrer"&gt;video&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🛠 Step 1: Install Required Tools
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1.1 Install Homebrew (if not already installed)
&lt;/h3&gt;

&lt;p&gt;Open Terminal and run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Check if Homebrew is installed&lt;/span&gt;
brew &lt;span class="nt"&gt;--version&lt;/span&gt;

&lt;span class="c"&gt;# If you get an error, install Homebrew:&lt;/span&gt;
/bin/bash &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  1.2 Install UV (modern Python package manager)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Install UV via Homebrew&lt;/span&gt;
brew &lt;span class="nb"&gt;install &lt;/span&gt;uv

&lt;span class="c"&gt;# Verify installation&lt;/span&gt;
uv &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  1.3 Install PostgreSQL
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Install PostgreSQL&lt;/span&gt;
brew &lt;span class="nb"&gt;install &lt;/span&gt;postgresql@14

&lt;span class="c"&gt;# Start PostgreSQL service&lt;/span&gt;
brew services start postgresql

&lt;span class="c"&gt;# Verify it's running&lt;/span&gt;
brew services list | &lt;span class="nb"&gt;grep &lt;/span&gt;postgresql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  💾 Step 2: Create Database
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Create database for LiteLLM&lt;/span&gt;
createdb litellm_db

&lt;span class="c"&gt;# Verify database was created&lt;/span&gt;
psql &lt;span class="nt"&gt;-l&lt;/span&gt; | &lt;span class="nb"&gt;grep &lt;/span&gt;litellm_db

&lt;span class="c"&gt;# Get your username for database connection&lt;/span&gt;
&lt;span class="nb"&gt;whoami&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Write down the result of &lt;code&gt;whoami&lt;/code&gt; - this is your database username!&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  🐍 Step 3: Set Up Virtual Environment
&lt;/h2&gt;

&lt;p&gt;Instead of initializing a full project, we'll create a simple directory with a virtual environment.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Go to your preferred directory, e.g., Documents&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; ~/Documents

&lt;span class="c"&gt;# Create a folder for our setup and navigate into it&lt;/span&gt;
&lt;span class="nb"&gt;mkdir &lt;/span&gt;litellm-setup
&lt;span class="nb"&gt;cd &lt;/span&gt;litellm-setup

&lt;span class="c"&gt;# Create a virtual environment using UV&lt;/span&gt;
uv venv

&lt;span class="c"&gt;# Activate the virtual environment&lt;/span&gt;
&lt;span class="nb"&gt;source&lt;/span&gt; .venv/bin/activate

&lt;span class="c"&gt;# Your terminal prompt should now start with (.venv)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;⚠️ Important:&lt;/strong&gt; All subsequent commands should be run inside this activated environment.&lt;/p&gt;

&lt;h2&gt;
  
  
  📦 Step 4: Install LiteLLM and Dependencies
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Install LiteLLM with proxy support and database drivers&lt;/span&gt;
uv pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="s2"&gt;"litellm[proxy]"&lt;/span&gt; prisma psycopg2-binary

&lt;span class="c"&gt;# Verify installation (since the environment is active, you don't need "uv run")&lt;/span&gt;
litellm &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🔧 Step 5: Generate Prisma Client
&lt;/h2&gt;

&lt;p&gt;LiteLLM uses Prisma for database interactions. We need to generate the Python client:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Find the exact path to schema.prisma within the installed litellm package&lt;/span&gt;
find .venv &lt;span class="nt"&gt;-name&lt;/span&gt; &lt;span class="s2"&gt;"schema.prisma"&lt;/span&gt; &lt;span class="nt"&gt;-path&lt;/span&gt; &lt;span class="s2"&gt;"*/litellm/*"&lt;/span&gt;

&lt;span class="c"&gt;# Generate Prisma client (replace the path with the output from the command above)&lt;/span&gt;
python &lt;span class="nt"&gt;-m&lt;/span&gt; prisma generate &lt;span class="nt"&gt;--schema&lt;/span&gt; .venv/lib/python3.12/site-packages/litellm/proxy/schema.prisma
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Important:&lt;/strong&gt; Your Python version (e.g., &lt;code&gt;python3.12&lt;/code&gt;) may differ. Use the &lt;code&gt;find&lt;/code&gt; command to get the correct path.&lt;/p&gt;

&lt;h2&gt;
  
  
  ⚙️ Step 6: Create Configuration
&lt;/h2&gt;

&lt;h3&gt;
  
  
  6.1 Create config.yaml
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Create configuration file&lt;/span&gt;
nano config.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Insert the following content:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;litellm_settings&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;drop_params&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;

&lt;span class="na"&gt;general_settings&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="c1"&gt;# Main settings will be taken from environment variables&lt;/span&gt;

&lt;span class="c1"&gt;# List of available models&lt;/span&gt;
&lt;span class="na"&gt;model_list&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;model_name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;groq-llama3-fast&lt;/span&gt;        &lt;span class="c1"&gt;# Your custom alias (any name)&lt;/span&gt;
    &lt;span class="na"&gt;litellm_params&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;model&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;groq/llama3-8b-8192&lt;/span&gt;        &lt;span class="c1"&gt;# Real model name from LiteLLM&lt;/span&gt;
      &lt;span class="na"&gt;api_key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;os.environ/GROQ_API_KEY&lt;/span&gt;  &lt;span class="c1"&gt;# Key via environment variables&lt;/span&gt;

  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;model_name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;gpt-3.5-turbo&lt;/span&gt;           &lt;span class="c1"&gt;# Additional example with OpenAI&lt;/span&gt;
    &lt;span class="na"&gt;litellm_params&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;model&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;gpt-3.5-turbo&lt;/span&gt;
      &lt;span class="na"&gt;api_key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;os.environ/OPENAI_API_KEY&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Save file:&lt;/strong&gt; &lt;code&gt;Ctrl+O&lt;/code&gt;, then &lt;code&gt;Enter&lt;/code&gt;, then &lt;code&gt;Ctrl+X&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  6.2 Create environment variables file
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Create .env file&lt;/span&gt;
nano .env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Insert (replace YOUR_USERNAME with the result of the &lt;code&gt;whoami&lt;/code&gt; command):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# LiteLLM settings&lt;/span&gt;
&lt;span class="nv"&gt;LITELLM_MASTER_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"sk-1234"&lt;/span&gt;
&lt;span class="nv"&gt;LITELLM_SALT_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"sk-1234"&lt;/span&gt;
&lt;span class="nv"&gt;LITELLM_DROP_PARAMS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;True

&lt;span class="c"&gt;# Server settings&lt;/span&gt;
&lt;span class="nv"&gt;PORT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;4000
&lt;span class="nv"&gt;STORE_MODEL_IN_DB&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"True"&lt;/span&gt;  &lt;span class="c"&gt;# Allow storing models in DB&lt;/span&gt;

&lt;span class="c"&gt;# Database connection (replace 'admin' with YOUR_USERNAME if it's different)&lt;/span&gt;
&lt;span class="nv"&gt;DATABASE_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;postgresql://admin@localhost:5432/litellm_db

&lt;span class="c"&gt;# API keys (add your real keys)&lt;/span&gt;
&lt;span class="nv"&gt;GROQ_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"your-groq-api-key-here"&lt;/span&gt;
&lt;span class="nv"&gt;OPENAI_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"your-openai-key-here"&lt;/span&gt;
&lt;span class="nv"&gt;ANTHROPIC_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"your-anthropic-key-here"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Save file:&lt;/strong&gt; &lt;code&gt;Ctrl+O&lt;/code&gt;, then &lt;code&gt;Enter&lt;/code&gt;, then &lt;code&gt;Ctrl+X&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  🚀 Step 7: Start LiteLLM
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Start LiteLLM proxy (it will automatically load the .env file)&lt;/span&gt;
litellm &lt;span class="nt"&gt;--config&lt;/span&gt; config.yaml &lt;span class="nt"&gt;--port&lt;/span&gt; 4000

&lt;span class="c"&gt;# On the first run, LiteLLM will automatically create tables in the database&lt;/span&gt;

&lt;span class="c"&gt;# You'll see:&lt;/span&gt;
&lt;span class="c"&gt;# LiteLLM: Proxy initialized with Config, Set models:...&lt;/span&gt;
&lt;span class="c"&gt;# INFO:     Uvicorn running on http://0.0.0.0:4000&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🎉 Step 8: Verify Everything Works
&lt;/h2&gt;

&lt;h3&gt;
  
  
  8.1 Open UI
&lt;/h3&gt;

&lt;p&gt;In your browser, go to: &lt;code&gt;http://localhost:4000&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You'll see the LiteLLM web interface with model management, keys, and statistics!&lt;/p&gt;

&lt;h3&gt;
  
  
  8.2 Test Model via UI
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt; In the web interface, find the &lt;strong&gt;"Test Key"&lt;/strong&gt; section.&lt;/li&gt;
&lt;li&gt; Select the &lt;code&gt;groq-llama3-fast&lt;/code&gt; model.&lt;/li&gt;
&lt;li&gt; Write a test message, e.g.: "Hello! How are you?"&lt;/li&gt;
&lt;li&gt; Click send.&lt;/li&gt;
&lt;li&gt; You'll get a response from the model!&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  8.3 Test API via Terminal
&lt;/h3&gt;

&lt;p&gt;Open a new terminal and run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST &lt;span class="s1"&gt;'http://localhost:4000/chat/completions'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s1"&gt;'Content-Type: application/json'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s1"&gt;'Authorization: Bearer sk-1234'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{
  "model": "groq-llama3-fast",
  "messages": [{"role": "user", "content": "Hello! How are you?"}]
}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If everything works correctly, you'll get a response from the Groq Llama3 model!&lt;/p&gt;




&lt;h2&gt;
  
  
  🗄️ LiteLLM Database Management
&lt;/h2&gt;

&lt;p&gt;After starting the LiteLLM Proxy, it will begin storing data in your PostgreSQL database. Here's how you can manage this data.&lt;/p&gt;

&lt;h3&gt;
  
  
  Checking Database Content
&lt;/h3&gt;

&lt;p&gt;To view the tables and data in your &lt;code&gt;litellm_db&lt;/code&gt; database:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Connect to the &lt;code&gt;litellm_db&lt;/code&gt; database using &lt;code&gt;psql&lt;/code&gt;:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;psql &lt;span class="nt"&gt;-U&lt;/span&gt; admin &lt;span class="nt"&gt;-h&lt;/span&gt; localhost &lt;span class="nt"&gt;-p&lt;/span&gt; 5432 litellm_db
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;Enter your password when prompted.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;View the list of tables:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="n"&gt;dt&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;You will see a list of tables created by LiteLLM, such as:&lt;br&gt;
&lt;code&gt;LiteLLM_AuditLog&lt;/code&gt;, &lt;code&gt;LiteLLM_BudgetTable&lt;/code&gt;, &lt;code&gt;LiteLLM_Config&lt;/code&gt;, &lt;code&gt;LiteLLM_CredentialsTable&lt;/code&gt;, &lt;code&gt;LiteLLM_CronJob&lt;/code&gt;, &lt;code&gt;LiteLLM_DailyTagSpend&lt;/code&gt;, &lt;code&gt;LiteLLM_DailyTeamSpend&lt;/code&gt;, &lt;code&gt;LiteLLM_DailyUserSpend&lt;/code&gt;, &lt;code&gt;LiteLLM_EndUserTable&lt;/code&gt;, &lt;code&gt;LiteLLM_ErrorLogs&lt;/code&gt;, &lt;code&gt;LiteLLM_GuardrailsTable&lt;/code&gt;, &lt;code&gt;LiteLLM_HealthCheckTable&lt;/code&gt;, &lt;code&gt;LiteLLM_InvitationLink&lt;/code&gt;, &lt;code&gt;LiteLLM_MCPServerTable&lt;/code&gt;, &lt;code&gt;LiteLLM_ManagedFileTable&lt;/code&gt;, &lt;code&gt;LiteLLM_ManagedObjectTable&lt;/code&gt;, &lt;code&gt;LiteLLM_ManagedVectorStoresTable&lt;/code&gt;, &lt;code&gt;LiteLLM_ModelTable&lt;/code&gt;, &lt;code&gt;LiteLLM_ObjectPermissionTable&lt;/code&gt;, &lt;code&gt;LiteLLM_OrganizationMembership&lt;/code&gt;, &lt;code&gt;LiteLLM_OrganizationTable&lt;/code&gt;, &lt;code&gt;LiteLLM_PromptTable&lt;/code&gt;, &lt;code&gt;LiteLLM_ProxyModelTable&lt;/code&gt;, &lt;code&gt;LiteLLM_SpendLogs&lt;/code&gt;, &lt;code&gt;LiteLLM_TeamMembership&lt;/code&gt;, &lt;code&gt;LiteLLM_TeamTable&lt;/code&gt;, &lt;code&gt;LiteLLM_UserNotifications&lt;/code&gt;, &lt;code&gt;LiteLLM_UserTable&lt;/code&gt;, &lt;code&gt;LiteLLM_VerificationToken&lt;/code&gt;, &lt;code&gt;_prisma_migrations&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;View the schema of a specific table (optional):&lt;/strong&gt;&lt;br&gt;
For example, for the &lt;code&gt;LiteLLM_SpendLogs&lt;/code&gt; table:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="nv"&gt;"LiteLLM_SpendLogs"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;(Use double quotes if the table name contains uppercase letters or special characters).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;View a few records from a table (optional):&lt;/strong&gt;&lt;br&gt;
For example, for the &lt;code&gt;LiteLLM_SpendLogs&lt;/code&gt; table:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="nv"&gt;"LiteLLM_SpendLogs"&lt;/span&gt; &lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Exit &lt;code&gt;psql&lt;/code&gt;:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="n"&gt;q&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Deleting the Database
&lt;/h4&gt;

&lt;p&gt;If you want to completely delete the &lt;code&gt;litellm_db&lt;/code&gt; database (e.g., to start with a clean slate), follow these steps. &lt;strong&gt;This operation is irreversible and will result in the loss of all data in this database.&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Connect to PostgreSQL&lt;/strong&gt; to any other database (e.g., &lt;code&gt;postgres&lt;/code&gt;), as you cannot delete a database you are currently connected to:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;psql &lt;span class="nt"&gt;-U&lt;/span&gt; admin &lt;span class="nt"&gt;-h&lt;/span&gt; localhost &lt;span class="nt"&gt;-p&lt;/span&gt; 5432 postgres
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;Enter your password.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Delete the &lt;code&gt;litellm_db&lt;/code&gt; database:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;DROP&lt;/span&gt; &lt;span class="k"&gt;DATABASE&lt;/span&gt; &lt;span class="n"&gt;litellm_db&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Exit &lt;code&gt;psql&lt;/code&gt;:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="n"&gt;q&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;The next time LiteLLM starts, it will automatically recreate the &lt;code&gt;litellm_db&lt;/code&gt; database and apply all migrations.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Clearing Data (Logs, Spend, Tokens)
&lt;/h4&gt;

&lt;p&gt;If you want to clear only specific data (e.g., logs or spend records) without deleting the entire database, you can use the &lt;code&gt;TRUNCATE TABLE&lt;/code&gt; command. This will remove all records from the table but leave the table itself and its structure intact.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Important:&lt;/strong&gt; Make sure the LiteLLM Proxy is &lt;strong&gt;not running&lt;/strong&gt; when you execute these commands to avoid conflicts.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Connect to the &lt;code&gt;litellm_db&lt;/code&gt; database using &lt;code&gt;psql&lt;/code&gt;:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;psql &lt;span class="nt"&gt;-U&lt;/span&gt; admin &lt;span class="nt"&gt;-h&lt;/span&gt; localhost &lt;span class="nt"&gt;-p&lt;/span&gt; 5432 litellm_db
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;Enter your password.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Clear the desired tables:&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;*   **Request and error logs:**
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    ```sql
    TRUNCATE TABLE "LiteLLM_AuditLog" RESTART IDENTITY;
    TRUNCATE TABLE "LiteLLM_ErrorLogs" RESTART IDENTITY;
    ```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    (`RESTART IDENTITY` resets auto-incrementing ID counters, if any).

*   **Detailed spend records (price, tokens):**
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    ```sql
    TRUNCATE TABLE "LiteLLM_SpendLogs" RESTART IDENTITY;
    ```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;*   **Aggregated daily spend (users, teams, tags):**
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    ```sql
    TRUNCATE TABLE "LiteLLM_DailyUserSpend" RESTART IDENTITY;
    TRUNCATE TABLE "LiteLLM_DailyTeamSpend" RESTART IDENTITY;
    TRUNCATE TABLE "LiteLLM_DailyTagSpend" RESTART IDENTITY;
    ```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;*   **Other tables that may contain data you want to clear (depends on your needs):**
    *   `LiteLLM_HealthCheckTable`
    *   `LiteLLM_CronJob`
    *   `LiteLLM_UserNotifications`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Exit &lt;code&gt;psql&lt;/code&gt;:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="err"&gt;\&lt;/span&gt;&lt;span class="n"&gt;q&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  🚀 Step 9: Create Alias for Convenience (Optional)
&lt;/h2&gt;

&lt;p&gt;To run LiteLLM from any folder, create an alias:&lt;/p&gt;

&lt;h3&gt;
  
  
  9.1 Add alias to your shell
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Open shell configuration file (for zsh)&lt;/span&gt;
nano ~/.zshrc

&lt;span class="c"&gt;# Or for bash:&lt;/span&gt;
&lt;span class="c"&gt;# nano ~/.bash_profile&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add at the end of the file (replace &lt;code&gt;/Users/admin/Documents/litellm-setup&lt;/code&gt; with your actual path):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# LiteLLM alias for quick start&lt;/span&gt;
&lt;span class="nb"&gt;alias &lt;/span&gt;litellm-start&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"cd /Users/admin/Documents/litellm-setup &amp;amp;&amp;amp; source .venv/bin/activate &amp;amp;&amp;amp; litellm --config config.yaml --port 4000"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  9.2 Reload configuration
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# For zsh:&lt;/span&gt;
&lt;span class="nb"&gt;source&lt;/span&gt; ~/.zshrc

&lt;span class="c"&gt;# For bash:&lt;/span&gt;
&lt;span class="c"&gt;# source ~/.bash_profile&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  9.3 Now you can start from anywhere:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# From any folder:&lt;/span&gt;
litellm-start

&lt;span class="c"&gt;# LiteLLM will start automatically!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🆘 Troubleshooting
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Problem: "command not found: litellm"
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt; You have forgotten to activate the virtual environment. Run this command from your project folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;source&lt;/span&gt; .venv/bin/activate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After this, the &lt;code&gt;litellm&lt;/code&gt; command will be available.&lt;/p&gt;

&lt;h3&gt;
  
  
  Problem: "ModuleNotFoundError: No module named 'prisma'"
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt; Your installation was likely incomplete. Make sure &lt;code&gt;prisma&lt;/code&gt; is installed in your active environment:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Make sure .venv is active&lt;/span&gt;
uv pip &lt;span class="nb"&gt;install &lt;/span&gt;prisma
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Problem: "The Client hasn't been generated yet..."
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt; Run the Prisma generate command again, ensuring the path to &lt;code&gt;schema.prisma&lt;/code&gt; is correct.&lt;/p&gt;

&lt;h3&gt;
  
  
  Problem: "Database connection failed" or "Database not connected"
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Check if PostgreSQL is running&lt;/span&gt;
brew services list | &lt;span class="nb"&gt;grep &lt;/span&gt;postgresql

&lt;span class="c"&gt;# If not running:&lt;/span&gt;
brew services start postgresql

&lt;span class="c"&gt;# Check if database exists:&lt;/span&gt;
psql &lt;span class="nt"&gt;-l&lt;/span&gt; | &lt;span class="nb"&gt;grep &lt;/span&gt;litellm_db

&lt;span class="c"&gt;# Ensure the DATABASE_URL in your .env file is correct (username, database name).&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Problem: "Config file not found"
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt; Make sure the &lt;code&gt;config.yaml&lt;/code&gt; file is in the same directory from which you are running the &lt;code&gt;litellm&lt;/code&gt; command.&lt;/p&gt;

&lt;h3&gt;
  
  
  Problem: "Invalid API key"
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt; Double-check the API keys in your &lt;code&gt;.env&lt;/code&gt; file.&lt;/p&gt;

&lt;h3&gt;
  
  
  Problem: "Port 4000 already in use"
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt; Use a different port:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;litellm &lt;span class="nt"&gt;--config&lt;/span&gt; config.yaml &lt;span class="nt"&gt;--port&lt;/span&gt; 4001
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🎯 What You've Achieved
&lt;/h2&gt;

&lt;p&gt;✅ LiteLLM proxy server on localhost:4000&lt;br&gt;&lt;br&gt;
✅ Web UI for model management&lt;br&gt;&lt;br&gt;
✅ Unified API for all LLM providers&lt;br&gt;&lt;br&gt;
✅ Ready-to-share project setup&lt;br&gt;&lt;br&gt;
✅ Modern UV Python ecosystem&lt;br&gt;&lt;br&gt;
✅ Database integration for advanced features&lt;br&gt;&lt;br&gt;
✅ Convenient alias for daily use  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Congratulations! You can now use any LLM through a single interface! 🚀&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  💡 Why This Setup is Powerful
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Unified Interface&lt;/strong&gt;: Access OpenAI, Anthropic, Groq, and 100+ other models through one API&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Cost Tracking&lt;/strong&gt;: Built-in spend monitoring and budget controls&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Rate Limiting&lt;/strong&gt;: Prevent API abuse and manage usage&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Modern Tooling&lt;/strong&gt;: UV provides faster, more reliable package management&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Production Ready&lt;/strong&gt;: PostgreSQL backend for scaling&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Developer Friendly&lt;/strong&gt;: Easy to share and reproduce across teams&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🔄 Next Steps
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Add more models&lt;/strong&gt; to your &lt;code&gt;config.yaml&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Create API keys&lt;/strong&gt; with different permissions and limits&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Set up monitoring&lt;/strong&gt; and alerts&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Integrate&lt;/strong&gt; with your applications using the OpenAI-compatible API&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Scale&lt;/strong&gt; by deploying to cloud platforms&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Happy coding! 🎉&lt;/p&gt;

</description>
      <category>programming</category>
      <category>litellm</category>
      <category>api</category>
      <category>proxy</category>
    </item>
  </channel>
</rss>
