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

# Connect Masker to Vapi as a Custom LLM Firewall

> Route every Vapi conversation through Masker so PHI is tokenized before it reaches your LLM and rehydrated before it reaches the caller.

Masker integrates with Vapi by acting as a drop-in Custom LLM. Vapi sends each conversation turn to Masker's OpenAI-compatible proxy endpoint; Masker redacts PHI, forwards the masked prompt to your upstream model, then rehydrates tokens in the response before returning it to Vapi. The caller hears a natural reply. Your LLM provider only ever sees tokens.

<Note>
  You need a Masker agent already created in the portal. If you haven't done that yet, follow the [Quickstart](/quickstart) first — the portal creates the Vapi assistant for you automatically when you paste your Vapi API key.
</Note>

## Automatic setup (recommended)

The Masker portal configures Vapi on your behalf. When you create a new agent and paste your Vapi API key, Masker calls the Vapi API to create an assistant pre-wired with the correct Custom LLM URL and webhook URL. No manual steps are needed.

After the wizard completes, skip to [Verify the assistant settings](#verify-the-assistant-settings) to confirm everything looks correct.

## Manual setup

If you want to connect Masker to an existing Vapi assistant — or if you prefer to configure Vapi yourself — follow these steps.

<Steps>
  <Step title="Sign in to the Masker portal and locate your agent">
    Open [masker-voice.fly.dev/portal](https://masker-voice.fly.dev/portal) and find the agent you want to connect. Each agent has its own proxy URL and webhook URL shown on the agent detail page.
  </Step>

  <Step title="Copy the proxy URL">
    The proxy URL follows this format:

    ```text theme={null}
    https://masker-voice.fly.dev/proxy/{agent_id}/v1/chat/completions
    ```

    Copy the full URL from the portal — the `{agent_id}` segment is unique to your agent.

    <Note>
      The `{agent_id}` path segment acts as a session-scoping token. Every request that hits this URL is attributed to this agent in your Masker dashboard.
    </Note>
  </Step>

  <Step title="Open your assistant in the Vapi dashboard">
    Go to [dashboard.vapi.ai](https://dashboard.vapi.ai), open **Assistants**, and click the assistant you want to route through Masker.
  </Step>

  <Step title="Switch the model provider to Custom LLM">
    In the assistant settings, find the **Model** section. Change **Provider** from its current value to **Custom LLM**. A **Custom LLM URL** field appears below.
  </Step>

  <Step title="Paste the proxy URL">
    Paste the proxy URL you copied from the Masker portal into the **Custom LLM URL** field. Leave the model field as-is — Masker forwards the model name you set here to your upstream provider.

    ```text theme={null}
    https://masker-voice.fly.dev/proxy/{agent_id}/v1/chat/completions
    ```

    <Warning>
      Do not add extra headers or an API key to the Vapi Custom LLM configuration. Masker authenticates via the agent ID in the URL path, not via headers.
    </Warning>
  </Step>

  <Step title="Add the webhook URL">
    Copy the webhook URL for your agent from the Masker portal:

    ```text theme={null}
    https://masker-voice.fly.dev/vapi/webhook/{agent_id}
    ```

    In the Vapi assistant settings, open **Advanced** and paste this URL into the **Server URL** (webhook) field. Masker uses this to receive `assistant-request` events and associate them with the correct session.
  </Step>

  <Step title="Save the assistant">
    Click **Save** in the Vapi dashboard. Your assistant now routes through Masker.
  </Step>
</Steps>

## Verify the assistant settings

After setup — whether automatic or manual — open the assistant in the Vapi dashboard and confirm:

| Setting                  | Expected value                                                      |
| ------------------------ | ------------------------------------------------------------------- |
| **Model → Provider**     | Custom LLM                                                          |
| **Custom LLM URL**       | `https://masker-voice.fly.dev/proxy/{agent_id}/v1/chat/completions` |
| **Server URL (webhook)** | `https://masker-voice.fly.dev/vapi/webhook/{agent_id}`              |

If the Custom LLM URL shows a different domain or is missing the `/proxy/` prefix, the traffic is not passing through Masker.

## Place a test call

Use Vapi's **Talk to Assistant** button on the assistant detail page, or dial the phone number attached to the assistant. Say something that includes PHI — for example:

> "Hi, my name is Sarah Johnson. My date of birth is March 14, 1982, and my member ID is BCBS-447299."

The assistant should respond naturally. To verify redaction, open [platform.openai.com/logs](https://platform.openai.com/logs) and inspect the most recent chat completion. The input should contain tokens like `MSKV1.person_name.K_HEALTHCARE.a3f9...` rather than the caller's real name or date of birth.

Back in the Masker portal, open **Sessions** to see the live transcript split into regulated (left) and public (right) sides of the firewall.

<Tip>
  After the call, click **Download report** in the session view to get an Ed25519-signed HIPAA Safe Harbor compliance report as JSON and PDF. See [Audit Reports](/compliance/audit-reports) for how to verify the signature offline.
</Tip>
