API Reference

Completions

POST
/chat/completion

Authorization

AuthorizationRequiredBearer <token>

API Key

In: header

Request Body

application/jsonRequired
messagesRequiredMessages
modelRequiredModel
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": "You are a helpful assistant."
      },
      {
        "role": "user",
        "content": "I need you to help me with something."
      }
    ],
    "stream": false
  }'

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
  }
}