> ## Documentation Index
> Fetch the complete documentation index at: https://docs.margovia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> Install Margovia in Node.js and backend JavaScript runtimes.

## Package

```bash theme={null}
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:

```bash theme={null}
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:

```env theme={null}
MARGOVIA_API_KEY=mg_live_xxx
```

Then create the client:

```ts theme={null}
import { Margovia } from "@margovia/sdk";

const margovia = new Margovia({
  apiKey: process.env.MARGOVIA_API_KEY
});
```

You can also rely on environment variables:

```ts theme={null}
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.
