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

# CrowdStrike AIDR

> CrowdStrike AI Detection and Response (AIDR) integration for scanning LLM inputs and outputs to block or redact harmful content.

[CrowdStrike AIDR](https://www.crowdstrike.com/) provides AI Detection and Response capabilities for scanning LLM inputs and outputs. It can block or sanitize text depending on configured rules.

<Card title="Get Started with CrowdStrike" href="https://www.crowdstrike.com/" />

## Using CrowdStrike AIDR with Portkey

### 1. Add CrowdStrike Credentials to Portkey

* Navigate to the `Integration` page under `Sidebar`
* Click on the edit button for the CrowdStrike AIDR integration
* Add your CrowdStrike API credentials

### 2. Add CrowdStrike's Guardrail Check

* Navigate to the `Guardrails` page and click the `Create` button
* Search for **Guard Chat Completions** and click `Add`
* Configure your guardrail settings
* 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 them [here](/product/guardrails#there-are-6-types-of-guardrail-actions)
</Note>

| Check Name             | Description                                                                                                                                 | Parameters          | Supported Hooks                         |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | --------------------------------------- |
| Guard Chat Completions | Pass LLM Input and Output to CrowdStrike's guard\_chat\_completions endpoint. Able to block or sanitize text depending on configured rules. | `Redact`, `Timeout` | `beforeRequestHook`, `afterRequestHook` |

**Parameters:**

| Parameter | Type    | Default | Description                                        |
| --------- | ------- | ------- | -------------------------------------------------- |
| `redact`  | boolean | `false` | If true, detected harmful content will be redacted |
| `timeout` | number  | `5000`  | Timeout in milliseconds                            |

### 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 `input_guardrails` or `output_guardrails` 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 config:

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

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

  <Tab title="Python">
    ```py theme={"system"}
    portkey = Portkey(
        api_key="PORTKEY_API_KEY",
        config="pc-***" # Supports a string config id or a config object
    )
    ```
  </Tab>

  <Tab title="OpenAI NodeJS">
    ```js theme={"system"}
    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 theme={"system"}
    client = OpenAI(
        api_key="OPENAI_API_KEY",
        base_url=PORTKEY_GATEWAY_URL,
        default_headers=createHeaders(
            provider="openai",
            api_key="PORTKEY_API_KEY",
            config="CONFIG_ID"
        )
    )
    ```
  </Tab>

  <Tab title="cURL">
    ```sh theme={"system"}
    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 CrowdStrike AIDR and you can see the Verdict and any action you take directly on Portkey logs!

## Get Support

If you face any issues with the CrowdStrike AIDR integration, just ping the Portkey team on the [community forum](https://discord.gg/portkey-llms-in-prod-1143393887742861333).
