API Reference

Completions

POST
/chat/completion
/chat/completion

The Authorization access token

Authorization

Authorization
Required
Bearer <token>

API Key

In: header

Request Body

application/jsonRequired

messages
Required
Messages

model
Required
Model

frequency_penaltyFrequency Penalty

Default: 0

max_tokensMax Tokens

nN

Default: 1

temperatureTemperature

Default: 1

top_pTop P

Default: 1

toolsTools

tool_choiceTool Choice

streamStream

Default: false

moderate_beforeModerateBefore

curl -X POST "https://api.grayswan.ai/chat/completion" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [
      {
        "role": "system",
        "content": "string"
      }
    ],
    "model": "cygnet-v0.2",
    "frequency_penalty": 0,
    "max_tokens": 0,
    "n": 1,
    "temperature": 1,
    "top_p": 1,
    "tools": [
      {
        "type": "string",
        "function": {
          "name": "string",
          "description": "string",
          "parameters": {}
        }
      }
    ],
    "tool_choice": "none",
    "stream": false,
    "moderate_before": true
  }'

Successful Response

{
  "id": "string",
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "message": {
        "content": "string",
        "role": "assistant",
        "tool_calls": [
          {
            "id": "string",
            "function": {
              "arguments": "string",
              "name": "string"
            },
            "type": "function"
          }
        ]
      },
      "logprobs": "string"
    }
  ],
  "created": 0,
  "model": "string",
  "object": "chat.completion",
  "system_fingerprint": "string",
  "usage": {
    "completion_tokens": 0,
    "prompt_tokens": 0,
    "total_tokens": 0
  }
}