---
title: "Cygnal Completions"
method: POST
path: "/cygnal/chat/completions"
---

# Cygnal Completions

`POST /cygnal/chat/completions`

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)

## Request body

- CreateChatCompletionRequest
  - `messages` ChatCompletionRequestMessage[], required
    - `role` 'system' | 'user' | 'assistant' | 'tool' | 'function' | 'developer', required
    - `content` string, nullable
    - `tool_calls` ChatCompletionMessageFunctionToolCall[], nullable
      - `id` string, required
      - `function` Function, required — The function that the model called.
        - `arguments` string, required
        - `name` string, required
      - `type` 'function', required
    - `tool_call_id` string, nullable
  - `model` string, required
  - `metadata` object, nullable
  - `frequency_penalty` number, nullable
  - `logit_bias` object, nullable
  - `logprobs` boolean, nullable
  - `top_logprobs` integer, nullable
  - `max_tokens` integer, nullable
  - `max_completion_tokens` integer, nullable
  - `modalities` string[], nullable
  - `n` integer
  - `prediction` unknown
  - `audio` unknown
  - `presence_penalty` number, nullable
  - `response_format` unknown
  - `seed` integer, nullable
  - `service_tier` string, nullable
  - `stop` union
    - string[]
    - string
  - `store` boolean, nullable
  - `stream` boolean, nullable
  - `stream_options` unknown
  - `temperature` number, nullable
  - `top_p` number, nullable
  - `tools` Tool[], nullable
    - `type` string, required
    - `function` ApiTypesRequestsOpenaiRequestToolFunction, required
      - `name` string, required
      - `description` string, required
      - `parameters` object, required
      - `required` string[], nullable
  - `tool_choice` union
    - 'none' | 'auto' | 'required'
    - ToolChoice
      - `type` string, required
      - `function` ToolChoiceName, required
        - `name` string, required
  - `parallel_tool_calls` boolean, nullable
  - `user` string, nullable
  - `monitor_details` boolean, nullable
  - `policy_id` string, nullable
  - `function_call` union
    - string
    - object
  - `functions` unknown[], nullable
    - unknown
  - `moderate_before` boolean, nullable

## Response `200`

Successful Response

- ApiTypesResponsesOpenaiResponseCreateChatCompletionResponse — Based on OpenAI's official Completion type
  - `id` string, required
  - `choices` ChatCompletionChoice[], required
    - `finish_reason` 'stop' | 'length' | 'content_filter' | 'tool_calls' | 'violation', required
    - `index` integer, required
    - `message` ChatCompletionResponseMessage, required
      - `content` string, nullable
      - `role` 'assistant', required
      - `tool_calls` ChatCompletionMessageFunctionToolCall[], nullable
        - `id` string, required
        - `function` Function, required — The function that the model called.
          - `arguments` string, required
          - `name` string, required
        - `type` 'function', required
    - `logprobs` string, nullable
  - `created` integer, required
  - `model` string, required
  - `object` 'chat.completion', required
  - `system_fingerprint` string, nullable
  - `usage` CompletionUsage — Usage statistics for the completion request.
    - `completion_tokens` integer, required
    - `prompt_tokens` integer, required
    - `total_tokens` integer, required
    - `completion_tokens_details` CompletionTokensDetails — Breakdown of tokens used in a completion.
      - `accepted_prediction_tokens` integer, nullable
      - `audio_tokens` integer, nullable
      - `reasoning_tokens` integer, nullable
      - `rejected_prediction_tokens` integer, nullable
    - `prompt_tokens_details` PromptTokensDetails — Breakdown of tokens used in the prompt.
      - `audio_tokens` integer, nullable
      - `cached_tokens` integer, nullable

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `422` — Unprocessable Content
- `500` — Internal Server Error

---

[API](https://skmtc.net/grayswan/apis/gray-swan-ai-api.md) · [All operations](https://skmtc.net/grayswan/apis/gray-swan-ai-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/grayswan/gray-swan-ai-api/revisions/6ef1ea32ff13/schema)
