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

# Overview

> Route your LLM traffic through one endpoint to get spend controls, key management, guardrails, and observability, without changing your app code

The **Openlayer Gateway** is a single endpoint that sits between your apps and your LLM providers
and **enforces your rules on every request, in real time**. It blocks calls that go over budget,
stops prompt injection, and redacts PII before a request reaches a provider or a response reaches a
user.

Every request that flows through the gateway is also [traced to your Openlayer project](/gateway/observability), so
the monitoring you already rely on keeps working.

## How it works

<Steps>
  <Step title="Point your app at the gateway">
    Keep your existing OpenAI- or Anthropic-compatible client. Point its base URL at the gateway
    and swap in a gateway key.

    For example:

    ```python theme={null}
    from openai import OpenAI

    client = OpenAI(
        base_url="https://your-gateway.example.com/v1",  # the gateway, not api.openai.com
        api_key="sk-olga-...", # a gateway key, not your provider key
    )

    response = client.responses.create(model="gpt-4o-mini", input="Hello!")
    ```
  </Step>

  <Step title="Enforce your rules">
    The gateway verifies the key, runs your [content guardrails](/gateway/guardrails), and checks the request against
    your [usage limits](/gateway/usage-and-cost). Anything that trips a guardrail or exceeds a limit is blocked here, before it
    reaches a provider.
  </Step>

  <Step title="Route to a provider">
    It forwards the request to the provider you configured, and can override the model or
    **translate between formats**, so an OpenAI-style request runs against an Anthropic model, and
    vice versa.
  </Step>

  <Step title="Return and record">
    [Output guardrails](/gateway/guardrails) run on the way back, then the response streams to your app. Every request
    is also published as a [trace](/gateway/observability) in your Openlayer project, fire-and-forget, so tracing never
    slows or breaks a response.

    <img width="700" style={{ borderRadius: "0.5rem" }} src="https://mintcdn.com/openlayer-docs/0DNdDuuycN4Yl8SH/images/gateway/gateway_trace.png?fit=max&auto=format&n=0DNdDuuycN4Yl8SH&q=85&s=d25a940e0fabec1eeb235ebfb1dea5be" alt="Every gateway request becomes a trace in Openlayer" data-path="images/gateway/gateway_trace.png" />
  </Step>
</Steps>

## What you get

Everything is configured once, in the gateway's admin portal. There are no redeploys and no code
changes in the apps sending traffic.

<img width="700" style={{ borderRadius: "0.5rem" }} src="https://mintcdn.com/openlayer-docs/0DNdDuuycN4Yl8SH/images/gateway/api_keys.png?fit=max&auto=format&n=0DNdDuuycN4Yl8SH&q=85&s=9262ab69964bc5cbe7b2b9fb4c110ff8" alt="The Openlayer Gateway admin portal" data-path="images/gateway/api_keys.png" />

<Columns cols={2}>
  <Card title="Access & keys" icon="key-round" href="/gateway/api-keys">
    Issue and revoke keys for each app or teammate, group them into teams, and
    hand out self-serve invite links.
  </Card>

  <Card title="Budgets & usage" icon="wallet" href="/gateway/budgets-and-limits">
    Cap spend, requests, or tokens per key or team, and see exactly what's being
    consumed and what it costs.
  </Card>

  <Card title="Guardrails" icon="shield-alert" href="/gateway/guardrails">
    Block or redact PII and stop prompt-injection attempts on inputs and
    outputs, before they reach a provider or a user.
  </Card>

  <Card title="Providers & models" icon="waypoints" href="/gateway/connect-providers">
    Connect OpenAI, Anthropic, and Azure upstreams, route traffic between them,
    and call any model from any SDK.
  </Card>
</Columns>

## FAQ

<AccordionGroup>
  <Accordion title="Do I have to change my application code?">
    Almost nothing. You point your client at the gateway's base URL and use a gateway key instead of
    a provider key. That's it. Any client that speaks the **OpenAI Responses API** or the
    **Anthropic Messages API** works unchanged, including streaming.
  </Accordion>

  <Accordion title="How is this different from instrumenting my code with the Openlayer SDK?">
    They serve different jobs and you can use either or both.

    The **gateway** exists to enforce your rules on every request, in real time. Tracing comes as a
    byproduct: because traffic flows through the gateway, every request is also
    [published to your Openlayer project](/gateway/observability) without any SDK in your apps. That
    makes it the right path when you want governance plus baseline observability across many apps or
    languages at one chokepoint.

    The **[Openlayer SDK](/monitoring/instrument)** runs inside your code. It doesn't enforce anything
    at the request boundary, but it captures detail the gateway can't see from outside: nested spans
    for retrieval, tools, and sub-calls in a multi-step pipeline, plus any custom metadata. Reach for
    it when you need fine-grained traces of how a feature actually runs.

    A common setup is the gateway for governance and baseline traces, plus the SDK in the places that
    need the deeper view.
  </Accordion>

  <Accordion title="Is my prompt and response data stored in the gateway?">
    The gateway forwards traffic. It doesn't keep your prompts and responses. It stores hashed API
    keys, per-day usage tallies, and guardrail event metadata (which guardrail triggered and what
    kind of entity, not the underlying text).

    The full request and response content is sent to **your Openlayer project** as a trace, where
    your data-retention and access controls apply. Openlayer can run on-premises or as
    SOC 2 Type II compliant SaaS.
  </Accordion>

  <Accordion title="Can I use OpenAI models from the Anthropic SDK, or vice versa?">
    Yes. When you route a request to a provider whose format differs from your client's, the gateway
    translates the request, response, and stream between the OpenAI Responses API and the Anthropic
    Messages API. See [Use any model from any SDK](/gateway/use-any-model).
  </Accordion>

  <Accordion title="Which providers are supported?">
    OpenAI, Anthropic, and Azure OpenAI / Foundry today. Any provider that exposes an
    OpenAI- or Anthropic-compatible API can be connected. See
    [Connect providers](/gateway/connect-providers).
  </Accordion>
</AccordionGroup>
