Quickstart

Send your first reliable OpenAI request.

Create a project, connect your OpenAI key, generate a ReqRun API key, install the SDK, and send one chat completion request through ReqRun.

1. Create a project and API key

Open the dashboard, create a project, connect the project's OpenAI key, then generate a reqrun_test_ or reqrun_live_ API key. The ReqRun key automatically scopes requests to that project.

Open dashboard

2. Install

Shell
npm install @reqrun/sdk

3. Send a request

Use the familiar OpenAI chat completions shape. ReqRun queues the request, retries retryable failures, and returns either the result or a request id.

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

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

const result = await reqrun.chat.completions.create({
  model: "gpt-5-nano",
  messages: [{ role: "user", content: "Reply with exactly OK." }],
  wait: true,
  idempotency_key: "quickstart-001",
});

console.log(result);

Expected output

If the request finishes within the wait timeout, you get a normal OpenAI-style chat completion response.

If it does not finish in time, you get an async response with an rr_ request id.

Check status later

Use wait=false for background work, store the rr_ id, and fetch the request when your app needs the outcome.

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

if (response.object === "chat.completion.async") {
  const request = await reqrun.requests.get(response.id);
  console.log(request.status, request.attempts, request.last_error_code);
}