POST
/
chat
/
completions
Create chat completion
curl --request POST \
  --url https://api.neosantara.xyz/v1/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "<string>",
  "messages": [
    {
      "role": "system",
      "content": "<string>",
      "name": "<string>",
      "tool_call_id": "<string>"
    }
  ],
  "temperature": 0.7,
  "max_tokens": 1000,
  "stream": false,
  "n": 1,
  "top_p": 1,
  "frequency_penalty": 0,
  "presence_penalty": 0,
  "response_format": {
    "type": "text"
  },
  "functions": [
    {
      "name": "<string>",
      "description": "<string>",
      "parameters": {}
    }
  ],
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "<string>",
        "description": "<string>",
        "parameters": {}
      }
    }
  ],
  "tool_choice": "<string>",
  "web_search": false
}'
{
  "id": "chatcmpl-12345",
  "object": "chat.completion",
  "created": 1717950000,
  "model": "nusantara-base",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "NeosantaraAI is an independent AI platform offering various models."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 15,
    "completion_tokens": 8,
    "total_tokens": 23
  }
}

Authorizations

Authorization
string
header
required

Your NeosantaraAI API Key.

Body

application/json

Response

200
application/json

Chat completion result

The response is of type object.