Short answer. Call Plugsky from Node.js with the official openai package or fetch. Set baseURL to https://api.plugsky.com/v1 and use a plugsky-* model ID. Chat, streaming, tools and embeddings work.
What the Node.js integration covers
This page is for Node.js and TypeScript applications calling Plugsky directly. The recommended client is the official openai npm package, which provides typed responses, retries, streaming and ESM/CJS support. Raw fetch also works because the API is plain HTTPS JSON.
Install
npm install openai
# Node 18+ has fetch built inOpenAI SDK (recommended)
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.PLUGSKY_API_KEY,
baseURL: "https://api.plugsky.com/v1",
});
const r = await client.chat.completions.create({
model: "plugsky-pro",
messages: [{ role: "user", content: "What is an OpenAI-compatible API?" }],
temperature: 0.2,
max_tokens: 512,
});
console.log(r.choices[0].message.content);Streaming
const stream = await client.chat.completions.create({
model: "plugsky-pro",
messages: [{ role: "user", content: "Count to five." }],
stream: true,
});
for await (const chunk of stream) {
const text = chunk.choices[0]?.delta?.content;
if (text) process.stdout.write(text);
}Raw fetch
const r = await fetch("https://api.plugsky.com/v1/chat/completions", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.PLUGSKY_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ model: "plugsky-pro", messages: [{ role: "user", content: "Hi" }] }),
});
const data = await r.json();
console.log(data.choices[0].message.content);Tool calling
const tools = [{
type: "function",
function: {
name: "get_weather",
description: "Get weather for a city",
parameters: { type: "object", properties: { city: { type: "string" } }, required: ["city"] },
},
}];
const r = await client.chat.completions.create({
model: "plugsky-pro",
messages: [{ role: "user", content: "Weather in Dubai?" }],
tools,
});
console.log(r.choices[0].message.tool_calls);Embeddings
const r = await client.embeddings.create({ model: "plugsky-embed", input: "hello world" });
console.log(r.data[0].embedding.length); // 2048Limits and gotchas
Main text models: 262,144-token context; plugsky-mistral-medium and vision models: 131,072; plugsky-translate: 32,768; embeddings: 8,192 input. Builder: 256K input / 32K output per request; Scale: 512K input / 32K output. Concurrency: Builder 10 / 600 RPM, Scale 16 / 1,200 RPM, Hobby 4 / 120 RPM. Cap max_tokens at the plan output ceiling.
Common errors
- 401: missing, revoked or wrong-host key.
- 404: wrong base URL path or unknown model ID.
- 400 (context): input plus reserved output exceeds the window.
- 429: RPM, concurrency or daily quota exhausted.
- 5xx: server or upstream failure; retry with backoff.
Production checklist
- Pin SDK and model versions; read keys from environment or a secret manager.
- Set explicit timeouts and retries; handle streaming errors.
- Cap
max_tokens; log request IDs, model ID, usage and latency. - Test 429 and context-overflow paths before launch.
What we did not verify
- We did not benchmark latency or throughput.
- We did not test every SDK helper.
- We used
https://api.plugsky.com/v1; confirm the host in your account docs.
Frequently asked questions
How do I call Plugsky from Node.js?
Install the openai package, create a client with apiKey and baseURL 'https://api.plugsky.com/v1', then call client.chat.completions.create with a plugsky-* model ID.
Does the SDK work with ESM and CommonJS?
Yes. The openai package supports both module systems in recent Node versions.
Does streaming work in Node?
Yes. Set stream: true and iterate with for await...of; empty text deltas are normal.
Does tool calling work?
Yes via the tools parameter with standard OpenAI function schemas.
What embedding dimensions should I expect?
2,048 dimensions with an 8,192-token input window.
How do I fix a 401 or 404?
Confirm the key and host api.plugsky.com; use https://api.plugsky.com/v1 and a model ID from GET /v1/models.
Can I use raw fetch instead?
Yes. The API is plain HTTPS JSON, so fetch with an Authorization header works without the SDK.
Related pages
Run your Node service on Plugsky
Start free, test your request path, then choose the plan that matches your concurrency.
Start Free → Read the docsSources
SDK behaviour was checked against the official OpenAI Node repository on 20 November 2026. Plugsky limits were checked against its docs on the same date.
| Source | Page checked | Checked |
|---|---|---|
| OpenAI | openai/openai-node | 20 Nov 2026 |
| Plugsky | plugsky.com/docs and plugsky.com/pricing | 20 Nov 2026 |
| Plugsky | plugsky.com/models | 20 Nov 2026 |
Last checked 20 November 2026. Plugsky's canonical plan numbers live at /pricing; this page explains the integration and does not replace the plan terms.
Sources and dated checks
Checked 20 November 2026. Primary sources checked 20 November 2026: OpenAI API reference, Anthropic API getting started, Cloudflare Workers AI. Confirm current limits and pricing in the provider console before capacity planning.