Skip to main content

Quick Start

Get up and running with the Mentiora SDK in just a few steps.

Prerequisites

You need a Mentiora account and an API key — see Authentication for how to create one.

  • Node.js >= 20.0.0
  • TypeScript >= 5.0 (optional, for TypeScript projects)

Installation

Install the SDK using pnpm:

pnpm add @mentiora.ai/sdk

Or with npm:

npm install @mentiora.ai/sdk

Or with yarn:

yarn add @mentiora.ai/sdk

Authentication Setup

Every request requires an API key. Pass it via the apiKey / api_key config option, or set the MENTIORA_API_KEY environment variable. See the Authentication page for detailed instructions on creating and managing API keys.

Configuration Options

OptionTypeRequiredDescription
apiKeystringYesProject API key — see Authentication
baseUrlstringNoBase URL (defaults to https://platform.mentiora.ai)
timeoutnumberNoRequest timeout in ms (default: 30000)
retriesnumberNoMax retry attempts (default: 3)
debugbooleanNoEnable verbose SDK logging (default: false)

Import

ES Modules

import { MentioraClient } from '@mentiora.ai/sdk';

CommonJS

const { MentioraClient } = require('@mentiora.ai/sdk');

Your First Trace

Create a client and send your first trace to the Mentiora platform. Use UUID v7 for traceId/trace_id and spanId/span_id (see Usage - Tracing for details).

import { MentioraClient } from '@mentiora.ai/sdk';

const client = new MentioraClient({
apiKey: process.env.MENTIORA_API_KEY,
});

const result = await client.tracing.sendTrace({
traceId: '019505a0-b7c2-7000-8000-000000000001', // UUID v7
spanId: '019505a0-b7c2-7000-8000-000000000002', // UUID v7
name: 'llm.call',
type: 'llm',
input: { messages: [{ role: 'user', content: 'Hello' }] },
output: { response: 'Hello from Mentiora' },
startTime: new Date(),
endTime: new Date(),
durationMs: 1000,
});

if (result.success) {
console.log(`Trace sent: ${result.traceId}`);
} else {
console.error(`Failed: ${result.error}`);
}
info

For complete, runnable examples see the Examples page.

Next Steps