Skip to content
InferencePassInferencePass

TypeScript SDK

Install the SDK in a Node or browser-compatible fetch runtime:

pnpm add @inferencepass/sdk
import { InferencePass } from "@inferencepass/sdk";

const apiKey = process.env.INFERENCEPASS_API_KEY;
if (!apiKey) throw new Error("Set INFERENCEPASS_API_KEY before running this example.");
const baseUrl = process.env.INFERENCEPASS_API_BASE;
const client = new InferencePass({
  apiKey,
  ...(baseUrl ? { baseUrl } : {}),
  timeoutMs: 15_000,
  maxRetries: 2,
});

const response = await client.chat.completions.create({
  model: "gpt-5.6-sol",
  messages: [{ role: "user", content: "Say hello." }],
});

The client accepts typed apiKey, baseUrl, timeoutMs, maxRetries, fetch, and AbortSignal options. client.chat.completions.stream(request) is an async iterable of native stream events. Retries are limited to documented retryable failures and never replay a streaming request or hide a billed attempt.

InferencePassError exposes code, requestId, status, retryable, charged, and retryAfterSeconds, so application policy can make an explicit decision.