From LiteLLM

Migrate from LiteLLM

Switch from self-hosted LiteLLM to managed DigitSpace. Same API format, zero infrastructure to maintain.

Published · Updated

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.

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.

Quick Migration

Both services use OpenAI-compatible endpoints, so migration is a two-line change:

1- const baseURL = "http://localhost:4000/v1";  // LiteLLM proxy2+ const baseURL = "https://api.digitspace.ai/v1";3
4- const apiKey = process.env.LITELLM_API_KEY;5+ const apiKey = process.env.DIGITSPACE_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 Managed for you

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 run a proxy yourself, or move to the managed gateway and skip the upkeep.

For a detailed breakdown, see DigitSpace vs LiteLLM.

Migration Steps

1. Get Your DigitSpace API Key

Sign up at digitspace.ai/signup and create an API key from your dashboard.

2. 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:

1gpt-6-astra2claude-sonnet-53gemini-3.1-pro-preview

Provider-Prefixed Model IDs - Routes to a specific provider with automatic failover if uptime drops below 90%:

1openai/gpt-6-astra2anthropic/claude-sonnet-53google-ai-studio/gemini-3.1-pro-preview

This 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.

3. Update Your Code

Python with OpenAI SDK

1from openai import OpenAI2
3# Before (LiteLLM proxy)4client = OpenAI(5    base_url="http://localhost:4000/v1",6    api_key=os.environ["LITELLM_API_KEY"]7)8
9response = client.chat.completions.create(10    model="gpt-6-astra",11    messages=[{"role": "user", "content": "Hello!"}]12)13
14# After (DigitSpace) - model name can stay the same!15client = OpenAI(16    base_url="https://api.digitspace.ai/v1",17    api_key=os.environ["DIGITSPACE_API_KEY"]18)19
20response = client.chat.completions.create(21    model="gpt-6-astra",  # or "openai/gpt-6-astra" to target a specific provider22    messages=[{"role": "user", "content": "Hello!"}]23)

Python with LiteLLM Library

If you're using the LiteLLM library directly, you can point it to DigitSpace:

1import litellm2
3# Before (direct LiteLLM)4response = litellm.completion(5    model="gpt-6-astra",6    messages=[{"role": "user", "content": "Hello!"}]7)8
9# After (via DigitSpace) - same model name works10response = litellm.completion(11    model="gpt-6-astra",  # or "openai/gpt-6-astra" to target a specific provider12    messages=[{"role": "user", "content": "Hello!"}],13    api_base="https://api.digitspace.ai/v1",14    api_key=os.environ["DIGITSPACE_API_KEY"]15)

TypeScript/JavaScript

1import OpenAI from "openai";2
3// Before (LiteLLM proxy)4const client = new OpenAI({5  baseURL: "http://localhost:4000/v1",6  apiKey: process.env.LITELLM_API_KEY,7});8
9// After (DigitSpace) - same model name works10const client = new OpenAI({11  baseURL: "https://api.digitspace.ai/v1",12  apiKey: process.env.DIGITSPACE_API_KEY,13});14
15const completion = await client.chat.completions.create({16  model: "gpt-6-astra", // or "openai/gpt-6-astra" to target a specific provider17  messages: [{ role: "user", content: "Hello!" }],18});

cURL

1# Before (LiteLLM proxy)2curl http://localhost:4000/v1/chat/completions \3  -H "Authorization: Bearer $LITELLM_API_KEY" \4  -H "Content-Type: application/json" \5  -d '{6    "model": "gpt-6-astra",7    "messages": [{"role": "user", "content": "Hello!"}]8  }'9
10# After (DigitSpace) - same model name works11curl https://api.digitspace.ai/v1/chat/completions \12  -H "Authorization: Bearer $DIGITSPACE_API_KEY" \13  -H "Content-Type: application/json" \14  -d '{15    "model": "gpt-6-astra",16    "messages": [{"role": "user", "content": "Hello!"}]17  }'18# Use "openai/gpt-6-astra" to target a specific provider

4. Migrate Configuration

LiteLLM Config (Before)

1# litellm_config.yaml2model_list:3  - model_name: gpt-6-astra4    litellm_params:5      model: openai/gpt-6-astra6      api_key: sk-...7  - model_name: claude-sonnet-58    litellm_params:9      model: anthropic/claude-sonnet-510      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:

1from openai import OpenAI2
3client = OpenAI(4    base_url="https://api.digitspace.ai/v1",5    api_key=os.environ["DIGITSPACE_API_KEY"]6)7
8stream = client.chat.completions.create(9    model="openai/gpt-6-astra",10    messages=[{"role": "user", "content": "Write a story"}],11    stream=True12)13
14for chunk in stream:15    if chunk.choices[0].delta.content:16        print(chunk.choices[0].delta.content, end="")

Function/Tool Calling

DigitSpace supports function calling:

1from openai import OpenAI2
3client = OpenAI(4    base_url="https://api.digitspace.ai/v1",5    api_key=os.environ["DIGITSPACE_API_KEY"]6)7
8tools = [{9    "type": "function",10    "function": {11        "name": "get_weather",12        "description": "Get the weather for a location",13        "parameters": {14            "type": "object",15            "properties": {16                "location": {"type": "string"}17            },18            "required": ["location"]19        }20    }21}]22
23response = client.chat.completions.create(24    model="openai/gpt-6-astra",25    messages=[{"role": "user", "content": "What's the weather in Tokyo?"}],26    tools=tools27)

Removing LiteLLM Infrastructure

After verifying DigitSpace works for your use case, you can decommission your LiteLLM proxy:

  1. Update all clients to use DigitSpace endpoints
  2. Monitor the DigitSpace dashboard for successful requests
  3. Shut down your LiteLLM proxy server
  4. 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

Full Comparison

Want to see a detailed breakdown of all features? Check out our DigitSpace vs LiteLLM comparison page.

Need Help?