OpenAI-Compatible API

The OpenAI-compatible API that runs 18+ models

Plugsky implements the full OpenAI API surface — /v1/chat/completions, /v1/embeddings, /v1/models, function calling, JSON mode, streaming, vision — so you can swap base_url and ship in minutes, not weeks.

An OpenAI-compatible API is an HTTP service that mimics the request and response shapes of the OpenAI API. You point an OpenAI SDK at its base_url, and your code runs unchanged. Plugsky is one of these — but it also runs 18+ models behind the same endpoint, not just one vendor's weights.

This page explains exactly what Plugsky's OpenAI-compatible surface covers, how to migrate, and the gotchas to avoid.

What "OpenAI-compatible" actually means

OpenAI's API is a de-facto standard. The /v1/chat/completions endpoint takes a JSON body with a model, messages, and a handful of parameters, and returns a JSON response with a choices array. Hundreds of SDKs and tools — Cursor, Continue, Aider, LangChain, LlamaIndex, Vercel AI SDK, the official OpenAI libraries — speak this shape.

Plugsky replicates the surface 1:1. The endpoint URLs, request bodies, response shape, error codes, and streaming format all match. The only thing that changes is the model names and the price.

Endpoints Plugsky implements

EndpointOpenAI equivalentStatus
POST /v1/chat/completions✅ SameFull support incl. streaming, tools, vision
POST /v1/completions✅ SameLegacy completions endpoint
POST /v1/embeddings✅ SameOpenAI ada-style + custom plugsky embed models
GET /v1/models✅ SameLists all 18+ Plugsky models
POST /v1/audio/*⏳ RoadmapTTS / STT planned Q3
POST /v1/images/*⏳ RoadmapDALL·E-style image gen planned

Supported SDKs and languages

Anything that can talk HTTPS works with Plugsky. Tested daily:

  • Python: openai ≥ 1.0, httpx, requests
  • Node.js / TypeScript: openai, vercel/ai-sdk, langchainjs, llamaindex
  • Browser: fetch, openai-fetch
  • Go: sashabaranov/go-openai
  • Rust: async-openai
  • Ruby: ruby-openai
  • PHP: openai-php/laravel
  • CLI: curl, httpie

One-line migration

python
# Before (OpenAI)
client = OpenAI(api_key="sk-...")

# After (Plugsky — only base_url changes)
client = OpenAI(
    api_key="sk-live-PLUGSKY...",
    base_url="https://api.plugsky.com/v1",
)

resp = client.chat.completions.create(
    model="plugsky-pro",
    messages=[{"role":"user","content":"Hello!"}],
)

The same applies to every other SDK. Set the base URL to https://api.plugsky.com/v1 and you're done.

OpenAI parameters Plugsky honors

  • temperature, top_p, frequency_penalty, presence_penalty
  • max_tokens, stop, seed
  • response_format={"type":"json_object"} for JSON mode
  • tools, tool_choice for function calling
  • stream=true for SSE streaming
  • user for per-end-user tracking
  • logprobs and top_logprobs on supported models

Limitations vs. native OpenAI

You do not get: DALL·E, the Assistants API shape, the Threads / Messages / Runs endpoints, fine-tuning, or OpenAI's built-in moderation endpoint. For those, run OpenAI alongside Plugsky. Most teams use Plugsky for chat / completion / embeddings and keep OpenAI for image gen and TTS.

Request limits & error shapes

Every response from the API — success or failure — is JSON with the OpenAI error schema: {"error":{"message","type","code","param"}}. You will never receive an HTML page from an API endpoint; HTML pages only exist on the marketing/docs site.

ScenarioHTTPcodeNotes
Missing / bad API key401invalid_api_keytype: authentication_error
Model not on your plan400400type: invalid_request_error
Unknown model400400Lists known models in the message
Context window exceeded400400Message includes the upstream's token counts — trim history or reduce max_tokens
Request body > 16 MB413request_too_largeSplit the request or trim the conversation
Rate limited429429Includes Retry-After header
Unknown endpoint404not_foundJSON, never HTML
Upstream provider failure502upstream_failureAuto-retried + cascaded to a backup model first

Request size: the maximum request body is 16 MB (this covers a full 128K-token context plus tool definitions and file excerpts). Requests above 16 MB return 413 request_too_large.

Context windows: all chat models advertise a 128K context window; the upstream service enforces a 1,000,000-token ceiling per request. If your agent compacts long conversations, keep the total request under these limits — 400 errors include the exact token counts so you can size your compaction strategy.

Streaming: errors during streaming are returned as JSON before the SSE stream starts (non-200 status). Once streaming begins you receive OpenAI-format SSE chunks ending in data: [DONE].

Frequently asked questions

Does Plugsky support streaming?

Yes. Pass stream: true to /v1/chat/completions and you get the same SSE event format as OpenAI.

Is function calling / tools supported?

Yes. Pass a tools array and the model returns tool calls in the same shape as OpenAI. Use tool_choice to force a specific tool or "auto".

Do I lose anything by switching?

No streaming, function calling, JSON mode, or token counting. You only lose OpenAI-specific features (DALL·E, Assistants, fine-tuning).

Can I use the official OpenAI SDKs unchanged?

Yes. The official openai Python and Node libraries, plus Vercel AI SDK, LangChain, and LlamaIndex, all work with Plugsky via a base_url change.

Switch in one line

Change the base_url to api.plugsky.com/v1 and your existing OpenAI code runs against 18+ models.

Start Free → Try the tester