mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-05 14:23:44 +00:00
docs gemini cli
This commit is contained in:
@@ -1,30 +1,68 @@
|
||||
# Use LiteLLM with Gemini CLI
|
||||
|
||||
Quickstart
|
||||
This tutorial shows you how to integrate the Gemini CLI with LiteLLM Proxy, allowing you to route requests through LiteLLM's unified interface.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
### 1. Install Gemini CLI
|
||||
Before you begin, ensure you have:
|
||||
- Node.js and npm installed on your system
|
||||
- A running LiteLLM Proxy instance
|
||||
- A valid LiteLLM Proxy API key
|
||||
- Git installed for cloning the repository
|
||||
|
||||
## Quick Start Guide
|
||||
|
||||
### Step 1: Install Gemini CLI
|
||||
|
||||
Clone the Gemini CLI repository and navigate to the project directory:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/ishaan-jaff/gemini-cli.git
|
||||
cd gemini-cli
|
||||
```
|
||||
|
||||
### 2. Point Gemini CLI to LiteLLM Proxy
|
||||
Install the required dependencies:
|
||||
|
||||
Set `BASE_URL` to the LiteLLM Proxy URL and set `GEMINI_API_KEY` to your LiteLLM Proxy API key.
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
### Step 2: Configure Gemini CLI for LiteLLM Proxy
|
||||
|
||||
Configure the Gemini CLI to point to your LiteLLM Proxy instance by setting the required environment variables:
|
||||
|
||||
```bash
|
||||
export BASE_URL=http://localhost:4000
|
||||
export GEMINI_API_KEY=sk-1234567890
|
||||
```
|
||||
|
||||
### 3. Run Gemini CLI
|
||||
**Note:** Replace the values with your actual LiteLLM Proxy configuration:
|
||||
- `BASE_URL`: The URL where your LiteLLM Proxy is running
|
||||
- `GEMINI_API_KEY`: Your LiteLLM Proxy API key
|
||||
|
||||
### Step 3: Build and Start Gemini CLI
|
||||
|
||||
Build the project and start the CLI:
|
||||
|
||||
```bash
|
||||
npm run build && npm start
|
||||
```
|
||||
|
||||
### 4. Test it
|
||||
### Step 4: Test the Integration
|
||||
|
||||
Once the CLI is running, you can send test requests. These requests will be automatically routed through LiteLLM Proxy to the configured Gemini model.
|
||||
|
||||
The CLI will now use LiteLLM Proxy as the backend, giving you access to LiteLLM's features like:
|
||||
- Request/response logging
|
||||
- Rate limiting
|
||||
- Cost tracking
|
||||
- Model routing and fallbacks
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If you encounter issues:
|
||||
|
||||
1. **Connection errors**: Verify that your LiteLLM Proxy is running and accessible at the configured `BASE_URL`
|
||||
2. **Authentication errors**: Ensure your `GEMINI_API_KEY` is valid and has the necessary permissions
|
||||
3. **Build failures**: Make sure all dependencies are installed with `npm install`
|
||||
|
||||
Send a test request on Gemini CLI, this will get routed to LiteLLM Proxy and then to Gemini.
|
||||
|
||||
Reference in New Issue
Block a user