# LibreChat Setup: Custom ZRouter Endpoint

> Add ZRouter to LibreChat as a custom endpoint, let each user supply their own account key, list models, and understand which LibreChat features are supported.

## Before you connect

Use the custom Chat Completions endpoint for plain text chats. Account keys support client-executed function tools with text results. Image/audio inputs, hosted tools, Assistants, and stored response lifecycle operations remain unsupported. Each user needs a ZRouter account, credit or supported BYOK, and an account API key.

## Configure the custom endpoint

Merge this `endpoints` section into your existing `librechat.yaml`, retaining the configuration version required by your installed LibreChat release. Replace the URL and model ID:

```yaml
endpoints:
  custom:
    - name: "ZRouter"
      apiKey: "user_provided"
      baseURL: "https://zrouter.si/v1"
      models:
        default: ["PROVIDER_INSTANCE/MODEL_ID"]
        fetch: false
      titleConvo: false
      modelDisplayLabel: "ZRouter"
      addParams:
        max_tokens: 256
```

Restart LibreChat according to its deployment instructions. Select ZRouter, provide your own ZRouter account key when prompted, and start a text chat. `user_provided` lets each person supply a separate credential; static server credentials instead charge the one ZRouter account that owns the key. See [LibreChat's custom endpoint configuration](https://www.librechat.ai/docs/configuration/librechat_yaml/object_structure/custom_endpoint).

The example disables model fetching and automatic titles to keep the initial setup predictable. Copy an exact model ID from ZRouter. Increase `max_tokens` only within the selected model and workspace limits.

## Optional BYOK

After each user saves a provider key in their ZRouter dashboard, a BYOK-only custom endpoint can include:

```yaml
      headers:
        X-ZRouter-BYOK: "true"
```

Place `headers` alongside `baseURL`, not inside `models`. Each user must have a saved key for the selected provider instance. This header changes all requests through that endpoint to BYOK; create a separately named gateway-funded endpoint if both modes are needed. Provider charges are separate from ZRouter routing fees.

## Verify and troubleshoot

Send one short message and check the correct user's ZRouter usage and ledger. Do not use LibreChat display labels or forwarded user headers as evidence of billing isolation. The authenticated account key determines the billed account.

Enable only client-executed function tools with text results; keep media and provider-hosted tools off. Connection or parameter failures should be checked against [shared troubleshooting](/docs/integrations/troubleshooting) and the selected provider's capabilities.
