Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@
"pages": [
"integrations/guardrails/aporia",
"integrations/guardrails/acuvity",
"integrations/guardrails/akto",
"integrations/guardrails/azure-guardrails",
"integrations/guardrails/bedrock-guardrails",
"integrations/guardrails/crowdstrike-aidr",
Expand Down Expand Up @@ -3683,6 +3684,10 @@
"source": "/product/guardrails/acuvity",
"destination": "/integrations/guardrails/acuvity"
},
{
"source": "/product/guardrails/akto",
"destination": "/integrations/guardrails/akto"
},
{
"source": "/product/guardrails/azure-guardrails",
"destination": "/integrations/guardrails/azure-guardrails"
Expand Down
119 changes: 119 additions & 0 deletions integrations/guardrails/akto.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
---
title: "Akto"
description: "Akto Agentic Security provides advanced threat detection and security scanning for your LLM inputs and outputs."
---

[Akto](https://www.akto.io) provides advanced threat detection and security scanning for your AI applications, protecting against prompt injection, sensitive data leakage, and other LLM security threats.

To get started with Akto, visit their website:
<Card title="Get Started with Akto" href="https://www.akto.io" />

## Using Akto with Portkey

### 1. Add Akto Credentials to Portkey

* Click on the `Admin Settings` button on Sidebar
* Navigate to `Plugins` tab under Organisation Settings
* Click on the edit button for the Akto integration
* Add your Akto API Key and API Domain (obtain these from your Akto account)

### 2. Add Akto's Guardrail Check

* Navigate to the `Guardrails` page and click the `Create` button
* Search for "Akto Guardrail" and click `Add`
* Set any `actions` you want on your check, and create the Guardrail!

<Note>
Guardrail Actions allow you to orchestrate your guardrails logic. You can learn more about them [here](/product/guardrails#there-are-6-types-of-guardrail-actions)
</Note>

| Check Name | Description | Parameters | Supported Hooks |
|------------|-------------|------------|-----------------|
| Akto Guardrail | Scans and validates LLM inputs and outputs for security threats | None | `beforeRequestHook`, `afterRequestHook` |

### 3. Add Guardrail ID to a Config and Make Your Request

* When you save a Guardrail, you'll get an associated Guardrail ID - add this ID to the `before_request_hooks` or `after_request_hooks` params in your Portkey Config
* Create these Configs in Portkey UI, save them, and get an associated Config ID to attach to your requests. [More here](/product/ai-gateway/configs).

Here's an example configuration:

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

<Tabs>
<Tab title="NodeJS">

```js
const portkey = new Portkey({
apiKey: "PORTKEY_API_KEY",
config: "pc-***" // Supports a string config id or a config object
});
```
</Tab>
<Tab title="Python">

```py
portkey = Portkey(
api_key="PORTKEY_API_KEY",
config="pc-***" # Supports a string config id or a config object
)
```
</Tab>
<Tab title="OpenAI NodeJS">

```js
const openai = new OpenAI({
apiKey: 'OPENAI_API_KEY',
baseURL: PORTKEY_GATEWAY_URL,
defaultHeaders: createHeaders({
apiKey: "PORTKEY_API_KEY",
config: "CONFIG_ID"
})
});
```
</Tab>
<Tab title="OpenAI Python">

```py
client = OpenAI(
api_key="OPENAI_API_KEY", # defaults to os.environ.get("OPENAI_API_KEY")
base_url=PORTKEY_GATEWAY_URL,
default_headers=createHeaders(
provider="openai",
api_key="PORTKEY_API_KEY", # defaults to os.environ.get("PORTKEY_API_KEY")
config="CONFIG_ID"
)
)
```
</Tab>
<Tab title="cURL">

```sh
curl https://api.portkey.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "x-portkey-api-key: $PORTKEY_API_KEY" \
-H "x-portkey-config: $CONFIG_ID" \
-d '{
"model": "gpt-3.5-turbo",
"messages": [{
"role": "user",
"content": "Hello!"
}]
}'
```
</Tab>
</Tabs>

For more, refer to the [Config documentation](/product/ai-gateway/configs).

Your requests are now guarded by Akto's security scanning, and you can see the verdict and any actions taken directly in your Portkey logs!

## Get Support

If you face any issues with the Akto integration, join the [Portkey community forum](https://discord.gg/portkey-llms-in-prod-1143393887742861333) for assistance.