Short answer. An OpenAI-to-Plugsky migration usually changes three things: the base URL becomes
https://api.plugsky.com/v1, the API key becomes a Plugsky key, and the model name becomes a public Plugsky ID such asplugsky-pro. Chat completions, streaming, JSON mode, function calling and embeddings keep the OpenAI request shape. Test on representative traffic and keep a rollback path.
Generate a migration snippet
Choose the stack you actually run and the workload you are moving. The output is a starting point for a branch, not a production patch: replace the key value, confirm the model ID, and run your own evaluation before you cut over.
Base URL. Use https://api.plugsky.com/v1. The docs also list https://plugsky.com/v1 as an alias for the same API. Put the host in configuration and use one value per environment; do not mix the two in a codebase.
What actually changes in the code
The OpenAI SDKs expose a base URL and an API key, and Plugsky implements the same chat completions, streaming, JSON mode, function calling and embeddings shapes. For a chat workload, the diff is small:
| Setting | Before | After | Risk |
|---|---|---|---|
| Base URL | OpenAI API host | https://api.plugsky.com/v1 | Trailing slash or a missing /v1 produces a 404 |
| API key | OpenAI key | A Plugsky key from the dashboard | A key committed to the repository must be rotated |
| Model ID | OpenAI model name | A public Plugsky ID | An unknown ID returns a model error, not a silent fallback |
| Messages array | role and content | Same shape | Keep the same role names and content parts |
| Streaming | stream: true | Same flag | Handle delta chunks and the finish reason; request usage explicitly if you bill from it |
| Tools | tools and tool_choice | Same shape | Validate tool arguments before executing them |
The response shape is not a promise that every optional field is identical. Test the fields you depend on: usage, finish_reason, tool-call arguments, refusal or safety fields, and any provider-specific metadata. If a field is missing, decide whether the application can tolerate it before you switch production traffic.
Suggested model IDs for a first pass
The API catalogue is authoritative: all public model IDs, with the main text models serving 262,144 tokens of context. The mappings below are starting points for an evaluation, not claims that two models produce identical output.
| OpenAI workload | Suggested Plugsky ID | Context | Why start here |
|---|---|---|---|
| General chat, GPT-4o class | plugsky-pro | 262,144 | General-purpose text and tool use |
| Cheap classification, GPT-4o-mini class | plugsky-lite | 262,144 | Lower-cost tier for high-volume simple tasks |
| Reasoning | plugsky-reasoning | 262,144 | Tasks that need a longer internal reasoning pass |
| Embeddings | plugsky-embed | 8,192 | 2,048-dimension embeddings for retrieval |
| Vision and documents | plugsky-vision-fast | 131,072 | Image and document input on a smaller context |
The model catalogue lists every public ID, its context window and its output limit. A model name from a legacy integration may still resolve, but the API response is the authority on what actually served the request. Check x-plugsky-served-model when a routing question matters.
Pre-flight checklist
- The base URL is
https://api.plugsky.com/v1, stored in configuration rather than hard-coded per file. - The API key is a Plugsky key, loaded from a secret manager, and no key is in the repository or the browser bundle.
- Every model ID is a public Plugsky ID; no OpenAI model name remains in a request path.
- Streaming handles delta chunks, an empty first chunk, a finish reason and a mid-stream error.
- JSON mode validates the parsed object rather than trusting the model to return valid JSON.
- Function calling validates tool arguments and enforces a timeout on every tool.
- Token counts are logged from the response
usagefield, not estimated from character counts. - Retries use exponential backoff and an idempotency key where the operation supports one.
- Rate limits and concurrency match the plan. The plan limits are on pricing.
- A rollback path is tested: one configuration change restores the previous provider.
Streaming, tools and embeddings
Streaming is the first thing to test because it changes the client loop, not just the request. A stream can deliver an empty content delta, a tool-call delta and a finish reason in a different order than a chat completion. If you bill from the stream, request usage explicitly and check that the final frame carries it. Log the raw frames for one day and replay them against your parser.
Function calling adds a second failure surface: the model can return a tool name your application does not implement, or arguments that do not match the schema. Validate both before execution, and cap the number of tool iterations. A loop that calls a model five times for one user action is five billed requests, regardless of provider.
Embeddings are a separate endpoint and a separate model. Do not reuse a chat model ID for an embeddings call, and re-index the vector store if the embedding dimension changes. The plugsky-embed route returns 2,048 dimensions; check the dimension before you swap it into an existing index.
Data residency and security review
Plugsky's live regions are eu-central-1 in Frankfurt, me-central-1 in the UAE, ap-southeast-1 in Singapore and us-east-1 in Virginia. Riyadh is available on Enterprise and is not a self-serve default region. Choose the region that matches your data-flow map, and confirm the processing location in writing for a regulated workload.
For a vendor review, request the current SOC 2 documentation under NDA and confirm the audit period, scope and any exceptions. A DPA with GDPR Article 28 terms and EU SCCs is available on paid plans, with bespoke addenda on Enterprise. A private VPC, on-premises or air-gapped deployment is contract-led; confirm the scope rather than assuming it from a pricing page. The docs describe the API surface, and the migration guide at /docs/migrate/openai-api covers the endpoint changes in more detail.
What the checker does not do
- It does not scan your repository. It cannot find an OpenAI URL or key in your code.
- It does not run the snippet. The output is text, not a tested build.
- It does not guarantee field parity. Test the response fields your application reads.
- It does not benchmark quality. Model choice needs your own evaluation set.
- It does not store your selections. The generator runs in the browser.
Frequently asked questions
What does the migration checker generate?
It generates a ready-to-paste code snippet for your selected language, framework and workload. The snippet points at the Plugsky base URL and uses a public Plugsky model ID. It is a starting point, not a compiled or run-tested migration.
Which stacks are covered?
The selector covers the OpenAI Python and Node SDKs, LangChain, LlamaIndex, the Vercel AI SDK, browser fetch, Go, Rust, Ruby, PHP and cURL. Dedicated snippets exist for the common workload combinations; other combinations fall back to the chat example for that stack.
What changes when I switch the base URL?
The request path and response shape stay the same for chat completions, streaming, JSON mode, function calling and embeddings. The base URL becomes the Plugsky endpoint and the API key becomes a Plugsky key. Model IDs must be changed to public Plugsky IDs, because an OpenAI model name is not a Plugsky model name.
Does every workload combination have a dedicated snippet?
No. The generator has dedicated snippets for the most common combinations. When a combination is not defined, it shows the chat completion example for that stack and displays a note above the snippet, so the fallback is visible before you copy it.
How do I roll back if the migration fails?
Keep the OpenAI client configuration in an environment variable or a single config module, not scattered through the codebase. A rollback is then a base URL and key change, not a redeploy. Run both providers in parallel on a sample of traffic until quality, latency and error rates match your baseline.
Related pages
Migrate one workload, then compare the bill
all public model IDs behind one OpenAI-compatible endpoint. Builder and Scale are flat monthly with no per-token overage.
Start free See plansSources
The request shapes and SDK configuration below were checked on the linked official pages on 20 November 2026.
- OpenAI: create chat completion — messages, tools, streaming and response fields. Checked 20 November 2026.
- OpenAI Python SDK — client construction, base URL and streaming interface. Checked 20 November 2026.
- OpenAI: streaming responses — delta chunks and finish handling. Checked 20 November 2026.
Last checked 20 November 2026. The canonical API base URL is https://api.plugsky.com/v1; https://plugsky.com/v1 is documented as an alias for the same API. This generator is an editorial aid, not a migration guarantee.