Using Alice with Portkey
1. Add Alice Credentials to Portkey
- Navigate to the
Integrationspage underSidebar - Click on the edit button for the Alice integration
- Add your Alice API key — create one in WonderSuite under Account Settings → API Keys
API base URL is optional. Leave it blank unless you run a private Alice deployment.
2. Add Alice’s Guardrail Check
- Navigate to the
Guardrailspage and click theCreatebutton - Search for Evaluate and click
Add - Set the Application the check applies to (see below), and any
actionsyou want on your check - Create the Guardrail!
Guardrail Actions allow you to orchestrate your guardrails logic. You can learn them here
Parameters:
Naming the application
This is the one setting most likely to trip you up on a first run, so it is worth a section of its own. Alice configures policies per application, and a project usually holds several — a support bot and a payments agent do not want the same rules. One Alice API key fronts all of them, so the application cannot be part of the credential. It is a parameter on the check instead:appId takes the application’s UUID from your Alice Application Inventory, or your own id for it if you filled in the optional Application ID field when you added the application. A guardrail that names no application fails its check rather than being evaluated against a guess — which would measure your traffic against the wrong policy set.
If you need different policies for different traffic, create one guardrail per application and attach each to the Config that routes that traffic.
What is sent
The plugin forwards the hook context as it received it and enforces the verdict that comes back. It selects nothing and renames nothing — which parts of a turn are worth evaluating, and how a verdict is reached, are decided on Alice’s side, so those can change without you upgrading your Gateway. Credentials are the single exception.context.request.headers carries your caller’s Authorization and x-portkey-api-key in the clear, and a provider credential can ride along under a nested field, so any key named headers, credentials, api_key, apiKey, authorization or cookie is dropped at every nesting depth before the body is serialised, and never leaves your Gateway. Only the outbound copy is affected — the real context continues down the pipeline untouched.
Portkey’s x-portkey-trace-id is sent alongside, so the turns of one conversation group together in Alice rather than scattering.
What each verdict does
A
MASK verdict is applied all-or-nothing: if any replacement cannot be written back, the check fails instead of applying the rest, so content Alice meant to replace can never reach the model alongside content that was replaced.
When Alice cannot be reached
A transport failure, a timeout, and an answer that cannot be read are all reported as a check error, never as a pass. So is a4xx — a rejected API key is a misconfiguration, not a reason to let traffic through unscreened.
That makes failOnError on the check the single place that decides what happens next:
failOnError: false(default) — the guardrail is skipped and the request proceedsfailOnError: true— the check fails, and your guardrail actions decide whether to deny
true if unscreened traffic is not acceptable for this application.
Masking applies to the content part currently being handled. On a streamed response, blocking still works, but the streamed text is not rewritten.
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_guardrailsoroutput_guardrailsparams 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.
- NodeJS
- Python
- OpenAI NodeJS
- OpenAI Python
- REST

