SDK

Familiar OpenAI shape, smaller reliability surface.

The SDK keeps chat.completions.create and adds one status method for async request ids.

Install

Shell
npm install @reqrun/sdk

Usage

TypeScript
import { ReqRun } from "@reqrun/sdk";

const reqrun = new ReqRun({
  apiKey: process.env.REQRUN_API_KEY!,
  baseURL: "https://api.reqrun.com",
});

const response = await reqrun.chat.completions.create({
  model: "gpt-5-nano",
  messages: [{ role: "user", content: "Hello" }],
  wait: true,
});

const request = await reqrun.requests.get("rr_abc123");

Async fallback

Use wait=false for background work, or handle the async object when wait=true cannot finish before the timeout.

TypeScript
const response = await reqrun.chat.completions.create({
  model: "gpt-5-nano",
  messages: [{ role: "user", content: "Run this background LLM task." }],
  wait: false,
  idempotency_key: "task-123",
});

if (response.object === "chat.completion.async") {
  await saveRequestId(response.id);
}

API surface

  • new ReqRun({ apiKey, baseURL? })
  • reqrun.chat.completions.create(params)
  • reqrun.requests.get(id)