---
title: "Create chat completion"
method: POST
path: "/v1/chat/completions"
tags: ["Chat"]
---

# Create chat completion

`POST /v1/chat/completions`

## Request

- Base URL: `https://api.neosantara.xyz`
- URL: `https://api.neosantara.xyz/v1/chat/completions`
- Auth: HTTP bearer

Creates a model response for the given chat conversation. Supports sseStreaming and tool calling.

## Request body

- object
  - `model` string, required
  - `messages` object[], required
    - `role` 'system' | 'developer' | 'user' | 'assistant' | 'tool' | 'function', required
    - `content` union
      - string
      - union[]
        - union
          - object
            - `type` 'text', required
            - `text` string
          - object
            - `type` 'input_text', required
            - `text` string
          - object
            - `type` 'image_url', required
            - `image_url` union, required
              - …
          - object
            - `type` 'input_image', required
            - `image_url` union, required
              - …
          - object
            - `type` 'file', required
            - `file` object
              - …
            - `file_url` object
              - …
    - `name` string
    - `tool_call_id` string
    - `tool_calls` object[]
      - `id` string
      - `index` number
      - `type` string
      - `function` object, required
        - `name` string, required
        - `arguments` string, required
  - `temperature` number
  - `top_p` number
  - `n` integer
  - `stop` union
    - string
    - string[]
  - `max_tokens` integer
  - `max_completion_tokens` integer
  - `max_output_tokens` integer
  - `stream` boolean
  - `stream_options` object, nullable
    - `include_usage` boolean
    - `include_obfuscation` boolean
  - `presence_penalty` number
  - `frequency_penalty` number
  - `modalities` string[]
  - `audio` object
    - `voice` string, required
    - `format` 'wav' | 'mp3' | 'flac' | 'opus' | 'pcm16', required
  - `prediction` object
    - `type` 'content', required
    - `content` union, required
      - string
      - unknown[]
        - unknown
  - `metadata` object
  - `store` boolean
  - `prompt_cache_key` string
  - `prompt_cache_retention` 'in-memory' | '24h'
  - `reasoning_effort` 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'
  - `verbosity` 'low' | 'medium' | 'high'
  - `service_tier` 'auto' | 'default' | 'flex' | 'priority' | 'scale'
  - `response_format` object
    - `type` 'text' | 'json_object' | 'json_schema', required
    - `json_schema` unknown
  - `tools` union[]
    - union
      - object
        - `type` 'function', required
        - `function` object, required
          - `name` string, required
          - `description` string
          - `parameters` object
          - `strict` boolean
          - `requires_confirmation` boolean
          - `external_execution` boolean
      - object
        - `type` 'web_search', required
        - `function` object
          - `name` string, required
          - `description` string
          - `parameters` object
          - `strict` boolean
          - `requires_confirmation` boolean
          - `external_execution` boolean
        - `name` string
        - `display_height_px` number
        - `display_width_px` number
        - `display_number` number
      - object
        - `type` 'bash', required
        - `function` object
          - `name` string, required
          - `description` string
          - `parameters` object
          - `strict` boolean
          - `requires_confirmation` boolean
          - `external_execution` boolean
        - `name` string
        - `display_height_px` number
        - `display_width_px` number
        - `display_number` number
      - object
        - `type` 'computer', required
        - `function` object
          - `name` string, required
          - `description` string
          - `parameters` object
          - `strict` boolean
          - `requires_confirmation` boolean
          - `external_execution` boolean
        - `name` string
        - `display_height_px` number
        - `display_width_px` number
        - `display_number` number
      - object
        - `type` 'text_editor_20241022', required
        - `function` object
          - `name` string, required
          - `description` string
          - `parameters` object
          - `strict` boolean
          - `requires_confirmation` boolean
          - `external_execution` boolean
        - `name` string
        - `display_height_px` number
        - `display_width_px` number
        - `display_number` number
      - object
        - `type` 'file_generation', required
        - `function` object
          - `name` string, required
          - `description` string
          - `parameters` object
          - `strict` boolean
          - `requires_confirmation` boolean
          - `external_execution` boolean
        - `name` string
        - `display_height_px` number
        - `display_width_px` number
        - `display_number` number
      - object
        - `type` 'mcp', required
        - `server_url` string, uri
        - `url` string, uri
        - `server_label` string
        - `name` string
        - `authorization_token` string
        - `headers` object
        - `allowed_tools` string[]
        - `require_approval` unknown
  - `functions` object[]
    - `name` string, required
    - `description` string
    - `parameters` object
    - `strict` boolean
    - `requires_confirmation` boolean
    - `external_execution` boolean
  - `mcp_servers` object[]
    - `type` 'url'
    - `url` string, uri, required
    - `name` string, required
    - `authorization_token` string
    - `allowed_tools` string[]
  - `tool_choice` union
    - 'none' | 'auto' | 'required'
    - object
      - `type` 'function', required
      - `function` object, required
        - `name` string, required
    - object
      - `type` 'allowed_tools', required
      - `tools` object[], required
        - `type` 'function', required
        - `name` string, required
      - `mode` 'none' | 'auto' | 'required'
  - `parallel_tool_calls` boolean
  - `max_tool_calls` integer
  - `reasoning` object
    - `enabled` boolean
    - `effort` 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'
    - `max_tokens` integer
  - `web_search_options` unknown
  - `user` string
  - `seed` integer
  - `repetition_penalty` number
  - `top_k` integer
  - `min_p` number
  - `echo` boolean
  - `logit_bias` object
  - `logprobs` boolean
  - `top_logprobs` integer

## Response `200`

Successful response

- object
  - `id` string, required
  - `object` 'chat.completion', required
  - `created` number, required
  - `model` string, required
  - `choices` unknown[], required
    - unknown
  - `usage` unknown

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `404`: Model Not Found

## Changes

- **2026-11-03** `f87af696a63e`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/neosantara/apis/neosantara-ai-api/changes/v1/chat/completions/post.md)

---

[API](https://skmtc.dev/neosantara/apis/neosantara-ai-api.md) - [All operations](https://skmtc.dev/neosantara/apis/neosantara-ai-api/llms.txt) - [OpenAPI document](https://skmtc.dev/neosantara/apis/neosantara-ai-api/revisions/f87af696a63e?raw)
