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

# Relay best practices

> Introduce model routing gradually, measure it on real traffic, and preserve reliable fallbacks.

## Begin with measurement

Use Observe mode or a low-volume gateway project to establish request volume,
model mix, cost, latency, errors, and workload patterns before changing
production routing.

## Keep environments separate

Use separate projects and Relay keys for development, staging, and production
when they need independent credentials, limits, traffic, or reports. Store each
key once and rotate it through the application's secret-management process.

## Change one routing boundary at a time

<Steps>
  <Step title="Define candidates">
    Include only callable, routable models that meet the workload's capability
    and policy requirements.
  </Step>

  <Step title="Set a fallback">
    Choose a model that can complete the request when automatic routing cannot.
  </Step>

  <Step title="Replay decisions">
    Estimate distribution and cost on historical traffic.
  </Step>

  <Step title="Evaluate quality">
    Use shadow comparison or a quality evaluation on representative traffic.
  </Step>

  <Step title="Increase traffic gradually">
    Start with a bounded project or key and monitor routing reasons, errors,
    cost, quality, and latency.
  </Step>
</Steps>

## Preserve one execution authority

When Relay is the gateway, Relay executes the provider call. In route-only or
existing-gateway mode, your infrastructure owns provider credentials, retries,
timeouts, streaming, and final fallback. Avoid splitting those responsibilities
ambiguously across two systems.

## Budget evaluation work

Shadow calls, quality evaluations, and custom-router training can create
additional provider spend. Set their budgets independently of live request
limits.

<Card title="Choose an integration mode" icon="git-branch" href="/docs/relay/integration-modes">
  Decide how much of the request path Relay should own.
</Card>
