> ## 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.

# Environment variables

> Configure the SDK with backend environment variables.

## Required

Set this in the backend app that calls your model provider:

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

The API key authenticates events sent to Margovia. Keep it on the backend. Do not expose it in browser code.

If `MARGOVIA_API_KEY` is missing, the SDK skips Margovia tracking. Installing the SDK alone sends nothing.

When `MARGOVIA_API_KEY` is configured, the SDK sends events to Margovia Cloud at `https://api.margovia.com` unless `MARGOVIA_BASE_URL` overrides it.

## Optional

```env theme={null}
MARGOVIA_BASE_URL=https://your-api.example.com
```

Set `MARGOVIA_BASE_URL` only if you self-host Margovia, run a compatible receiver, or test against a local API:

```env theme={null}
MARGOVIA_BASE_URL=http://localhost:4010
```

```env theme={null}
MARGOVIA_DEBUG=1
```

Enables debug logging for skipped or failed tracking operations.

Use this when you are verifying an integration. Leave it off in normal production logs unless you are troubleshooting.

## Provider keys

Provider API keys are not used by Margovia directly. They are used by your app and provider SDKs:

```env theme={null}
OPENAI_API_KEY=sk_xxx
ANTHROPIC_API_KEY=sk-ant-xxx
```
