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

# Gateway

> One service for LLM and media providers: deterministic routing, pure quotes, and provider keys that never leave the server side.

The gateway (`@wzrdtech/zap-runtime/gateway`) is the runtime's single door to model providers. It wraps the 0.3.1 provider adapters and deterministic router rather than replacing them.

## Surface

```ts theme={null}
export interface GatewayService {
  llm(route: LlmRouteId, opts: {
    model: string;
    auth?: "byok" | "claude-code" | "codex" | "managed";
  }): LlmService;
  media(provider: MediaProviderId, opts: { model?: string }): MediaService;
  route(capability, hint?): { provider; model; usdEstimate };
  quote(plan): Promise<{ usd: number; lines: [...] }>;   // never calls a provider
}
```

## Providers

### LLM routes

<CardGroup cols={3}>
  <Card title="OpenRouter" horizontal>
    <img className="block dark:hidden" src="https://mintcdn.com/gratitude5dee-zap-56/Y4G9H4edehsua_Ul/images/logos/openrouter-light.svg?fit=max&auto=format&n=Y4G9H4edehsua_Ul&q=85&s=46e7bf71bde9ace661856a4bea2f9700" alt="OpenRouter" style={{ height: "24px", width: "auto" }} noZoom width="512" height="512" data-path="images/logos/openrouter-light.svg" />

    <img className="hidden dark:block" src="https://mintcdn.com/gratitude5dee-zap-56/Y4G9H4edehsua_Ul/images/logos/openrouter-dark.svg?fit=max&auto=format&n=Y4G9H4edehsua_Ul&q=85&s=e20289324c780e573d90c0b4892cde53" alt="OpenRouter" style={{ height: "24px", width: "auto" }} noZoom width="512" height="512" data-path="images/logos/openrouter-dark.svg" />

    Route: `openrouter` (default)
  </Card>

  <Card title="OpenAI" horizontal>
    <img className="block dark:hidden" src="https://mintcdn.com/gratitude5dee-zap-56/Y4G9H4edehsua_Ul/images/logos/openai-light.svg?fit=max&auto=format&n=Y4G9H4edehsua_Ul&q=85&s=4fcf9b3613c93cb1f52a9513f5d3d328" alt="OpenAI" style={{ height: "24px", width: "auto" }} noZoom width="256" height="260" data-path="images/logos/openai-light.svg" />

    <img className="hidden dark:block" src="https://mintcdn.com/gratitude5dee-zap-56/Y4G9H4edehsua_Ul/images/logos/openai-dark.svg?fit=max&auto=format&n=Y4G9H4edehsua_Ul&q=85&s=a320ba5523efa0748844b97285f978a2" alt="OpenAI" style={{ height: "24px", width: "auto" }} noZoom width="256" height="260" data-path="images/logos/openai-dark.svg" />

    Route: `openai`
  </Card>

  <Card title="Anthropic" horizontal>
    <img className="block dark:hidden" src="https://mintcdn.com/gratitude5dee-zap-56/Y4G9H4edehsua_Ul/images/logos/anthropic-light.svg?fit=max&auto=format&n=Y4G9H4edehsua_Ul&q=85&s=4cc3da679eafecba0fc0d08ff83bae09" alt="Anthropic" style={{ height: "24px", width: "auto" }} noZoom width="16" height="16" data-path="images/logos/anthropic-light.svg" />

    <img className="hidden dark:block" src="https://mintcdn.com/gratitude5dee-zap-56/Y4G9H4edehsua_Ul/images/logos/anthropic-dark.svg?fit=max&auto=format&n=Y4G9H4edehsua_Ul&q=85&s=5247908b194fc12081919cedb8e566e8" alt="Anthropic" style={{ height: "24px", width: "auto" }} noZoom width="16" height="16" data-path="images/logos/anthropic-dark.svg" />

    Route: `anthropic`
  </Card>

  <Card title="xAI" horizontal>
    <img className="block dark:hidden" src="https://mintcdn.com/gratitude5dee-zap-56/Y4G9H4edehsua_Ul/images/logos/xai-light.svg?fit=max&auto=format&n=Y4G9H4edehsua_Ul&q=85&s=57e98f35736ce7945cf7fd5c40d47708" alt="xAI" style={{ height: "24px", width: "auto" }} noZoom width="842" height="595" data-path="images/logos/xai-light.svg" />

    <img className="hidden dark:block" src="https://mintcdn.com/gratitude5dee-zap-56/Y4G9H4edehsua_Ul/images/logos/xai-dark.svg?fit=max&auto=format&n=Y4G9H4edehsua_Ul&q=85&s=122b2356e53fd5665d43c188c65881fc" alt="xAI" style={{ height: "24px", width: "auto" }} noZoom width="842" height="595" data-path="images/logos/xai-dark.svg" />

    Route: `xai`
  </Card>

  <Card title="Vercel AI Gateway" horizontal>
    <img className="block dark:hidden" src="https://mintcdn.com/gratitude5dee-zap-56/Y4G9H4edehsua_Ul/images/logos/vercel-light.svg?fit=max&auto=format&n=Y4G9H4edehsua_Ul&q=85&s=cf0d215409a364ee0740c3717e1ee4b1" alt="Vercel" style={{ height: "24px", width: "auto" }} noZoom width="256" height="222" data-path="images/logos/vercel-light.svg" />

    <img className="hidden dark:block" src="https://mintcdn.com/gratitude5dee-zap-56/Y4G9H4edehsua_Ul/images/logos/vercel-dark.svg?fit=max&auto=format&n=Y4G9H4edehsua_Ul&q=85&s=90849e6e5c0fff1ed7d6013fc8539123" alt="Vercel" style={{ height: "24px", width: "auto" }} noZoom width="256" height="222" data-path="images/logos/vercel-dark.svg" />

    Route: `gateway`
  </Card>

  <Card title="GMI Cloud" horizontal>
    <img src="https://mintcdn.com/gratitude5dee-zap-56/Y4G9H4edehsua_Ul/images/logos/gmi.png?fit=max&auto=format&n=Y4G9H4edehsua_Ul&q=85&s=49c73fb0130bf3c912f6dc433324b8a2" alt="GMI Cloud" style={{ height: "24px", width: "auto" }} noZoom width="420" height="420" data-path="images/logos/gmi.png" />

    Route: `gmi`
  </Card>
