Skip to content
Book a demo

TypeScript SDK

@renai-labs/sdk is the official TypeScript client for the Ren API. It’s fully typed, generated from the same OpenAPI spec that powers the API reference.

Install

Terminal window
npm install @renai-labs/sdk

Quick start

  1. Create a client with a base URL and an auth strategy:

    import { createRenClient, pat } from "@renai-labs/sdk"
    const client = createRenClient({
    baseUrl: "https://api.renai.build",
    auth: pat(process.env.REN_PAT_TOKEN!),
    })
  2. Call a resource. Methods are grouped by resource and return { data, error, request, response }:

    const { data: skills } = await client.skill.list()

Calls are grouped by resource: client.agent, client.skill, client.mcp, client.pod, client.project, client.session, client.trigger, client.vault, client.credential, client.fileStore, client.memoryStore, client.environment, client.replay, client.blueprint, client.registry, client.pat. Each exposes the operations available on that resource.

Authentication

Authenticate with a personal access token via the pat strategy, for server-side, CLI, and CI usage:

import { createRenClient, pat } from "@renai-labs/sdk"
createRenClient({ baseUrl, auth: pat(process.env.REN_PAT_TOKEN!) })

Errors

Non-2xx responses don’t throw by default. Check error, or opt into throwing:

const { data, error } = await client.skill.get({ path: { id } })
if (error) {
// error is typed to the operation's error schema
}
const { data } = await client.skill.get({ path: { id }, throwOnError: true })

Configuration

createRenClient accepts any @hey-api/client-fetch Config option: baseUrl, headers, fetch, credentials, interceptors, etc.

createRenClient({
baseUrl: "https://api.renai.build",
auth: pat(token),
headers: { "X-Request-Id": crypto.randomUUID() },
fetch: customFetch,
})

Types only

For apps that only need the shapes (form validators, type exports), import from the /types subpath to avoid pulling in the client runtime:

import type { Skill, SkillCreateData } from "@renai-labs/sdk/types"