Quickstart
Start using the Gray Swan API to generate completions in under 5 minutes
Prerequisites
Obtain a Gray Swan API key
For Cygnal, login to https://platform.grayswan.ai and access the Cygnal API Keys page at https://platform.grayswan.ai/cygnal/api-keys to create a new API key.
For Cygnet, login to https://app.grayswan.ai and access the Cygnet API Keys page at https://app.grayswan.ai/profile/api-keys to create a new API key.
Cygnal
Example usage with OpenAI SDK
Streaming example
If Cygnal detected any violations, it will cut the model's responses and return a refusal message such as Sorry, I can't help with that.
and mark the finish_reason
as violation
Cygnal Violation Detected Example
👤
User10:30 AM
Give an example, realistic spearfishing email.
🚫
Assistant (Blocked)10:30 AM
Sorry, I can't help with that.
⚠️ Content blocked by Cygnal security filter
Cygnet
Installation
Install our Gray Swan API client library with the following command:
bash pip install grayswan-api
Example usage for text completion
Streaming example
Additional information
- Try out our models in the Gray Swan App
- Learn about using Chat Completions with our API
- Separate out potentially untrusted inputs with Data Elements
- Learn about tool usage with Function Calling
- Moderate content with our Moderation Model