Migrate from LiteLLM
Switch from self-hosted LiteLLM to managed Vichar. Same API format, zero infrastructure to maintain.
Running your own LiteLLM proxy works—until it doesn't. Scaling, monitoring, and keeping it running becomes another job. Vichar gives you the same unified API with built-in analytics, caching, and a dashboard—without the infrastructure overhead.
Let your AI agent do the migration
Copy this prompt into Claude Code, Cursor, or any coding agent — it reads our docs and handles the migration from LiteLLM for you.
Quick Migration
Both services use OpenAI-compatible endpoints, so migration is a two-line change:
- const baseURL = "http://localhost:4000/v1"; // LiteLLM proxy
+ const baseURL = "https://api.vichar.io/v1";
- const apiKey = process.env.LITELLM_API_KEY;
+ const apiKey = process.env.LLM_GATEWAY_API_KEY;Why Teams Switch to Vichar
| What You Get | LiteLLM (Self-Hosted) | Vichar |
|---|---|---|
| OpenAI-compatible API | Yes | Yes |
| Infrastructure to manage | Yes (you run it) | No (we run it) |
| Managed cloud option | No | Yes |
| Analytics dashboard | Basic | Per-request detail |
| Response caching | Manual setup | Built-in, automatic |
| Cost tracking | Via callbacks | Native, real-time |
| Provider key management | Config file | Web UI with rotation |
| Uptime & scaling | You handle it | 99.9% SLA (managed) |
Self-hosting also means you own the patch cycle. On March 24, 2026 two malicious litellm releases (1.82.7 and 1.82.8) reached PyPI and were pulled after about 40 minutes; they harvested credentials from unpinned pip installs, while pinned Docker deployments were unaffected. Pin versions wherever you self-host — Vichar included — or use the managed gateway and skip the upkeep.
Still want to self-host? Vichar is open source under AGPLv3 — see Self-Hosting—same features, your infrastructure.
For a detailed breakdown, see Getting Started.
Migration Steps
Get Your Vichar API Key
Sign up at app.vichar.io/signup and create an API key from your dashboard.
Map Your Models
Vichar supports two model ID formats:
Canonical Model IDs (without provider prefix) - Uses smart routing to automatically select the best provider based on uptime, throughput, price, and latency:
gpt-6-astra
claude-sonnet-5
gemini-3.1-pro-previewProvider-Prefixed Model IDs - Routes to a specific provider with automatic failover if uptime drops below 90%:
openai/gpt-6-astra
anthropic/claude-sonnet-5
google-ai-studio/gemini-3.1-pro-previewThis means many LiteLLM model names work directly with Vichar:
| LiteLLM Model | Vichar Model |
|---|---|
| gpt-6-astra | gpt-6-astra or openai/gpt-6-astra |
| anthropic/claude-sonnet-5 | claude-sonnet-5 or anthropic/claude-sonnet-5 |
| gemini/gemini-3.1-pro-preview | gemini-3.1-pro-preview or google-ai-studio/gemini-3.1-pro-preview |
| bedrock/anthropic.claude-sonnet-5 | claude-sonnet-5 or aws-bedrock/claude-sonnet-5 |
For more details on routing behavior, see the routing documentation.
Update Your Code
Python with OpenAI SDK
from openai import OpenAI
# Before (LiteLLM proxy)
client = OpenAI(
base_url="http://localhost:4000/v1",
api_key=os.environ["LITELLM_API_KEY"]
)
response = client.chat.completions.create(
model="gpt-6-astra",
messages=[{"role": "user", "content": "Hello!"}]
)
# After (Vichar) - model name can stay the same!
client = OpenAI(
base_url="https://api.vichar.io/v1",
api_key=os.environ["LLM_GATEWAY_API_KEY"]
)
response = client.chat.completions.create(
model="gpt-6-astra", # or "openai/gpt-6-astra" to target a specific provider
messages=[{"role": "user", "content": "Hello!"}]
)Python with LiteLLM Library
If you're using the LiteLLM library directly, you can point it to Vichar:
import litellm
# Before (direct LiteLLM)
response = litellm.completion(
model="gpt-6-astra",
messages=[{"role": "user", "content": "Hello!"}]
)
# After (via Vichar) - same model name works
response = litellm.completion(
model="gpt-6-astra", # or "openai/gpt-6-astra" to target a specific provider
messages=[{"role": "user", "content": "Hello!"}],
api_base="https://api.vichar.io/v1",
api_key=os.environ["LLM_GATEWAY_API_KEY"]
)TypeScript/JavaScript
import OpenAI from "openai";
// Before (LiteLLM proxy)
const client = new OpenAI({
baseURL: "http://localhost:4000/v1",
apiKey: process.env.LITELLM_API_KEY,
});
// After (Vichar) - same model name works
const client = new OpenAI({
baseURL: "https://api.vichar.io/v1",
apiKey: process.env.LLM_GATEWAY_API_KEY,
});
const completion = await client.chat.completions.create({
model: "gpt-6-astra", // or "openai/gpt-6-astra" to target a specific provider
messages: [{ role: "user", content: "Hello!" }],
});cURL
# Before (LiteLLM proxy)
curl http://localhost:4000/v1/chat/completions \
-H "Authorization: Bearer $LITELLM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-6-astra",
"messages": [{"role": "user", "content": "Hello!"}]
}'
# After (Vichar) - same model name works
curl https://api.vichar.io/v1/chat/completions \
-H "Authorization: Bearer $LLM_GATEWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-6-astra",
"messages": [{"role": "user", "content": "Hello!"}]
}'
# Use "openai/gpt-6-astra" to target a specific providerMigrate Configuration
LiteLLM Config (Before)
# litellm_config.yaml
model_list:
- model_name: gpt-6-astra
litellm_params:
model: openai/gpt-6-astra
api_key: sk-...
- model_name: claude-sonnet-5
litellm_params:
model: anthropic/claude-sonnet-5
api_key: sk-ant-...Vichar (After)
With Vichar, you don't need a config file. Provider keys are managed in the web dashboard, or you can use the default Vichar keys.
Streaming Support
Vichar supports streaming identically to LiteLLM:
from openai import OpenAI
client = OpenAI(
base_url="https://api.vichar.io/v1",
api_key=os.environ["LLM_GATEWAY_API_KEY"]
)
stream = client.chat.completions.create(
model="openai/gpt-6-astra",
messages=[{"role": "user", "content": "Write a story"}],
stream=True
)
for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")Function/Tool Calling
Vichar supports function calling:
from openai import OpenAI
client = OpenAI(
base_url="https://api.vichar.io/v1",
api_key=os.environ["LLM_GATEWAY_API_KEY"]
)
tools = [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the weather for a location",
"parameters": {
"type": "object",
"properties": {
"location": {"type": "string"}
},
"required": ["location"]
}
}
}]
response = client.chat.completions.create(
model="openai/gpt-6-astra",
messages=[{"role": "user", "content": "What's the weather in Tokyo?"}],
tools=tools
)Removing LiteLLM Infrastructure
After verifying Vichar works for your use case, you can decommission your LiteLLM proxy:
- Update all clients to use Vichar endpoints
- Monitor the Vichar dashboard for successful requests
- Shut down your LiteLLM proxy server
- Remove LiteLLM configuration files
What Changes After Migration
- No servers to babysit — We handle scaling, uptime, and updates
- Real-time cost visibility — See what every request costs, broken down by model
- Automatic caching — Repeated requests hit cache, reducing your spend
- Web-based management — No more editing YAML files for config changes
- New models immediately — Access new releases within 48 hours, no deployment needed
Self-Hosting Vichar
If you prefer self-hosting like LiteLLM, Vichar is available under AGPLv3:
git clone https://github.com/vicharai/api
cd llmgateway
pnpm install
pnpm run setup
pnpm devThis gives you the same benefits as LiteLLM's self-hosted proxy with Vichar's analytics and caching features.
Full Comparison
Want to see a detailed breakdown of all features? See Quick Start.
How is this guide?
Last updated on