Gray Swan Cygnal API
The Cygnal API from Gray Swan — 7 operation(s) for cygnal.
The Cygnal API from Gray Swan — 7 operation(s) for cygnal.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/gray-swan-cygnal-api"
curl "https://apis.io/api/v1/apis?limit=25"
Discovery needs no key. Ratings and market analysis are Pro.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Gray Swan AI Activity Cygnal API
description: API for Gray Swan AI
version: 0.1.0
servers:
- url: https://api.grayswan.ai
tags:
- name: Cygnal
paths:
/cygnal/monitor:
post:
summary: Cygnal Monitor
description: 'Monitors content for policy violations.
This endpoint is used to check if the provided text contains harmful
content or violates a given set of policies.
Docs: [Guide](https://docs.grayswan.ai/cygnal/monitor-requests) |
[API Reference](https://docs.grayswan.ai/api-reference/cygnal/monitor)'
operationId: cygnal_monitor_cygnal_monitor_post
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CreateMonitorRequest'
examples:
text:
summary: Simple text moderation request
value:
text: Hello, this is a test message for monitoring.
reasoning_mode: 'off'
message_parts:
summary: Messages with array content parts
value:
messages:
- role: system
content:
- type: text
text: You are a helpful assistant.
- role: user
content:
- type: input_text
text: Hello
- type: text
text: Need help planning a trip.
reasoning_mode: 'off'
required: true
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/MonitoringResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/StandardErrorResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/StandardErrorResponse'
'422':
description: Unprocessable Content
content:
application/json:
schema:
$ref: '#/components/schemas/StandardErrorResponse'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/StandardErrorResponse'
tags:
- Cygnal
/cygnal/chat/completions:
post:
summary: Cygnal Completions
description: 'Create OpenAI-compatible chat completions with Cygnal protection.
Docs: [Guide](https://docs.grayswan.ai/cygnal/creating-completions) |
[API Reference](https://docs.grayswan.ai/api-reference/cygnal/completions)'
operationId: cygnal_completions_cygnal_chat_completions_post
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CreateChatCompletionRequest'
examples:
basic:
summary: Basic completion request
value:
model: gpt-4
messages:
- role: system
content: You are a helpful assistant.
- role: user
content: I need you to help me with something.
stream: false
temperature: 0.7
max_tokens: 1000
with_tools:
summary: Completion request with tool calls
value:
model: gpt-4
messages:
- role: system
content: You are a helpful assistant.
- role: user
content: What's the weather in San Francisco?
tools:
- type: function
function:
name: get_weather
description: Get the current weather
parameters:
type: object
properties:
location:
type: string
description: The city and state
required:
- location
stream: false
required: true
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/api__types__responses__openai_response__CreateChatCompletionResponse'
text/event-stream:
schema:
type: string
example: 'data: {"id":"example"}
data: [DONE]
'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/StandardErrorResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/StandardErrorResponse'
'422':
description: Unprocessable Content
content:
application/json:
schema:
$ref: '#/components/schemas/StandardErrorResponse'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/StandardErrorResponse'
tags:
- Cygnal
/cygnal/v1/chat/completions:
post:
summary: Cygnal Completions
description: 'Create OpenAI-compatible chat completions with Cygnal protection.
Docs: [Guide](https://docs.grayswan.ai/cygnal/creating-completions) |
[API Reference](https://docs.grayswan.ai/api-reference/cygnal/completions)'
operationId: cygnal_completions_cygnal_v1_chat_completions_post
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CreateChatCompletionRequest'
examples:
basic:
summary: Basic completion request
value:
model: gpt-4
messages:
- role: system
content: You are a helpful assistant.
- role: user
content: I need you to help me with something.
stream: false
temperature: 0.7
max_tokens: 1000
with_tools:
summary: Completion request with tool calls
value:
model: gpt-4
messages:
- role: system
content: You are a helpful assistant.
- role: user
content: What's the weather in San Francisco?
tools:
- type: function
function:
name: get_weather
description: Get the current weather
parameters:
type: object
properties:
location:
type: string
description: The city and state
required:
- location
stream: false
required: true
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/api__types__responses__openai_response__CreateChatCompletionResponse'
text/event-stream:
schema:
type: string
example: 'data: {"id":"example"}
data: [DONE]
'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/StandardErrorResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/StandardErrorResponse'
'422':
description: Unprocessable Content
content:
application/json:
schema:
$ref: '#/components/schemas/StandardErrorResponse'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/StandardErrorResponse'
tags:
- Cygnal
/cygnal/v1/messages:
post:
summary: Cygnal Anthropic Messages
description: 'Create Anthropic-compatible messages with Cygnal protection.
Docs: [Guide](https://docs.grayswan.ai/cygnal/creating-completions) |
[API Reference](https://docs.grayswan.ai/api-reference/cygnal/anthropic-messages-v1)'
operationId: cygnal_anthropic_messages_cygnal_v1_messages_post
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/api__types__responses__anthropic_response__CreateChatCompletionResponse'
text/event-stream:
schema:
type: string
example: 'data: {"id":"example"}
data: [DONE]
'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/StandardErrorResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/StandardErrorResponse'
'422':
description: Unprocessable Content
content:
application/json:
schema:
$ref: '#/components/schemas/StandardErrorResponse'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/StandardErrorResponse'
tags:
- Cygnal
/cygnal/v1beta/models/{model}:generateContent:
post:
summary: Cygnal Gemini Generate
description: 'Create Gemini-compatible generateContent responses with Cygnal protection.
Docs: [Guide](https://docs.grayswan.ai/cygnal/creating-completions) |
[API Reference](https://docs.grayswan.ai/api-reference/cygnal/gemini-generate-v1beta)'
operationId: cygnal_gemini_generate_cygnal_v1beta_models__model__generateContent_post
parameters:
- name: model
in: path
required: true
schema:
type: string
title: Model
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/GeminiGenerateContentResponse'
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/StandardErrorResponse'
description: Bad Request
'401':
content:
application/json:
schema:
$ref: '#/components/schemas/StandardErrorResponse'
description: Unauthorized
'422':
content:
application/json:
schema:
$ref: '#/components/schemas/StandardErrorResponse'
description: Unprocessable Content
'500':
content:
application/json:
schema:
$ref: '#/components/schemas/StandardErrorResponse'
description: Internal Server Error
tags:
- Cygnal
/cygnal/v1beta/models/{model}:streamGenerateContent:
post:
summary: Cygnal Gemini Stream Generate Content
description: 'Create Gemini-compatible streaming responses with Cygnal protection.
Docs: [Guide](https://docs.grayswan.ai/cygnal/creating-completions) |
[API Reference](https://docs.grayswan.ai/api-reference/cygnal/gemini-stream-generate-content-v1beta)'
operationId: cygnal_gemini_stream_generate_content_cygnal_v1beta_models__model__streamGenerateContent_post
parameters:
- name: model
in: path
required: true
schema:
type: string
title: Model
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/GeminiStreamChunkResponse'
type: string
example: '{"candidates":[{"content":{"parts":[{"text":"example"}]}}]}'
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/StandardErrorResponse'
description: Bad Request
'401':
content:
application/json:
schema:
$ref: '#/components/schemas/StandardErrorResponse'
description: Unauthorized
'422':
content:
application/json:
schema:
$ref: '#/components/schemas/StandardErrorResponse'
description: Unprocessable Content
'500':
content:
application/json:
schema:
$ref: '#/components/schemas/StandardErrorResponse'
description: Internal Server Error
tags:
- Cygnal
/cygnal/responses:
post:
summary: Cygnal Responses
description: 'Process and monitor OpenAI-compatible response requests.
This endpoint processes completion requests with monitoring capabilities,
similar to the chat completions endpoint.
Docs: [Guide](https://docs.grayswan.ai/cygnal/creating-responses) |
[API Reference](https://docs.grayswan.ai/api-reference/cygnal/responses)'
operationId: cygnal_responses_cygnal_responses_post
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CreateResponseRequest'
required: true
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/ResponsesEndpointResponse'
text/event-stream:
schema:
type: string
example: 'data: {"id":"example"}
data: [DONE]
'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/StandardErrorResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/StandardErrorResponse'
'422':
description: Unprocessable Content
content:
application/json:
schema:
$ref: '#/components/schemas/StandardErrorResponse'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/StandardErrorResponse'
'502':
description: Bad Gateway
content:
application/json:
schema:
$ref: '#/components/schemas/StandardErrorResponse'
tags:
- Cygnal
components:
schemas:
api__types__responses__anthropic_response__CreateChatCompletionResponse:
properties:
id:
type: string
title: Id
type:
type: string
const: message
title: Type
role:
type: string
const: assistant
title: Role
content:
items:
anyOf:
- $ref: '#/components/schemas/ContentBlock-Output'
- $ref: '#/components/schemas/ToolUseBlock'
type: array
title: Content
model:
type: string
title: Model
stop_reason:
anyOf:
- type: string
enum:
- end_turn
- max_tokens
- stop_sequence
- tool_use
- content_filter
- type: 'null'
title: Stop Reason
usage:
anyOf:
- $ref: '#/components/schemas/AnthropicUsage'
- type: 'null'
type: object
required:
- id
- type
- role
- content
- model
title: CreateChatCompletionResponse
description: Anthropic message response
ChatCompletionChoice:
properties:
finish_reason:
type: string
enum:
- stop
- length
- content_filter
- tool_calls
- violation
title: Finish Reason
index:
type: integer
title: Index
message:
$ref: '#/components/schemas/ChatCompletionResponseMessage'
logprobs:
anyOf:
- type: string
- type: 'null'
title: Logprobs
type: object
required:
- finish_reason
- index
- message
title: ChatCompletionChoice
PromptTokensDetails:
properties:
audio_tokens:
anyOf:
- type: integer
- type: 'null'
title: Audio Tokens
cached_tokens:
anyOf:
- type: integer
- type: 'null'
title: Cached Tokens
additionalProperties: true
type: object
title: PromptTokensDetails
description: Breakdown of tokens used in the prompt.
ChatCompletionMessageFunctionToolCall:
properties:
id:
type: string
title: Id
function:
$ref: '#/components/schemas/Function'
type:
type: string
const: function
title: Type
additionalProperties: true
type: object
required:
- id
- function
- type
title: ChatCompletionMessageFunctionToolCall
description: A call to a function tool created by the model.
api__types__requests__openai_request__ToolFunction:
properties:
name:
type: string
title: Name
description:
type: string
title: Description
parameters:
additionalProperties: true
type: object
title: Parameters
required:
anyOf:
- items:
type: string
type: array
- type: 'null'
title: Required
type: object
required:
- name
- description
- parameters
title: ToolFunction
CompletionUsage:
properties:
completion_tokens:
type: integer
title: Completion Tokens
prompt_tokens:
type: integer
title: Prompt Tokens
total_tokens:
type: integer
title: Total Tokens
completion_tokens_details:
anyOf:
- $ref: '#/components/schemas/CompletionTokensDetails'
- type: 'null'
prompt_tokens_details:
anyOf:
- $ref: '#/components/schemas/PromptTokensDetails'
- type: 'null'
additionalProperties: true
type: object
required:
- completion_tokens
- prompt_tokens
- total_tokens
title: CompletionUsage
description: Usage statistics for the completion request.
api__types__responses__openai_response__CreateChatCompletionResponse:
properties:
id:
type: string
title: Id
choices:
items:
$ref: '#/components/schemas/ChatCompletionChoice'
type: array
title: Choices
created:
type: integer
title: Created
model:
type: string
title: Model
object:
type: string
const: chat.completion
title: Object
system_fingerprint:
anyOf:
- type: string
- type: 'null'
title: System Fingerprint
usage:
anyOf:
- $ref: '#/components/schemas/CompletionUsage'
- type: 'null'
type: object
required:
- id
- choices
- created
- model
- object
title: CreateChatCompletionResponse
description: Based on OpenAI's official Completion type
examples:
- choices:
- finish_reason: stop
index: 0
message:
content: Sure, just let me know what you'd like me to help with!
role: assistant
created: 1987654321
id: '1234567890'
model: gpt-4o
object: chat.completion
system_fingerprint: v-0.2
MonitorMessage:
properties:
role:
$ref: '#/components/schemas/MonitorMessageRole'
content:
anyOf:
- type: string
- items:
$ref: '#/components/schemas/MonitorMessageContentPart'
type: array
- type: 'null'
title: Content
tool_calls:
anyOf:
- items:
$ref: '#/components/schemas/ChatCompletionMessageFunctionToolCall'
type: array
- type: 'null'
title: Tool Calls
tool_call_id:
anyOf:
- type: string
- type: 'null'
title: Tool Call Id
name:
anyOf:
- type: string
- type: 'null'
title: Name
type: object
required:
- role
title: MonitorMessage
ResponseMessage:
properties:
role:
anyOf:
- type: string
- type: 'null'
title: Role
content:
anyOf:
- type: string
- type: 'null'
title: Content
additionalProperties: true
type: object
title: ResponseMessage
ResponseChoice:
properties:
index:
anyOf:
- type: integer
- type: 'null'
title: Index
finish_reason:
anyOf:
- type: string
- type: 'null'
title: Finish Reason
message:
anyOf:
- $ref: '#/components/schemas/ResponseMessage'
- type: 'null'
additionalProperties: true
type: object
title: ResponseChoice
Conversation:
properties:
id:
type: string
title: Id
type: object
required:
- id
title: Conversation
MonitoringResponse:
properties:
violation:
type: number
title: Violation
default: 0.0
observe_violation:
anyOf:
- type: number
- type: 'null'
title: Observe Violation
violated_rules:
items:
type: integer
type: array
title: Violated Rules
default: []
violated_rule_descriptions:
items:
$ref: '#/components/schemas/RuleDescription'
type: array
title: Violated Rule Descriptions
default: []
ignored_inputs:
items:
$ref: '#/components/schemas/IgnoredInput'
type: array
title: Ignored Inputs
default: []
ipi:
type: boolean
title: Ipi
default: false
mutation:
type: boolean
title: Mutation
default: false
scanner_output:
anyOf:
- additionalProperties: true
type: object
- type: 'null'
title: Scanner Output
reasoning:
anyOf:
- type: string
- type: 'null'
title: Reasoning
input_tokens:
anyOf:
- type: integer
- type: 'null'
title: Input Tokens
output_tokens:
anyOf:
- type: integer
- type: 'null'
title: Output Tokens
activity_id:
anyOf:
- type: string
- type: 'null'
title: Activity Id
block_message:
anyOf:
- type: string
- type: 'null'
title: Block Message
error:
type: boolean
title: Error
default: false
error_message:
anyOf:
- type: string
- type: 'null'
title: Error Message
type: object
title: MonitoringResponse
description: 'Response schema for monitoring/moderation results.
Also used as the structure for pre_analysis and post_generation_analysis
dicts in activity logging.'
GeminiGenerateContentResponse:
properties:
id:
type: string
title: Id
candidates:
items:
$ref: '#/components/schemas/GeminiCandidate'
type: array
title: Candidates
prompt_feedback:
anyOf:
- $ref: '#/components/schemas/GeminiPromptFeedback'
- type: 'null'
usage_metadata:
anyOf:
- $ref: '#/components/schemas/GeminiUsageMetadata'
- type: 'null'
type: object
required:
- id
- candidates
title: GeminiGenerateContentResponse
CreateResponseRequest:
properties:
background:
type: boolean
title: Background
default: false
conversation:
anyOf:
- type: string
- $ref: '#/components/schemas/Conversation'
- type: 'null'
title: Conversation
include:
anyOf:
- items: {}
type: array
- type: 'null'
title: Include
input:
anyOf:
- type: string
- items: {}
type: array
- type: 'null'
title: Input
instructions:
anyOf:
- type: string
- type: 'null'
title: Instructions
max_output_tokens:
anyOf:
- type: integer
- type: 'null'
title: Max Output Tokens
max_tool_calls:
anyOf:
- type: integer
- type: 'null'
title: Max Tool Calls
metadata:
anyOf:
- additionalProperties: true
type: object
- type: 'null'
title: Metadata
model:
anyOf:
- type: string
- type: 'null'
title: Model
parallel_tool_calls:
anyOf:
- type: boolean
- type: 'null'
title: Parallel Tool Calls
default: true
previous_response:
anyOf:
- type: string
- type: 'null'
title: Previous Response
prompt:
anyOf:
- $ref: '#/components/schemas/Prompt'
- type: 'null'
prompt_cache_key:
anyOf:
- type: string
- type: 'null'
title: Prompt Cache Key
reasoning:
anyOf:
- additionalProperties: true
type: object
- type: 'null'
title: Reasoning
safety_identifier:
anyOf:
- type: string
- type: 'null'
title: Safety Identifier
service_tier:
anyOf:
- type: string
enum:
- auto
- default
- flex
- scale
- priority
- type: 'null'
title: Service Tier
store:
anyOf:
- type: boolean
- type: 'null'
title: Store
default: true
stream:
anyOf:
- type: boolean
- type: 'null'
title: Stream
default: false
stream_options:
anyOf:
- {}
- type: 'null'
title: Stream Options
temperature:
anyOf:
- type: number
- type: 'null'
title: Temperature
text:
anyOf:
- {}
- type: 'null'
title: Text
tool_choice:
anyOf:
- type: string
enum:
- none
- auto
- required
- $ref: '#/components/schemas/ToolChoice'
title: Tool Choice
default: auto
tools:
anyOf:
- items: {}
type: array
- type: 'null'
title: Tools
top_logprobs:
anyOf:
- type: integer
- type: 'null'
title: Top Logprobs
top_p:
anyOf:
- type: number
- type: 'null'
title: Top P
truncation:
anyOf:
- type: string
enum:
- auto
- disabled
- type: 'null'
title: Truncation
default: disabled
user:
anyOf:
- type: string
- type: 'null'
title: User
monitor_details:
anyOf:
- type: boolean
- type: 'null'
title: Monitor Details
policy_id:
anyOf:
- type: string
- type: 'null'
title: Policy Id
type: object
title: CreateResponseRequest
RuleDescription:
properties:
rule:
type: integer
title: Rule
name:
type: string
title: Name
description:
type: string
title: Description
type: object
title: RuleDescription
description: Schema for violated rule descriptions used in MonitoringResponse.
ResponseUsage:
properties:
prompt_tokens:
anyOf:
- type: integer
- type: 'null'
title: Prompt Tokens
completion_tokens:
anyOf:
- type: integer
- type: 'null'
title: Completion Tokens
total_tokens:
anyOf:
- type: integer
- type: 'null'
title: Total Tokens
input_tokens:
anyOf:
- type: integer
- type: 'null'
title: Input Tokens
output_tokens:
anyOf:
- type: integer
- type: 'null'
title: Output Tokens
additionalProperties: true
type: object
title: ResponseUsage
GeminiPromptFeedback:
properties:
safety_ratings:
anyOf:
- items:
$ref: '#/components/schemas/GeminiSafetyRating'
type: array
- type: 'null'
title: Safety Ratings
type: object
title: GeminiPromptFeedback
GeminiCandidate:
properties:
id:
anyOf:
- type: string
- type: 'null'
title: Id
content:
$ref: '#/components/schemas/GeminiContent'
finish_reason:
anyOf:
- type: string
- type: 'null'
title: Finish Reason
index:
anyOf:
- type: integer
- type: 'null'
title: Index
safety_ratings:
anyOf:
- items:
$ref: '#/components/schemas/GeminiSafetyRating'
type: array
- type: 'null'
title: Safety Ratings
type: object
required:
- content
title: GeminiCandidate
CreateMonitorRequest:
properties:
text:
anyOf:
- type: string
- type: 'null'
title: Text
messages:
anyOf:
- items:
$ref: '#/components/schemas/MonitorMessage'
type: array
- type: 'null'
title: Messages
tools:
anyOf:
- items:
$ref: '#/components/schemas/MonitorTool'
type: array
- type: 'null'
title: Tools
metadata:
anyOf:
# --- truncated at 32 KB (50 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/gray-swan/refs/heads/main/openapi/gray-swan-cygnal-api-openapi.yml