Documentation

JavaScript / Node.js SDK

Official Node.js and browser client for the RAIL Score API

Coming Soon: The JavaScript SDK is currently in development. In the meantime, you can use the REST API directly — see the API Reference and the Quick Start guide for Node.js examples.

Installation

npm install @responsible-ai-labs/rail-score

Planned Features

TypeScript Support

Full type definitions for all API responses and parameters

Browser & Node.js

Isomorphic client that works in both environments

Promise-based API

Modern async/await interface with full error handling

Tree-shakeable

Import only what you need for minimal bundle size

Using the REST API Directly

Until the SDK is available, you can call the RAIL API using fetch:

const response = await fetch(
  "https://api.responsibleailabs.ai/railscore/v1/eval",
  {
    method: "POST",
    headers: {
      "Authorization": "Bearer YOUR_API_KEY",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      content: "Your text to evaluate...",
      mode: "basic"
    })
  }
);

const data = await response.json();
console.log("RAIL Score:", data.result.rail_score.score);