ramen ai | Documentation

The @ramen-ai/node-core SDK

The official Node.js client for policy evaluation, governed generation, and local Ed25519 receipt verification.

Requirements and installation

The SDK requires Node.js 24 or newer and has no runtime dependencies.

npm install @ramen-ai/node-core

Initialize the client

Pass a scoped ramen ai API key. Starter and Professional accounts can also provide their own model-provider key when using governed generation.

import { RamenClient } from '@ramen-ai/node-core';

const ramen = new RamenClient({
  apiKey: process.env.RAMEN_API_KEY!,
  providerKey: process.env.OPENAI_API_KEY,
  providerName: 'openai',
});

Passive policy evaluation

Use evaluateCompliance when your application already owns model generation. Submit the candidate output before releasing it or executing the proposed tool call.

const verdict = await ramen.evaluateCompliance(candidateOutput, {
  bundleIds: ['ramen__shield_core_it'],
  context: { workflow: 'agent-tool-call' },
});

if (!verdict.allowed || !verdict.receiptVerified) {
  throw new Error(
    verdict.steering ?? verdict.receiptReason ?? 'Policy evaluation failed'
  );
}

Governed generation

Use generateGoverned when ramen ai should orchestrate generation, semantic evaluation, and at most one bounded healing retry.

const result = await ramen.generateGoverned(
  'Draft a compliant customer response.',
  {
    bundleIds: ['ramen__eu_ai_act_baseline'],
    maxRetries: 1,
  },
);

if (!result.evaluation.allowed) {
  throw new Error('No candidate passed governance');
}

console.log(result.content);

Verify a receipt independently

The standalone verifier checks both the Ed25519 signature and the SHA-256 binding between the signed receipt and the original input.

import { verifyReceipt } from '@ramen-ai/node-core';

const verification = await verifyReceipt(receipt, originalInput);
if (!verification.valid) {
  throw new Error(verification.reason);
}

Next steps