---
title: "Edge network"
description: "A pirouter request is authenticated, routed and metered at the edge node nearest to you and goes straight to the provider, with no detour through a central region; failed deployments are replaced automatically, and some providers in mainland China are reached through a dedicated relay in Japan East."
canonical: "https://pirouter.ai/docs/guides/edge-network"
last-updated: "2026-10-17"
lang: "en"
source: "content/docs/en/guides/edge-network.mdx"
---

# Edge network

A pirouter request is authenticated, routed and metered at the edge node nearest to you and goes straight to the provider, with no detour through a central region; failed deployments are replaced automatically, and some providers in mainland China are reached through a dedicated relay in Japan East.

Your request enters at the edge node nearest to you, where authentication, routing and metering run, and goes straight to the provider from there. It takes no detour through a central region, so the gateway adds no cross-region round trip of its own.

![Requests enter at the edge node nearest to them, where TLS, authentication, routing and metering run, and go straight to the provider with no detour through a central region](https://pirouter.ai/docs/diagrams/edge-network.en.svg)

## At the edge

TLS terminates at the nearest edge node. Authentication, rate limits and routing run right there, so the decision about which provider serves your request is made close to you.

- **Authenticate**: Your API key is checked at the edge node.
- **Route**: A provider is chosen for the model and your routing settings.
- **Meter**: Tokens and cost are measured as the response streams back.

## Straight to the provider, with automatic failover

From the edge node the request goes directly to the chosen provider. Each model is served by more than one deployment where possible. When the chosen deployment fails before the first byte of the response, the gateway moves to the next deployment of the same model, then to the next model in the request's `models`.

A failure moves on when the provider returns `429`, `500`, `502` or `503`, when the connection fails, and when the provider refuses pirouter's own credentials (`401`, `403`). A `504` or any other `4xx` does not. The full rules are in [Provider routing](https://pirouter.ai/docs/guides/routing.md#failover).

A request is tried at most 5 times, counted across all models.

You pay only for the attempt that returned the response; a failed attempt that the next one replaced is not billed. See [Requests that fail](https://pirouter.ai/docs/guides/billing.md#requests-that-fail).

## Providers in mainland China

Some providers in mainland China are reached through a dedicated relay in Japan East. The relay forwards the encrypted traffic by the host name in the TLS handshake and never decrypts it.

Median time to first byte for large-context requests (about 80,000 input tokens, cache hit, streaming):

| Time window (UTC+8) | Via the relay | Direct |
| ------------------- | ------------- | ------ |
| Night, off-peak     | **2.68 s**    | 3.76 s |
| Evening             | **3.20 s**    | 5.25 s |
| Evening peak        | **3.26 s**    | 5.69 s |

Small requests (80 input tokens, at night): **1.25 s** via the relay, 1.43 s direct.

Measured on 2026-10-10 and 10-11 against the one provider that goes through the relay. The figures cover the outbound leg from the gateway to the provider, not the full round trip from your client.

## No content on disk

Prompts and completions pass through the pirouter gateway in memory only. The gateway never writes them to disk. For the metadata pirouter does record, see [Data policy & ZDR](https://pirouter.ai/docs/guides/data-policy.md).

## Next steps

- [Data policy & ZDR](https://pirouter.ai/docs/guides/data-policy.md): What pirouter stores, each provider's data policy, and what you control.
- [Provider routing](https://pirouter.ai/docs/guides/routing.md): Control which providers serve your requests.
- [Model fallbacks](https://pirouter.ai/docs/guides/fallbacks.md): Switch to another model automatically when the one you asked for is unavailable.
