Lasso Security provides comprehensive protection for your GenAI applications against various security threats including prompt injections, data leaks, and other potential risks that could compromise your AI systems.
To get started with Lasso Security, visit their documentation:
Get Started with Lasso Security
Using Lasso with Portkey
1. Add Lasso Credentials to Portkey
- Navigate to the
Integrations page under Settings
- Click on the edit button for the Lasso integration
- Add your Lasso API Key (obtain this from your Lasso Security account)
2. Add Lasso’s Guardrail Check
- Navigate to the
Guardrails page and click the Create button
- Search for “Scan Content” and click
Add
- Set the timeout in milliseconds (default: 10000ms)
- Set any
actions you want on your check, and create the Guardrail!
Guardrail Actions allow you to orchestrate your guardrails logic. You can learn more about them here
| Check Name | Description | Parameters | Supported Hooks |
|---|
| Scan Content | Lasso Security’s Deputies analyze content for various security risks including jailbreak attempts, custom policy violations, sexual content, hate speech, illegal content, and more. | Timeout (number) | beforeRequestHook |
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.
Here’s an example config:
{
"input_guardrails": ["guardrails-id-xxx", "guardrails-id-yyy"],
"output_guardrails": ["guardrails-id-xxx", "guardrails-id-yyy"]
}
NodeJS
Python
OpenAI NodeJS
OpenAI Python
cURL
const portkey = new Portkey({
apiKey: "PORTKEY_API_KEY",
config: "pc-***" // Supports a string config id or a config object
});
portkey = Portkey(
api_key="PORTKEY_API_KEY",
config="pc-***" # Supports a string config id or a config object
)
const openai = new OpenAI({
apiKey: 'OPENAI_API_KEY',
baseURL: PORTKEY_GATEWAY_URL,
defaultHeaders: createHeaders({
apiKey: "PORTKEY_API_KEY",
config: "CONFIG_ID"
})
});
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"
)
)
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!"
}]
}'
For more, refer to the Config documentation.
Your requests are now guarded by Lasso Security’s protective measures, and you can see the verdict and any actions taken directly in your Portkey logs!
Key Security Features
Lasso Security’s Deputies analyze content for various security risks across multiple categories:
- Prompt Injections: Detects attempts to manipulate AI behavior through crafted inputs
- Data Leaks: Prevents sensitive information from being exposed through AI interactions
- Jailbreak Attempts: Identifies attempts to bypass AI safety mechanisms
- Custom Policy Violations: Enforces your organization’s specific security policies
- Harmful Content Detection: Flags sexual content, hate speech, illegal content, and more
Learn more about Lasso Security’s features here.
Get Support
If you face any issues with the Lasso Security integration, join the Portkey community forum for assistance. Last modified on January 28, 2026