</CardGroup>

### Media providers

<CardGroup cols={3}>
  <Card title="AWS Bedrock" horizontal>
    <img className="block dark:hidden" src="https://mintcdn.com/gratitude5dee-zap-56/Y4G9H4edehsua_Ul/images/logos/bedrock-light.svg?fit=max&auto=format&n=Y4G9H4edehsua_Ul&q=85&s=ff03f647049a700c3ee901f28cb51a99" alt="AWS Bedrock" style={{ height: "24px", width: "auto" }} noZoom width="24" height="24" data-path="images/logos/bedrock-light.svg" />

    <img className="hidden dark:block" src="https://mintcdn.com/gratitude5dee-zap-56/Y4G9H4edehsua_Ul/images/logos/bedrock-dark.svg?fit=max&auto=format&n=Y4G9H4edehsua_Ul&q=85&s=9f48667b0cba92e1be0203b7a6d4a4c1" alt="AWS Bedrock" style={{ height: "24px", width: "auto" }} noZoom width="24" height="24" data-path="images/logos/bedrock-dark.svg" />

    Provider: `aws`
  </Card>

  <Card title="Vertex AI" horizontal>
    <img className="block dark:hidden" src="https://mintcdn.com/gratitude5dee-zap-56/Y4G9H4edehsua_Ul/images/logos/vertexai-light.svg?fit=max&auto=format&n=Y4G9H4edehsua_Ul&q=85&s=1a484198cfceee5df960be1977f742e3" alt="Vertex AI" style={{ height: "24px", width: "auto" }} noZoom width="24" height="24" data-path="images/logos/vertexai-light.svg" />

    <img className="hidden dark:block" src="https://mintcdn.com/gratitude5dee-zap-56/Y4G9H4edehsua_Ul/images/logos/vertexai-dark.svg?fit=max&auto=format&n=Y4G9H4edehsua_Ul&q=85&s=c3a5d60f7312dcc3dbdb672e27257d19" alt="Vertex AI" style={{ height: "24px", width: "auto" }} noZoom width="24" height="24" data-path="images/logos/vertexai-dark.svg" />

    Provider: `vertex`
  </Card>

  <Card title="fal" horizontal>
    <img className="block dark:hidden" src="https://mintcdn.com/gratitude5dee-zap-56/Y4G9H4edehsua_Ul/images/logos/fal-light.svg?fit=max&auto=format&n=Y4G9H4edehsua_Ul&q=85&s=ac789a9480441cdd06fe93fd8163dc45" alt="fal" style={{ height: "24px", width: "auto" }} noZoom width="24" height="24" data-path="images/logos/fal-light.svg" />

    <img className="hidden dark:block" src="https://mintcdn.com/gratitude5dee-zap-56/Y4G9H4edehsua_Ul/images/logos/fal-dark.svg?fit=max&auto=format&n=Y4G9H4edehsua_Ul&q=85&s=bb5812d1f987b0b4af8e03902c1d8711" alt="fal" style={{ height: "24px", width: "auto" }} noZoom width="24" height="24" data-path="images/logos/fal-dark.svg" />

    Provider: `fal`
  </Card>

  <Card title="Prodia" horizontal>
    <img src="https://mintcdn.com/gratitude5dee-zap-56/Y4G9H4edehsua_Ul/images/logos/prodia.png?fit=max&auto=format&n=Y4G9H4edehsua_Ul&q=85&s=00bfabeb0bbcaf37668664dc45f6c78b" alt="Prodia" style={{ height: "24px", width: "auto" }} noZoom width="420" height="420" data-path="images/logos/prodia.png" />

    Provider: `prodia`
  </Card>

  <Card title="Runware" horizontal>
    <img src="https://mintcdn.com/gratitude5dee-zap-56/Y4G9H4edehsua_Ul/images/logos/runware.svg?fit=max&auto=format&n=Y4G9H4edehsua_Ul&q=85&s=92664e5af7ae89761d6649e90f034efe" alt="Runware" style={{ height: "24px", width: "auto" }} noZoom width="512" height="512" data-path="images/logos/runware.svg" />

    Provider: `runware`
  </Card>

  <Card title="Replicate" horizontal>
    <img className="block dark:hidden" src="https://mintcdn.com/gratitude5dee-zap-56/Y4G9H4edehsua_Ul/images/logos/replicate-light.svg?fit=max&auto=format&n=Y4G9H4edehsua_Ul&q=85&s=18c4b6d24ca6f03d5b93e1f1b9273570" alt="Replicate" style={{ height: "24px", width: "auto" }} noZoom width="726" height="726" data-path="images/logos/replicate-light.svg" />

    <img className="hidden dark:block" src="https://mintcdn.com/gratitude5dee-zap-56/Y4G9H4edehsua_Ul/images/logos/replicate-dark.svg?fit=max&auto=format&n=Y4G9H4edehsua_Ul&q=85&s=3fc09aa07c0f0e9ee4fb2eb0588cd2f9" alt="Replicate" style={{ height: "24px", width: "auto" }} noZoom width="726" height="726" data-path="images/logos/replicate-dark.svg" />

    Provider: `replicate`
  </Card>

  <Card title="GMI Cloud" horizontal>
    <img src="https://mintcdn.com/gratitude5dee-zap-56/Y4G9H4edehsua_Ul/images/logos/gmi.png?fit=max&auto=format&n=Y4G9H4edehsua_Ul&q=85&s=49c73fb0130bf3c912f6dc433324b8a2" alt="GMI Cloud" style={{ height: "24px", width: "auto" }} noZoom width="420" height="420" data-path="images/logos/gmi.png" />

    Provider: `gmi`
  </Card>
</CardGroup>

## Plan-only is structural

`quote()` and `route()` are pure over the model rate tables — plan-only runs never contact a provider. `MediaService.submit` throws `LIVE_REQUIRED` unless the session carries `live: true` and a payer is configured. A missing BYOK key fails closed with `KEY_MISSING` before any request.

## The gateway owns provider keys

Provider keys stay server-side. Managed VMs never receive keys — a harness in managed mode gets only an OpenAI-flavor proxy URL (`ZAP_API_URL/v1/runtimes/{id}/gateway`) wired into its config; the gateway resolves the real key per request and settles usage against the meter. BYOK env is injected per box at create time and registered with the redaction layer.

## FFmpeg presets

Presets are data — `{ id, argv(inputs, params), estimateCpuSeconds(probe), outputs }`. `zap ffmpeg <preset> <input> <output>` prints the argv and estimate by default; `--live` executes through the `ffmpeg` lane and records the output in the [media filesystem](/services/mediafs) with `ffmpegPreset` set.
