Migration Guide
Migrate from OpenAI or other providers to Macyou with minimal code changes.
Navigation
Migration Guide
Macyou's Deployment API is fully OpenAI-compatible. Migrating from OpenAI (or any OpenAI-compatible provider) requires only two changes: the base URL and the API key.
From OpenAI
Python
# Before (OpenAI)
from openai import OpenAI
client = OpenAI(api_key="sk-...")
# After (Macyou)
from openai import OpenAI
client = OpenAI(
base_url="https://your-deployment.macyou.co/api/v1",
api_key="mcy_live_YOUR_KEY",
)
# Everything else stays the same
response = client.chat.completions.create(
model="llama-4-scout",
messages=[{"role": "user", "content": "Hello!"}],
)Node.js / TypeScript
// Before (OpenAI)
import OpenAI from "openai";
const client = new OpenAI({ apiKey: "sk-..." });
// After (Macyou)
const client = new OpenAI({
baseURL: "https://your-deployment.macyou.co/api/v1",
apiKey: "mcy_live_YOUR_KEY",
});
// Everything else stays the same
const response = await client.chat.completions.create({
model: "llama-4-scout",
messages: [{ role: "user", content: "Hello!" }],
});curl
# Just change the URL and key
curl https://your-deployment.macyou.co/api/v1/chat/completions \
-H "Authorization: Bearer mcy_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"llama-4-scout","messages":[{"role":"user","content":"Hello!"}]}'From LangChain
from langchain_openai import ChatOpenAI
# Just set the base_url and api_key
llm = ChatOpenAI(
base_url="https://your-deployment.macyou.co/api/v1",
api_key="mcy_live_YOUR_KEY",
model="llama-4-scout",
)
response = llm.invoke("Explain the RAG pattern.")From LlamaIndex
from llama_index.llms.openai_like import OpenAILike
llm = OpenAILike(
api_base="https://your-deployment.macyou.co/api/v1",
api_key="mcy_live_YOUR_KEY",
model="llama-4-scout",
is_chat_model=True,
)Key Differences from OpenAI
- Dedicated hardware — your model runs on your own Mac Mini, not shared infrastructure. Latency is consistent.
- No per-token billing — you pay a flat monthly fee for the deployment, not per token.
- Data stays on your machine — requests never leave your dedicated server.
- Model selection — each deployment runs one model. Use
GET /api/v1/modelsto see what's available. - API key format — Macyou keys use the
mcy_live_prefix instead ofsk-.
Environment Variables
We recommend using environment variables to make switching between providers seamless:
# .env
OPENAI_API_BASE=https://your-deployment.macyou.co/api/v1
OPENAI_API_KEY=mcy_live_YOUR_KEYMany OpenAI SDK wrappers and frameworks automatically read these environment variables, so no code changes are needed.