Developer + API

How do you use Plugsky with the Vercel AI SDK?

Create a provider with createOpenAI({ baseURL: "https://api.plugsky.com/v1", apiKey }), then call generateText or streamText with a model such as plugsky-pro. On AI SDK 5 use plugsky.chat("plugsky-pro") so requests go to /v1/chat/completions. Structured output with Zod and tool calling work through the same provider.

Key facts

Plugsky endpointPOST https://api.plugsky.com/v1/chat/completions
Provider setupcreateOpenAI({ baseURL: "https://api.plugsky.com/v1", apiKey: "sk-live-…" })
Model callplugsky.chat("plugsky-pro") targets /v1/chat/completions across 30+ models
StreamingstreamText with a route handler response for UI streaming
Structured outputgenerateObject with a Zod schema uses JSON mode
ToolsAI SDK tool() maps to OpenAI function calling
RuntimesNode 18+, Bun, Deno and edge runtimes with fetch
Product statusLive; the responses endpoint is coming soon on Plugsky, so keep using .chat()

TL;DR

  • One provider factory connects the AI SDK to Plugsky.
  • Use .chat() on AI SDK 5 to avoid the Responses API path.
  • streamText powers chat UIs through route handlers.
  • generateObject with Zod gives typed structured output.
  • Built-in tool definitions map to function calling.

How it works, step by step

  1. Install ai, @ai-sdk/openai and zod; set PLUGSKY_API_KEY.
  2. Create the provider with createOpenAI and the Plugsky base URL.
  3. Call generateText with plugsky.chat("plugsky-pro") and verify the output.
  4. Add a route handler using streamText for incremental UI updates.
  5. Define a Zod schema and extract typed data with generateObject.
  6. Add typed tools with input schemas and execute functions server-side.
  7. Deploy to Node or an edge runtime with the key bound as a server secret.
1Install ai,@ai-sdk/openai andzod; set2Create the providerwith createOpenAIand the Plugsky3Call generateTextwithplugsky.chat("plugsky-pro")4Add a route handlerusing streamTextfor incremental UI5Define a Zod schemaand extract typeddata with6Add typed toolswith input schemasand execute

Original data

POST https://aPlugsky endpointcreateOpenAI({Provider setupplugsky.chat("Model callNode 18+, Bun,RuntimesSource: Plugsky facts table · updated 2026-09-25

Try it yourself

Open the OpenAI-compatible API tester →

Create the provider

The AI SDK ships an OpenAI-compatible provider factory. Point it at Plugsky once and every model call inherits it:

npm install ai @ai-sdk/openai zod
import { createOpenAI } from "@ai-sdk/openai";

const plugsky = createOpenAI({
  baseURL: "https://api.plugsky.com/v1",
  apiKey: process.env.PLUGSKY_API_KEY,
});

On AI SDK 5, call plugsky.chat("plugsky-pro") for chat models. Calling the provider as a function can route to the Responses API, which is coming soon on Plugsky — .chat() keeps requests on the live /v1/chat/completions endpoint. This is the single most common integration mistake.

generateText and streamText

A server-side generation is three lines:

import { generateText } from "ai";

const { text } = await generateText({
  model: plugsky.chat("plugsky-pro"),
  prompt: "Write a six-word release note for a latency fix.",
});

For a chat UI, stream from a route handler. The AI SDK produces a stream response your frontend hooks consume directly:

import { streamText } from "ai";

export async function POST(req: Request) {
  const { messages } = await req.json();

  const result = streamText({
    model: plugsky.chat("plugsky-lite"),
    messages,
  });

  // AI SDK 4: return result.toDataStreamResponse();
  // AI SDK 5:
  return result.toUIMessageStreamResponse();
}

Choose the model per route: plugsky-micro for autocomplete-style features, plugsky-pro for user-facing answers.

Structured output and tools

Zod schemas give you validated objects instead of parsing free text:

import { generateObject } from "ai";
import { z } from "zod";

const { object } = await generateObject({
  model: plugsky.chat("plugsky-pro"),
  schema: z.object({
    title: z.string(),
    tags: z.array(z.string()),
    breaking: z.boolean(),
  }),
  prompt: "Extract release metadata from this changelog.",
});

Tools follow the same pattern: define them with the AI SDK's tool() helper, give each an input schema and an execute function, and pass the tool set to generateText with a step limit. The SDK runs the loop, calling the model, executing tools and feeding results back — all through Plugsky's function-calling support. Keep execute functions server-side and validate their arguments before touching a database or external service.

Edge deployment and secrets

The provider uses fetch, so it runs on Vercel Edge Functions, Node, Bun, Deno and Cloudflare Workers. Two rules for deployment:

  • Keep the key server-side: never expose it through a NEXT_PUBLIC variable or a client component. Route all model calls through route handlers or server actions.
  • Bound latency: set a max duration on the route and pass an abort signal so abandoned requests stop generating tokens.

For observability, log the resolved model id and token usage per request; when you route across models, that data is the only way to explain quality or cost changes later. The responses endpoint, audio, images and batch are roadmap items on Plugsky, so keep workloads on chat completions, structured output and embeddings for now.

Honest comparison

CapabilityPlugsky + AI SDKRaw fetch in a route handlerSelf-hosted gateway
SetupcreateOpenAI with baseURLHand-written fetch and parsingRun and route a proxy layer
StreamingstreamText plus UI stream helpersManual SSE plumbingDepends on the gateway
Structured outputgenerateObject with ZodPrompt and validate yourselfDepends
Toolstool() with schemas and executeManual tool loopCustom dispatch
Edge runtimesVercel Edge, Workers, Bun and Denofetch works anywhereYour own infrastructure
OpsManaged APIManaged APIGPUs, scaling and upgrades

Frequently asked questions

How do I configure Plugsky in the AI SDK?

Use createOpenAI({ baseURL: "https://api.plugsky.com/v1", apiKey }) and then reference models through that provider instance.

Why should I use plugsky.chat() instead of calling the provider directly?

On AI SDK 5 the default model path can use the Responses API, which is coming soon on Plugsky. .chat() targets /v1/chat/completions, which is live.

Does streaming work with the AI SDK?

Yes. streamText works, and on AI SDK 5 you return result.toUIMessageStreamResponse() from your route handler to stream to the UI.

Can I generate typed JSON?

Yes. generateObject with a Zod schema produces validated objects using JSON mode under the hood.

How do tools work?

Define tools with tool(), including an input schema and execute function, then pass them to generateText. The SDK runs the tool loop for you.

Which runtimes are supported?

Anything with fetch: Node 18+, Bun, Deno, Vercel Edge and Cloudflare Workers. Keep the API key in a server-side secret.

How do I control cost per route?

Choose the model per feature: plugsky-micro for cheap completions, plugsky-lite for chat, plugsky-pro for complex answers, and log token usage per request.

What is not available yet?

The responses endpoint, audio, images, moderation, files, batch and fine-tuning are coming soon; chat, streaming, tools, JSON mode and embeddings are live.