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

# Secondary Model Routing for Continuity and Data Security

> Automatically fail over to a secondary model when the primary is unavailable, and route requests containing PII/PHI to a local model so sensitive data never leaves your organization.

**Secondary Model Routing** adds a secondary model that comes into play when the primary can't respond. Built on the [Model Library](/platform/model-library), it serves two purposes at once: **business continuity** and **data security**. The routing decision happens automatically and transparently, based on the primary–secondary mapping defined in the Model Library — no extra configuration or code changes on your side.

## Failover on error

When an error condition is detected on the primary model call — a **timeout, service outage, provider-side error (5xx), or rate limit** — the system automatically routes the request to the predefined secondary model. A temporary or permanent outage at a single model provider no longer stops the end-to-end service.

## Local routing on sensitive-data detection

The same mechanism protects sensitive data. When **PII or PHI is detected** in a request or an output, the system can automatically route the request to a **secondary local model** instead of the external/cloud primary:

* Sensitive data is processed by a model hosted **within your organization's boundaries**, never transmitted to a third-party provider.
* This prevents data-leakage risk and adds an assurance layer for compliance with **KVKK / GDPR** and similar regulations.

<Info>
  One feature, two benefits: uninterrupted service during a model's outage, and in-house processing of sensitive data when PII/PHI is detected — addressing continuity and compliance at the same time.
</Info>

## Related

<CardGroup cols={2}>
  <Card title="Model Library" icon="boxes-stacked" href="/platform/model-library">
    Define the primary–secondary model mapping.
  </Card>

  <Card title="Data Protection" icon="user-shield" href="/platform/data-protection">
    The PII/PHI detection that triggers local routing.
  </Card>

  <Card title="High Availability" icon="shield-halved" href="/deployment/high-availability">
    Infrastructure-level resilience.
  </Card>

  <Card title="Compliance" icon="scale-balanced" href="/guides/compliance">
    Data-residency and regulatory alignment.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.