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.
- TypeScript
- Python
- Node.js >= 20.0.0
- TypeScript >= 5.0 (optional, for TypeScript projects)
- Python >= 3.11
- httpx >= 0.28.1
- pydantic >= 2.12.5
Installation
- TypeScript
- Python
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
Install the SDK using pip:
pip install "git+https://github.com/mentiora-ai/mentiora-sdk.git#subdirectory=python"
Or with uv:
uv pip install "git+https://github.com/mentiora-ai/mentiora-sdk.git#subdirectory=python"
For optional plugin support:
# With OpenAI plugin support
pip install "mentiora-ai-sdk[openai] @ git+https://github.com/mentiora-ai/mentiora-sdk.git#subdirectory=python"
# With LangChain plugin support
pip install "mentiora-ai-sdk[langchain] @ git+https://github.com/mentiora-ai/mentiora-sdk.git#subdirectory=python"
# With both
pip install "mentiora-ai-sdk[openai,langchain] @ git+https://github.com/mentiora-ai/mentiora-sdk.git#subdirectory=python"
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
- TypeScript
- Python
| Option | Type | Required | Description |
|---|---|---|---|
apiKey | string | Yes | Project API key — see Authentication |
baseUrl | string | No | Base URL (defaults to https://platform.mentiora.ai) |
timeout | number | No | Request timeout in ms (default: 30000) |
retries | number | No | Max retry attempts (default: 3) |
debug | boolean | No | Enable verbose SDK logging (default: false) |
| Option | Type | Required | Description |
|---|---|---|---|
api_key | str | Yes | Project API key — see Authentication |
base_url | str | No | Base URL (defaults to https://platform.mentiora.ai) |
timeout | int | No | Request timeout in ms (default: 30000) |
retries | int | No | Max retry attempts (default: 3) |
debug | bool | No | Enable verbose SDK logging (default: False) |
Import
- TypeScript
- Python
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).
- TypeScript
- Python
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}`);
}
import os
from datetime import datetime, timezone
from mentiora import MentioraClient, MentioraConfig, TraceEvent
config = MentioraConfig(
api_key=os.getenv('MENTIORA_API_KEY'),
)
client = MentioraClient(config)
result = client.tracing.send_trace(TraceEvent(
trace_id='019505a0-b7c2-7000-8000-000000000001', # UUID v7
span_id='019505a0-b7c2-7000-8000-000000000002', # UUID v7
name='llm.call',
type='llm',
input={'messages': [{'role': 'user', 'content': 'Hello'}]},
output={'response': 'Hello from Mentiora'},
start_time=datetime.now(timezone.utc),
end_time=datetime.now(timezone.utc),
duration_ms=1000,
))
if result.success:
print(f'Trace sent: {result.trace_id}')
else:
print(f'Failed: {result.error}')
info
For complete, runnable examples see the Examples page.
Next Steps
- Browse the example applications for complete, runnable code
- Explore the Usage guide for tracing, agents, streaming, and plugins
- Check out the API reference for detailed method documentation