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

# BYOK & self-host

> Bring-your-own-key is a self-host / Community-edition capability — not a hosted billing feature.

<Warning>
  **The hosted product does not offer customer-facing BYOK.** In hosted mode, ECN
  uses managed provider keys and meters usage to your credit wallet. BYOK is a
  property of the **self-host / Community edition**, gated by `ECN_DEPLOYMENT_MODE`.
</Warning>

## Why

The hosted product's value is convenience and a trustworthy, audited
[cost-plus credit](/guides/metering-credits) system. Letting customers inject their
own keys into the managed environment would undercut that model and complicate
metering. So:

* **Hosted** → managed credits only.
* **Self-host (Community edition)** → you own the keys, you pay providers directly,
  **\$0 to ECN** for AI usage.

## Self-hosting with your own keys

When you run ECN yourself, configure providers via environment variables — the same
ones the managed product uses internally:

```bash theme={null}
ECN_DEPLOYMENT_MODE=self_host
OPENROUTER_API_KEY=sk-or-...
APIFY_API_TOKEN=apify_api_...
DATABASE_URL=postgres://.../ecn   # with pgvector
```

Usage still flows through the [AI Gateway](/get-started/architecture#the-ai-gateway-is-sacred)
and is recorded as `UsageEvent`s for your own observability — you just aren't billed
by ECN.

<Note>
  Roadmap: BYOK ships with the v3 Community/self-host edition (Linear `TER-156`,
  label `byok-v3`). Historical PRDs that describe BYOK as a hosted v2 feature are
  superseded by this direction.
</Note>
