Creating completions
Securely wrap any LLM with Cygnal in moments
Using Cygnal
Cygnal augments any LLM deployment with state-of-the-art input filtering, output filtering, and threat monitoring with just a few lines of code, all customizable to your organization's policies.
Cygnal is compatible with all major LLM providers, SDKs, and API formats, including OpenAI, Gemini, Anthropic, and more. For any existing integration, all you need to do is to change the base_url
to Cygnal, add the grayswan-api-key
header, and we'll take care of the rest. Additional Cygnal options, like customizing filtering policies, can be specified in additional headers. No need to change SDKs or introduce additional dependencies.
Security filtering results for each request will show up live in your activity dashboard. The free tier has 200,000 tokens/minute and 10,000,000 tokens/day limits; if you reach quota, Cygnal will still proxy your request to the provider, just without filtering.
OpenAI
Gemini
Anthropic
Further Configuration
Specifying the policies
You can specify the policies to use for the completion by using the category-...
or cygnal-category-...
header prefix. Cygnal will act upon those configured categories as it's policy.
Specifying thresholds
You can specify the thresholds for the completion by using the pre-violation
, post-violation-jb
, pre-jailbreak
, and post-jailbreak
headers.
These are all floats between 0 and 1, where 0 is the most strict and 1 is the most permissive.
Parameter | Description | Effect |
---|---|---|
pre-violation | Controls when user input is flagged as a policy violation before being sent to the model | Lower values (e.g., 0.1) = more strict filtering, higher values = more permissive |
pre-jailbreak | Detects jailbreak attempts in user input before processing | Lower values = more sensitive detection, higher values = allows more potential jailbreak patterns |
post-violation | Flags model responses that violate content policies | Lower values = more strictly filtered responses, higher values = allows more potentially problematic content |
post-violation-jb | Detects successful jailbreaks in model responses | Lower values = more aggressive at identifying bypassed safety measures, higher values = only flags clear safety bypasses |
Specifying the provider
By default, Cygnal will intelligently identify which provider to use, however you can also specify the provider to use by using the original-base-url
header.
You can also specify the provider name by using the model-provider
header.
Configuration Parameters
You can send along any parameters that the provider supports which includes, but is not limited to:
Parameter | Description |
---|---|
max_tokens | The maximum number of tokens to generate. |
temperature | The temperature to use for the completion, higher values are more random, lower values are more deterministic. |
top_p | The top-p value to use for the completion, 1.0 means no repetition, 0.0 means maximum repetition. |
frequency_penalty | The frequency penalty to use for the completion, higher values are more penalized. |
presence_penalty | The presence penalty to use for the completion, higher values are more penalized. |
seed | The seed to use for the completion, useful for reproducibility. |
stop | The stop sequence to use for the completion, can be a list of strings or a single string. |