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

# AI Gateway Overview

> A security-hardened, provider-neutral proxy for your AI traffic: phantom-token auth, true mid-stream PII redaction, prompt firewall, budgets, and unified cost attribution — with a one-line base-URL swap.

# AI Gateway Overview

The **AI Gateway** is KnoxCall's AI-native egress proxy. It sits between your applications (or agents) and upstream AI providers, and enforces governance and safety on every call — without your code ever holding a raw provider key.

You adopt it with a **one-line base-URL swap**: point your existing Anthropic or OpenAI SDK at your agent's gateway URL and use a short-lived KnoxCall **phantom token** as the API key. Everything else — budgets, PII redaction, the prompt firewall, cost attribution, audit — happens transparently on the wire.

```text theme={"dark"}
Your app / agent ──▶ AI Gateway ──▶ Anthropic / OpenAI
                        │
                        ├─ phantom-token auth (no raw provider key in your app)
                        ├─ prompt firewall (injection heuristics + canary)
                        ├─ streaming PII redaction (reversible tokenization)
                        ├─ budget enforcement (USD caps, per agent)
                        └─ usage + cost attribution (per user / team / model)
```

## Why it exists

Handing a raw provider key to an application — or worse, to an autonomous agent — means an unscoped, long-lived, un-revocable credential with no per-call governance. The AI Gateway replaces that with a credential and a control plane designed for AI traffic:

* **Your app never holds a provider key.** It holds a short-lived, scoped, revocable [phantom token](/ai-gateway/tokens-and-dpop). The real provider key lives in a KnoxCall-managed secret, injected by the route at egress.
* **Guardrails run mid-stream, not after the fact.** KnoxCall's [PII redaction](/ai-gateway/pii-redaction) rewrites sensitive data inside the SSE stream as it flows — before it reaches the client — and can restore it on the response. Most gateways can only log or buffer.
* **Cost is attributable and enforceable.** Every call is priced and recorded against a user, team, model, and agent, and [budgets](/ai-gateway/budgets-finops) can warn or hard-block before overspend.

## What you get

| Capability                  | What it does                                                                                                                                                  |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Phantom tokens**          | Short-lived capability tokens, optionally [DPoP](/ai-gateway/tokens-and-dpop)-bound (sender-constrained). Your app never holds the provider key.              |
| **Streaming PII redaction** | Detector stack (Aho-Corasick + regex/checksum + optional [Presidio](/ai-gateway/pii-redaction)) with reversible tokenization, applied inside the live stream. |
| **Prompt firewall**         | Built-in prompt-injection heuristics + your own regex/keyword rules + [canary tokens](/ai-gateway/firewall) that detect system-prompt extraction.             |
| **Budgets & FinOps**        | Per-agent USD caps with warn/block actions; [usage attribution](/ai-gateway/budgets-finops) by user, team, model, and agent.                                  |
| **Compliance packs**        | One-click [HIPAA, PCI-DSS, GDPR, SOC 2](/ai-gateway/compliance-packs) recognizer + alert-rule bundles.                                                        |
| **Observability**           | Per-request [OpenTelemetry GenAI spans](/ai-gateway/observability) — export to your own backend; no lock-in.                                                  |

## Core concepts

* **Gateway** — a container for agents, scoped to your tenant. You can have several (e.g. one per product surface).
* **Agent** — the addressable unit at `/v1/ai/<agent-slug>/…`. An agent has a primary **route** (which upstream provider + injected key), a firewall policy, a PII policy, a budget, and mint-able tokens.
* **Route** — a standard KnoxCall route pointing at the provider (e.g. `api.anthropic.com`), injecting the provider key from a secret. The gateway reuses KnoxCall's whole proxy substrate — secret injection, sandbox, rate limits, audit.
* **Phantom token** — the credential your app sends. Minted for one agent, short-lived, scoped, revocable.

## Bring your own Anthropic key

AI features that use Anthropic (including the gateway route KnoxCall provisions for first-party AI) run on **your own Anthropic key**, configured under **Settings → Integrations → Anthropic** — never a shared KnoxCall key. See [Bring your own key](/ai-gateway/byo-key).

## Next steps

<CardGroup cols={2}>
  <Card title="Quickstart" icon="rocket" href="/ai-gateway/quickstart">
    Swap your base URL and make your first governed call in minutes.
  </Card>

  <Card title="PII redaction" icon="user-shield" href="/ai-gateway/pii-redaction">
    How mid-stream redaction and reversible tokenization work.
  </Card>

  <Card title="Tokens & DPoP" icon="key" href="/ai-gateway/tokens-and-dpop">
    Phantom-token kinds, scoping, and sender-constrained credentials.
  </Card>

  <Card title="Budgets & FinOps" icon="chart-line" href="/ai-gateway/budgets-finops">
    Enforce spend caps and attribute cost by user, team, and model.
  </Card>
</CardGroup>
