Migrating from OpenAI to Plugsky is a one-line change for most stacks. This guide walks you through it for every common language and runtime.
The 1-line migration
For 95% of stacks, the entire migration is changing one constant:
- base_url: "https://api.openai.com/v1"
+ base_url: "https://api.plugsky.com/v1"
That's it. Your existing OpenAI SDK, your existing prompts, your existing code — all of it works against Plugsky. Same request body, same response shape, same streaming format, same function-calling surface.
Python (openai SDK)
# Before
from openai import OpenAI
client = OpenAI()
# After
from openai import OpenAI
client = OpenAI(
api_key="sk-live-PLUGSKY-...",
base_url="https://api.plugsky.com/v1",
)
# Everything else unchanged
resp = client.chat.completions.create(
model="plugsky-pro",
messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)
Node.js (openai / Vercel AI SDK)
// openai
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.PLUGSKY_KEY,
baseURL: "https://api.plugsky.com/v1",
});
// Vercel AI SDK
import { openai } from "@ai-sdk/openai";
import { generateText } from "ai";
const result = await generateText({
model: openai("plugsky-pro", {
baseURL: "https://api.plugsky.com/v1",
}),
prompt: "Hello!",
});
cURL
curl https://api.plugsky.com/v1/chat/completions \
-H "Authorization: Bearer $PLUGSKY_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "plugsky-pro",
"messages": [{"role": "user", "content": "Hello!"}]
}'
Go
// github.com/sashabaranov/go-openai
config := openai.DefaultConfig("sk-live-PLUGSKY-...")
config.BaseURL = "https://api.plugsky.com/v1"
client := openai.NewClientWithConfig(config)
resp, err := client.CreateChatCompletion(ctx, openai.ChatCompletionRequest{
Model: "plugsky-pro",
Messages: []openai.ChatCompletionMessage{
{Role: "user", Content: "Hello!"},
},
})
Edge runtimes (Cloudflare Workers, Vercel Edge)
// Cloudflare Worker
export default {
async fetch(req, env) {
const r = await fetch("https://api.plugsky.com/v1/chat/completions", {
method: "POST",
headers: {
"Authorization": `Bearer ${env.PLUGSKY_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "plugsky-pro",
messages: [{ role: "user", content: "Hello!" }],
}),
});
return new Response(r.body, { headers: r.headers });
},
};
Pre-migration checklist
- Generate a Plugsky API key from your dashboard
- Identify every place in your codebase that hardcodes the OpenAI base URL or model name
- Set up environment variable for the API key (don't hardcode)
- Run your test suite against Plugsky in a non-prod environment
- Verify function calling, JSON mode, and streaming work end-to-end
- Cut over with a feature flag or environment toggle
Use our OpenAI migration checker to generate a snippet for your specific stack.
Frequently asked questions
Do I need to rewrite my prompts?
No. Plugsky honors the same prompt format as OpenAI. Your prompts run unchanged.
Will my function-calling code work?
Yes. The tools array, tool_choice, and tool call response shape are identical.
Can I run both OpenAI and Plugsky in parallel?
Yes — use a feature flag or environment variable to switch. Most teams run both for 1-2 weeks during cutover.
What about streaming?
Streaming works the same way — pass stream: true and you get the same SSE event format.
Get your Plugsky key
7-day trial for $5. No card required. Generate a key, change one line, ship.
Start $5 trial → Get a snippet for your stack