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

# Lakera

> Lakera Guard screens LLM prompts and responses for prompt injection, policy violations, and PII.

[Lakera Guard](https://www.lakera.ai/) screens prompts and responses via the `/v2/guard` API — blocking on policy hits and redacting PII spans when only `pii/*` detectors fire.

<Note>
  Requires Backend `v1.16.2+`.
</Note>

## Using Lakera with Portkey

### 1. Add Lakera Credentials to Portkey

* Navigate to `Admin Settings` → `Plugins`
* Edit the **Lakera** integration
* Add your **Lakera API Key** (create a Guard API key at [platform.lakera.ai](https://platform.lakera.ai))
* Optionally set **API Base URL** (defaults to `https://api.lakera.ai`)

### 2. Add Lakera Guardrail Check

* Navigate to `Guardrails` → `Create`
* Search for **"Lakera Guard"** and click `Add`
* Configure:
  * **Lakera Project ID** (`projectID`, optional) — project whose policy defines detectors to run
  * **Payload End Offset Is Inclusive** (`endInclusive`, default `false`)
  * **Timeout** (`timeout`, default `30000` ms)
* Set guardrail actions and create the guardrail

| Check Name   | Description                                     | Parameters                             | Supported Hooks                         |
| ------------ | ----------------------------------------------- | -------------------------------------- | --------------------------------------- |
| Lakera Guard | Calls Lakera `/v2/guard` with payload+breakdown | `projectID`, `endInclusive`, `timeout` | `beforeRequestHook`, `afterRequestHook` |

### 3. Attach to a Config

```json theme={"system"}
{
  "input_guardrails": ["guardrails-id-xxx"],
  "output_guardrails": ["guardrails-id-yyy"]
}
```

See [Configs](/product/ai-gateway/configs) for usage with SDKs and the gateway.
