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.
openapi: 3.1.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:
PIIScannerConfig:
properties:
pii_types:
items:
type: string
type: array
title: Pii Types
type: object
title: PIIScannerConfig
description: Configuration for the PII scanner.
ToolUseBlock:
properties:
type:
type: string
const: tool_use
title: Type
id:
type: string
title: Id
name:
type: string
title: Name
input:
additionalProperties:
$ref: '#/components/schemas/JSONValue-Output'
type: object
title: Input
type: object
required:
- type
- id
- name
- input
title: ToolUseBlock
description: Tool use block for Anthropic responses
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
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.
ChatCompletionResponseMessage:
properties:
content:
anyOf:
- type: string
- type: 'null'
title: Content
role:
type: string
const: assistant
title: Role
tool_calls:
anyOf:
- items:
$ref: '#/components/schemas/ChatCompletionMessageFunctionToolCall'
type: array
- type: 'null'
title: Tool Calls
type: object
required:
- role
title: ChatCompletionResponseMessage
GeminiSafetyRating:
properties:
category:
anyOf:
- type: string
- type: 'null'
title: Category
probability:
anyOf:
- type: string
- type: 'null'
title: Probability
blocked:
anyOf:
- type: boolean
- type: 'null'
title: Blocked
additionalProperties: true
type: object
title: GeminiSafetyRating
ResponsesEndpointResponse:
properties:
id:
anyOf:
- type: string
- type: 'null'
title: Id
object:
anyOf:
- type: string
- type: 'null'
title: Object
model:
anyOf:
- type: string
- type: 'null'
title: Model
output:
anyOf:
- items:
$ref: '#/components/schemas/JSONValue-Output'
type: array
- type: 'null'
title: Output
choices:
anyOf:
- items:
$ref: '#/components/schemas/ResponseChoice'
type: array
- type: 'null'
title: Choices
usage:
anyOf:
- $ref: '#/components/schemas/ResponseUsage'
- type: 'null'
error:
anyOf:
- $ref: '#/components/schemas/ResponseError'
- type: 'null'
additionalProperties: true
type: object
title: ResponsesEndpointResponse
MonitorTool:
additionalProperties:
$ref: '#/components/schemas/JSONValue-Input'
type: object
Prompt:
properties:
id:
type: string
title: Id
variables:
anyOf:
- additionalProperties: true
type: object
- type: 'null'
title: Variables
version:
anyOf:
- type: string
- type: 'null'
title: Version
type: object
required:
- id
title: Prompt
ChatCompletionRequestMessage:
properties:
role:
type: string
enum:
- system
- user
- assistant
- tool
- function
- developer
title: Role
content:
anyOf:
- type: string
- 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
type: object
required:
- role
title: ChatCompletionRequestMessage
GeminiContent:
properties:
parts:
items:
$ref: '#/components/schemas/GeminiPart'
type: array
title: Parts
role:
anyOf:
- type: string
- type: 'null'
title: Role
type: object
required:
- parts
title: GeminiContent
GeminiPart:
properties:
text:
type: string
title: Text
type: object
required:
- text
title: GeminiPart
IgnoredInput:
properties:
type:
type: string
const: media
title: Type
reason:
type: string
const: text_moderation_only
title: Reason
description:
type: string
title: Description
type: object
required:
- type
- reason
- description
title: IgnoredInput
description: Schema for inputs intentionally excluded before moderation.
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
Conversation:
properties:
id:
type: string
title: Id
type: object
required:
- id
title: Conversation
MonitorMessageContentPart:
properties:
type:
type: string
title: Type
text:
anyOf:
- type: string
- type: 'null'
title: Text
source:
anyOf:
- additionalProperties:
$ref: '#/components/schemas/JSONValue-Input'
type: object
- type: 'null'
title: Source
input:
anyOf:
- additionalProperties:
$ref: '#/components/schemas/JSONValue-Input'
type: object
- type: 'null'
title: Input
name:
anyOf:
- type: string
- type: 'null'
title: Name
id:
anyOf:
- type: string
- type: 'null'
title: Id
additionalProperties: true
type: object
required:
- type
title: MonitorMessageContentPart
ToolChoiceName:
properties:
name:
type: string
title: Name
type: object
required:
- name
title: ToolChoiceName
StandardErrorResponse:
properties:
error:
type: boolean
title: Error
default: true
message:
type: string
title: Message
detail:
type: string
title: Detail
error_code:
anyOf:
- type: string
- type: 'null'
title: Error Code
details:
anyOf:
- additionalProperties:
$ref: '#/components/schemas/JSONValue-Output'
type: object
- type: 'null'
title: Details
type: object
required:
- message
- detail
title: StandardErrorResponse
CreateChatCompletionRequest:
properties:
messages:
items:
$ref: '#/components/schemas/ChatCompletionRequestMessage'
type: array
title: Messages
model:
type: string
title: Model
metadata:
anyOf:
- additionalProperties: true
type: object
- type: 'null'
title: Metadata
frequency_penalty:
anyOf:
- type: number
- type: 'null'
title: Frequency Penalty
logit_bias:
anyOf:
- additionalProperties:
type: number
type: object
- type: 'null'
title: Logit Bias
logprobs:
anyOf:
- type: boolean
- type: 'null'
title: Logprobs
top_logprobs:
anyOf:
- type: integer
- type: 'null'
title: Top Logprobs
max_tokens:
anyOf:
- type: integer
- type: 'null'
title: Max Tokens
max_completion_tokens:
anyOf:
- type: integer
- type: 'null'
title: Max Completion Tokens
modalities:
anyOf:
- items:
type: string
type: array
- type: 'null'
title: Modalities
n:
type: integer
title: N
default: 1
prediction:
anyOf:
- {}
- type: 'null'
title: Prediction
audio:
anyOf:
- {}
- type: 'null'
title: Audio
presence_penalty:
anyOf:
- type: number
- type: 'null'
title: Presence Penalty
response_format:
anyOf:
- {}
- type: 'null'
title: Response Format
seed:
anyOf:
- type: integer
- type: 'null'
title: Seed
service_tier:
anyOf:
- type: string
- type: 'null'
title: Service Tier
stop:
anyOf:
- items:
type: string
type: array
- type: string
- type: 'null'
title: Stop
store:
anyOf:
- type: boolean
- type: 'null'
title: Store
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
default: 1
top_p:
anyOf:
- type: number
- type: 'null'
title: Top P
default: 1
tools:
anyOf:
- items:
$ref: '#/components/schemas/Tool'
type: array
- type: 'null'
title: Tools
tool_choice:
anyOf:
- type: string
enum:
- none
- auto
- required
- $ref: '#/components/schemas/ToolChoice'
title: Tool Choice
default: auto
parallel_tool_calls:
anyOf:
- type: boolean
- type: 'null'
title: Parallel Tool Calls
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
function_call:
anyOf:
- type: string
- additionalProperties: true
type: object
- type: 'null'
title: Function Call
functions:
anyOf:
- items: {}
type: array
- type: 'null'
title: Functions
moderate_before:
anyOf:
- type: boolean
- type: 'null'
title: Moderate Before
type: object
required:
- messages
- model
title: CreateChatCompletionRequest
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.
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
# --- 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