Documentation Index
Fetch the complete documentation index at: https://docs.savegate.ai/llms.txt
Use this file to discover all available pages before exploring further.
Why Migrate to SaveGate?
30-50% Cost Savings
Save significantly on API costs with enterprise pricing passed to you
Unlimited Rate Limits
No more TPM/RPM restrictions - scale without limits
Multi-Provider Access
Access all providers through a single API key
Drop-In Replacement
Change 2 lines of code - that’s it!
From OpenAI
Python
from openai import OpenAI
client = OpenAI(
api_key="sk-...your-openai-key..."
)
response = client.chat.completions.create(
model="gpt-5.1",
messages=[{"role": "user", "content": "Hello!"}]
)
Node.js
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env.OPENAI_API_KEY
});
Environment Variables
Update your .env file:
OPENAI_API_KEY=sk-...your-openai-key...
From Anthropic
Python
from anthropic import Anthropic
client = Anthropic(
api_key="sk-ant-..."
)
message = client.messages.create(
model="claude-sonnet-4.5",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}]
)
From Google AI
import google.generativeai as genai
genai.configure(api_key="...")
model = genai.GenerativeModel('gemini-pro')
response = model.generate_content("Hello")
From LangChain
Before
from langchain.chat_models import ChatOpenAI
llm = ChatOpenAI(
model="gpt-5.1",
openai_api_key="sk-..."
)
After
from langchain.chat_models import ChatOpenAI
llm = ChatOpenAI(
model="gpt-5.1",
openai_api_key="sk-savegate-xxxxxxxxxxxxx",
openai_api_base="https://api.savegate.ai/v1"
)
Or use environment variables:
import os
os.environ["OPENAI_API_KEY"] = "sk-savegate-xxxxxxxxxxxxx"
os.environ["OPENAI_API_BASE"] = "https://api.savegate.ai/v1"
from langchain.chat_models import ChatOpenAI
llm = ChatOpenAI(model="gpt-4")
From LlamaIndex
Before
from llama_index.llms import OpenAI
llm = OpenAI(model="gpt-4", api_key="sk-...")
After
from llama_index.llms import OpenAI
llm = OpenAI(
model="gpt-5.1",
api_key="sk-savegate-xxxxxxxxxxxxx",
api_base="https://api.savegate.ai/v1"
)
Migration Checklist
Update Configuration
Change your API key and base URL in your code or environment variables
Test in Development
Run your application in development to ensure everything works
Monitor Usage
Check the SaveGate dashboard to verify requests are flowing through
Deploy to Production
Update your production environment variables and deploy
Optimize
Use multi-model features and monitor costs to optimize further
Common Migration Patterns
Pattern 1: Feature Flag
Test SaveGate alongside your current provider:
import os
from openai import OpenAI
USE_SAVEGATE = os.getenv("USE_SAVEGATE", "false").lower() == "true"
if USE_SAVEGATE:
client = OpenAI(
api_key=os.getenv("SAVEGATE_API_KEY"),
base_url="https://api.savegate.ai/v1"
)
else:
client = OpenAI(
api_key=os.getenv("OPENAI_API_KEY")
)
# Rest of your code remains the same
response = client.chat.completions.create(...)
Pattern 2: Gradual Rollout
Migrate a percentage of requests:
import random
from openai import OpenAI
def get_client():
# 20% of requests go to SaveGate
if random.random() < 0.2:
return OpenAI(
api_key="sk-savegate-xxxxxxxxxxxxx",
base_url="https://api.savegate.ai/v1"
)
else:
return OpenAI(api_key="sk-openai-...")
client = get_client()
Pattern 3: Fallback Strategy
Use SaveGate with fallback to original provider:
from openai import OpenAI
def chat_with_fallback(message, model="gpt-4"):
# Try SaveGate first
try:
client = OpenAI(
api_key="sk-savegate-xxxxxxxxxxxxx",
base_url="https://api.savegate.ai/v1"
)
response = client.chat.completions.create(
model=model,
messages=[{"role": "user", "content": message}],
timeout=10
)
return response.choices[0].message.content
except Exception as e:
print(f"SaveGate failed, using fallback: {e}")
# Fallback to OpenAI
client = OpenAI(api_key="sk-openai-...")
response = client.chat.completions.create(
model=model,
messages=[{"role": "user", "content": message}]
)
return response.choices[0].message.content
Troubleshooting
Issue: Invalid API keySolution:
- Verify your SaveGate API key is correct
- Check that you’re using
sk-savegate- prefix
- Ensure the key hasn’t been revoked
Issue: Model ID not recognizedSolution:
- Check the models list
- Verify the model ID is correct
- Some model IDs may differ slightly from original providers
Different Response Format
Issue: Hit rate limitsSolution:
- This should be rare with SaveGate
- Implement exponential backoff
- Contact support if persistent
Estimate your savings after migration:
def calculate_savings(monthly_tokens_in, monthly_tokens_out, model="gpt-4"):
# Pricing per 1K tokens
pricing = {
"gpt-5.1": {
"openai": {"input": 0.04, "output": 0.08},
"savegate": {"input": 0.028, "output": 0.056}
},
"gpt-4.2": {
"openai": {"input": 0.02, "output": 0.04},
"savegate": {"input": 0.014, "output": 0.028}
},
"claude-sonnet-4.5": {
"anthropic": {"input": 0.004, "output": 0.020},
"savegate": {"input": 0.003, "output": 0.014}
}
}
model_pricing = pricing.get(model)
if not model_pricing:
return "Model not found"
# Calculate costs (convert to thousands)
tokens_in_k = monthly_tokens_in / 1000
tokens_out_k = monthly_tokens_out / 1000
original_cost = (
tokens_in_k * list(model_pricing.values())[0]["input"] +
tokens_out_k * list(model_pricing.values())[0]["output"]
)
savegate_cost = (
tokens_in_k * model_pricing["savegate"]["input"] +
tokens_out_k * model_pricing["savegate"]["output"]
)
savings = original_cost - savegate_cost
savings_percent = (savings / original_cost) * 100
return {
"original_cost": f"${original_cost:.2f}",
"savegate_cost": f"${savegate_cost:.2f}",
"monthly_savings": f"${savings:.2f}",
"yearly_savings": f"${savings * 12:.2f}",
"savings_percent": f"{savings_percent:.1f}%"
}
# Example: 10M input tokens, 5M output tokens per month
result = calculate_savings(10_000_000, 5_000_000, "gpt-4.2")
print(result)
# {'original_cost': '$400.00', 'savegate_cost': '$280.00',
# 'monthly_savings': '$120.00', 'yearly_savings': '$1,440.00',
# 'savings_percent': '30.0%'}
Need Help?
Migration Support
Get help from our team with your migration
Documentation
Review our quickstart guide
API Reference
Explore the complete API docs