Skip to main content

Package

pnpm add @margovia/sdk
The package is published as ESM and supports Node.js 20.11.0 or newer.

Peer dependencies

Provider SDKs are optional peer dependencies. Install the ones your app uses:
pnpm add openai
pnpm add @anthropic-ai/sdk

Runtime setup

Set your Margovia API key in the backend app that calls OpenAI, Anthropic, or another provider:
MARGOVIA_API_KEY=mg_live_xxx
Then create the client:
import { Margovia } from "@margovia/sdk";

const margovia = new Margovia({
  apiKey: process.env.MARGOVIA_API_KEY
});
You can also rely on environment variables:
const margovia = new Margovia();
For Margovia Cloud, you do not need to set MARGOVIA_BASE_URL. Set it only for local development, self-hosting, or a compatible receiver.

Server-only

The SDK reads backend secrets and uses Node APIs. Do not bundle it into browser code.