ClearRun SDK help

Use @clearrun/sdk 1.2.0 in Node.js: clients, mock mode, errors and receipts.

Last updated

Start here

  1. How to install the ClearRun SDK

    Run npm install @clearrun/sdk. It works in Node.js 18 or newer. You can start in mock mode with no key, then add a key for real scores. ClearRun help center.

  2. How to create a ClearRun client (createKernelClient)

    Call createKernelClient(). It finds your key in hosted.apiKey, then CLEARRUN_API_KEY, then the file saved by clearrun login. From the ClearRun help center.

  3. How to score text with the ClearRun SDK (client.score)

    Call client.score({ responseText }). It sends the text to POST /api/score and returns { verdict, receipt }. Use it when you have an answer but not the prompt.

  4. How to use ClearRun mock mode for local development (forceMock)

    Create the client with createKernelClient({ forceMock: true }). It returns local test verdicts on your computer with no key and no network. Steps inside.

All SDK articles

Other topics