# Policy Before Generation: Notes on the Enterprise Gateway Request Path

Most gateway write-ups start at routing and stop at failover. The request path on nRouter's Enterprise LLM Gateway page is worth reading in the other direction: what happens *before* the provider call is where the governance lives.

## The sequence

An app points its OpenAI or Anthropic SDK at one endpoint with a virtual key scoped by org, team and key permissions. Each request then passes:

1. **Access** — key permissions and model access rules. Refusals return 401/403 before any model call runs.
2. **Rate limits** — key and org limits enforced before credits are reserved.
3. **Input guardrails** — configured policies evaluated on the request. A block returns HTTP 400 with $0 held and $0 spent; `x-nr-guardrails` reports pass / redacted / blocked / monitor / partial / none / unavailable.

## Settlement

One credit reservation covers the request and its configured fallbacks. Upstream 429/503/529, connection fault or first-byte timeout advances to the next fallback under the same reservation. Settlement happens once, at the served model's list price, unused hold released. Buffered calls return `x-nr-request-cost` with `x-nr-cost-status: exact`; streamed calls show Pending in the dashboard and settle from the request log; unpriced calls stay unpriced instead of reporting a false zero.

## The log is metadata

Request logs store ID, timestamps, served model, token counts, settled charge, latency, routing outcome and guardrail status. Prompt and completion text are not written to them — the prompt goes to the selected provider (after configured redaction) under that provider's terms.

The honest edge: an output guardrail block after generation still settles for generated tokens. Pre-call blocks are the free ones.

Full spec: https://nrouter.ai/product/enterprise-llm-gateway
