Migrate from LiteLLM
Switch from self-hosted LiteLLM to managed DigitSpace. 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. DigitSpace 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.digitspace.ai/v1";
- const apiKey = process.env.LITELLM_API_KEY;
+ const apiKey = process.env.LLM_GATEWAY_API_KEY;Why Teams Switch to DigitSpace
| What You Get | LiteLLM (Self-Hosted) | DigitSpace |
|---|---|---|
| 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 — DigitSpace included — or use the managed gateway and skip the upkeep.
For a detailed breakdown, see DigitSpace vs LiteLLM.
Migration Steps
Get Your DigitSpace API Key
Sign up at digitspace.ai/signup and create an API key from your dashboard.
Map Your Models
DigitSpace 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 DigitSpace:
| LiteLLM Model | DigitSpace 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 (DigitSpace) - model name can stay the same!
client = OpenAI(
base_url="https://api.digitspace.ai/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 DigitSpace:
import litellm
# Before (direct LiteLLM)
response = litellm.completion(
model="gpt-6-astra",
messages=[{"role": "user", "content": "Hello!"}]
)
# After (via DigitSpace) - 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.digitspace.ai/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 (DigitSpace) - same model name works
const client = new OpenAI({
baseURL: "https://api.digitspace.ai/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 (DigitSpace) - same model name works
curl https://api.digitspace.ai/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-...DigitSpace (After)
With DigitSpace, you don't need a config file. Provider keys are managed in the web dashboard, or you can use the default DigitSpace keys.
If you want to use your own provider keys, configure them in the dashboard under Settings > Provider Keys.
Streaming Support
DigitSpace supports streaming identically to LiteLLM:
from openai import OpenAI
client = OpenAI(
base_url="https://api.digitspace.ai/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
DigitSpace supports function calling:
from openai import OpenAI
client = OpenAI(
base_url="https://api.digitspace.ai/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 DigitSpace works for your use case, you can decommission your LiteLLM proxy:
- Update all clients to use DigitSpace endpoints
- Monitor the DigitSpace 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 DigitSpace
If you prefer self-hosting like LiteLLM, DigitSpace is available under AGPLv3:
git clone https://github.com/theopenco/llmgateway
cd llmgateway
pnpm install
pnpm run setup
pnpm devThis gives you the same benefits as LiteLLM's self-hosted proxy with DigitSpace's analytics and caching features.
Full Comparison
Want to see a detailed breakdown of all features? Check out our DigitSpace vs LiteLLM comparison page.
How is this guide?
Last updated on