Integration guide

OpenAI SDK compatibility with Plugsky

Plugsky is OpenAI-compatible, so the official OpenAI Python and Node SDKs work with a base URL and model ID change. No Plugsky-specific SDK is required.

Short answer. Plugsky exposes an OpenAI-compatible API, so the official OpenAI Python and Node SDKs work with a base URL change to https://api.plugsky.com/v1 and a plugsky-* model ID. Chat, streaming, tool calling, structured output and embeddings are supported.

What OpenAI SDK compatibility means

Plugsky exposes an OpenAI-compatible HTTP API. The OpenAI SDKs (Python and Node) are the reference clients for that API, so compatibility is the point of the integration: you keep your existing SDK calls and change the base URL and model ID. There is no Plugsky-specific SDK to install and no wrapper to maintain.

This page covers both official SDKs. The Python and Node packages share the same request and response shapes, so the examples translate line by line apart from casing and async conventions.

Install and configure

Install the official package for your language. Then point the client at Plugsky and use a plugsky-* model ID.

Python
pip install openai
Node
npm install openai
Python
from openai import OpenAI
client = OpenAI(
    api_key="YOUR_PLUGSKY_API_KEY",
    base_url="https://api.plugsky.com/v1",
)
r = client.chat.completions.create(
    model="plugsky-pro",
    messages=[{"role": "user", "content": "Summarise this contract in one paragraph."}],
)
print(r.choices[0].message.content)
Node
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: "Summarise this contract in one paragraph." }],
});
console.log(r.choices[0].message.content);

Streaming

Both SDKs read server-sent events from the Chat Completions endpoint. Set stream=True (Python) or stream: true (Node) and iterate the chunks. Empty text deltas are normal; the final chunk may carry usage or finish metadata.

Python
stream = client.chat.completions.create(
    model="plugsky-pro",
    messages=[{"role": "user", "content": "Write a haiku about latency."}],
    stream=True,
)
for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)

Tool calling and structured output

Standard OpenAI function schemas work through the tools parameter. The model proposes a call; your code decides whether to execute it. Use tool_choice to force or disable calls. For structured output, use response_format={"type": "json_object"} or a JSON schema, and validate the parsed result in your application.

Embeddings

Plugsky publishes three embedding IDs: plugsky-embed, plugsky-embed-nim and plugsky-embed-multilingual. They return 2,048-dimension vectors with an 8,192-token input window. Configure your vector store for 2,048 dimensions before ingesting documents.

Python
r = client.embeddings.create(model="plugsky-embed", input="What is an OpenAI-compatible API?")
print(len(r.data[0].embedding))  # 2048

Limits and gotchas

Main text models have a 262,144-token context window; plugsky-mistral-medium and the vision models use 131,072, plugsky-translate uses 32,768, and embeddings use 8,192. The plan can impose a lower input ceiling than the model. Builder allows 256K input and 32K output per request; Scale allows a 512K plan input ceiling and 32K output. Context is shared between input and output.

Concurrency is per account: Builder 10 concurrent requests and 600 RPM, Scale 16 and 1,200 RPM, Hobby 4 and 120 RPM. Cap max_tokens at the plan output ceiling (8K Hobby, 16K Starter, 32K Builder and Scale). Use the x-plugsky-served-model response header when you need the actual serving engine behind a legacy ID.

Common errors

  • 401: missing, revoked or wrong-host key. Confirm the key and that requests go to api.plugsky.com.
  • 404: wrong base URL path or unknown model ID. Use https://api.plugsky.com/v1 and an ID from GET /v1/models.
  • 400 (context): input plus reserved output exceeds the model or plan window. Trim history or reduce max_tokens.
  • 429: RPM, concurrency or daily quota exhausted. Honour Retry-After and add backoff.
  • 5xx: server or upstream failure. Retry with jittered backoff.

Production checklist

  • Pin the SDK and model ID versions.
  • Set an explicit request timeout and max_retries.
  • Cap max_tokens at the plan output ceiling.
  • Log request IDs, model ID, token usage and latency; keep prompts out of logs unless policy allows.
  • Test a 429 path and a context-overflow path before launch.

What we did not verify

  • We did not run latency, throughput or uptime benchmarks.
  • We did not test every SDK method or helper; this page covers chat, streaming, tools, structured output and embeddings.
  • We did not compare Plugsky token counts with tiktoken; client-side counts are estimates.
  • We used https://api.plugsky.com/v1 throughout; confirm the host in your account documentation.

Frequently asked questions

Is the OpenAI SDK compatible with Plugsky?

Yes. Plugsky exposes an OpenAI-compatible API, so the official OpenAI Python and Node SDKs work with a base URL change to https://api.plugsky.com/v1 and a plugsky-* model ID.

Which base URL should I use?

Use https://api.plugsky.com/v1, including the /v1 suffix and without a trailing slash. The SDK appends /chat/completions to that root.

Which model name should I pass?

Use an exact public ID such as plugsky-pro or plugsky-micro. Plugsky's catalogue contains public plugsky-* IDs; gpt-4o is not one of them. List current IDs from GET /v1/models.

Does streaming work?

Yes. Set stream=True (Python) or stream: true (Node) and iterate server-sent event chunks. Empty text deltas are normal.

Do tool calling and structured output work?

Standard OpenAI function schemas work through the tools parameter, and response_format supports JSON object or JSON schema. Validate parsed results in your application.

What embedding dimensions should I expect?

Plugsky's three embedding models return 2,048-dimension vectors with an 8,192-token input window.

How do I fix a 401 or 404?

A 401 means a missing, revoked or wrong-host key. A 404 usually means a wrong base URL path or unknown model ID. Confirm https://api.plugsky.com/v1 and an ID from /v1/models.

Related pages

Ship the OpenAI SDK on Plugsky

Start free, test chat, streaming and tool calls, then choose the plan that matches your concurrency.

Start Free → Read the docs

Sources

SDK behaviour was checked against the official OpenAI Python and Node repositories on 20 November 2026. Plugsky limits were checked against its docs on the same date.

Official pages used for this integration guide
SourcePage checkedChecked
OpenAIopenai/openai-python and openai/openai-node20 Nov 2026
Plugskyplugsky.com/docs and plugsky.com/pricing20 Nov 2026
Plugskyplugsky.com/models20 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.