Getting started
Migrate from the OpenAI SDK
Point an existing OpenAI integration at AILabStore by changing the base URL and key, in Python, TypeScript, curl and popular frameworks.
6 min read · Updated November 1, 2026
The AILabStore API implements the OpenAI Chat Completions, Embeddings and Models endpoints. If your app already uses an OpenAI SDK, migrating is a configuration change: set a new base URL, use your AILabStore key, and prefix model names with their provider.
The three changes
| Before | After | |
|---|---|---|
| Base URL | https://api.openai.com/v1 |
https://api.ailabstore.cc/v1 |
| API key | OPENAI_API_KEY |
AILABSTORE_API_KEY |
| Model | gpt-4o-mini |
openai/gpt-4o-mini (or any other provider's model) |
That's it. Request and response shapes stay the same.
Python
import os
from openai import OpenAI
# Before
# client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
# After
client = OpenAI(
base_url="https://api.ailabstore.cc/v1",
api_key=os.environ["AILABSTORE_API_KEY"],
)
resp = client.chat.completions.create(
model="openai/gpt-4o-mini",
messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)
The SDK also reads environment variables, so in many apps you can migrate without touching code at all:
export OPENAI_BASE_URL="https://api.ailabstore.cc/v1"
export OPENAI_API_KEY="$AILABSTORE_API_KEY"
TypeScript
import OpenAI from "openai";
// Before
// const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
// After
const client = new OpenAI({
baseURL: "https://api.ailabstore.cc/v1",
apiKey: process.env.AILABSTORE_API_KEY,
});
const resp = await client.chat.completions.create({
model: "openai/gpt-4o-mini",
messages: [{ role: "user", content: "Hello!" }],
});
console.log(resp.choices[0].message.content);
curl
curl https://api.ailabstore.cc/v1/chat/completions \
-H "Authorization: Bearer $AILABSTORE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "openai/gpt-4o-mini", "messages": [{"role": "user", "content": "Hello!"}]}'
Now try other providers
Once you are on AILabStore, the same client reaches every provider in the catalog:
MODELS = {
"reasoning": "anthropic/claude-opus-5.5",
"everyday": "anthropic/claude-sonnet-5.5",
"cheap": "google/gemini-2.5-flash-lite",
"coding": "qwen/qwen3-coder",
}
resp = client.chat.completions.create(
model=MODELS["cheap"],
messages=[{"role": "user", "content": "Classify: 'My invoice is wrong' -> billing/tech/other"}],
)
A practical pattern is to keep model ids in configuration rather than code, so you can compare providers without redeploying.
Frameworks
Most frameworks accept a base URL for their OpenAI integration.
LangChain (Python)
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
model="anthropic/claude-sonnet-5.5",
base_url="https://api.ailabstore.cc/v1",
api_key=os.environ["AILABSTORE_API_KEY"],
)
print(llm.invoke("Write a haiku about migrations.").content)
Vercel AI SDK (TypeScript)
import { createOpenAI } from "@ai-sdk/openai";
import { generateText } from "ai";
const ailabstore = createOpenAI({
baseURL: "https://api.ailabstore.cc/v1",
apiKey: process.env.AILABSTORE_API_KEY,
});
const { text } = await generateText({
model: ailabstore.chat("google/gemini-2.5-flash"),
prompt: "Summarise the benefits of a unified AI gateway.",
});
LlamaIndex
from llama_index.llms.openai_like import OpenAILike
llm = OpenAILike(
model="mistral/mistral-medium-3",
api_base="https://api.ailabstore.cc/v1",
api_key=os.environ["AILABSTORE_API_KEY"],
is_chat_model=True,
)
Embeddings
The embeddings endpoint works the same way:
emb = client.embeddings.create(
model="openai/text-embedding-3-small",
input=["first document", "second document"],
)
print(len(emb.data[0].embedding)) # 1536
Remember that vectors from different embedding models are not interchangeable. If you switch embedding models, re-embed your corpus.
What to check after migrating
- Model names: every
modelvalue now needs aprovider/prefix. Search your codebase for hard-coded model strings. - Feature support: tool calling, JSON mode and vision are supported on models that offer them natively. Check the model's page in the catalog before relying on a feature with a new provider.
- Token limits: context windows and maximum output tokens vary by model. Set
max_tokensexplicitly when switching providers. - Timeouts: some reasoning models take longer to respond. Use streaming or raise client timeouts for long tasks.
- Cost tracking: usage now appears in Portal → Usage, broken down by model and provider.
Rolling back
Because only configuration changes, rolling back is as simple as restoring the previous base URL and key. We recommend migrating one service at a time and comparing outputs and latency before moving the rest.