AI Gateway integration
Portkey integration
1. Add Aporia API Key to Portkey
- Inside Portkey, navigate to the “Integrations” page under “Settings”.
- Click on the edit button for the Aporia integration and add your API key.
![](https://mintlify.s3-us-west-1.amazonaws.com/aporia/images/portkey-1.png)
2. Add Aporia’s Guardrail Check
- Navigate to the “Guardrails” page inside Portkey.
- Search for “Validate - Project” Guardrail Check and click on
Add
. - Input your corresponding Aporia Project ID where you are defining the policies.
- Save the check, set any actions you want on the check, and create the Guardrail!
Check Name | Description | Parameters | Supported Hooks |
---|---|---|---|
Validate - Projects | Runs a project containing policies set in Aporia and returns a PASS or FAIL verdict | Project ID: string | beforeRequestHooks , afterRequestHooks |
Your Aporia Guardrail is now ready to be added to any Portkey request you’d like!
![](https://mintlify.s3-us-west-1.amazonaws.com/aporia/images/portkey-2.png)
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
orafter_request_hooks
methods in your Portkey Config. - Save this Config and pass it along with any Portkey request you’re making!
Your requests are now guarded by your Aporia policies and you can see the Verdict and any action you take directly on Portkey logs! More detailed logs for your requests will also be available on your Aporia dashboard.