Skip to main content
You can enable any compatible chat model to call your own functions by including a tools array in your request to POST /v1/chat/completions. Instead of returning a plain text reply, the model will return structured JSON arguments matching the schema you define — it is your responsibility to execute the function and, if needed, send the result back in a follow-up message.
For a deeper conceptual overview of how function calling works, see the OpenAI Function Calling Guide.

Request

POST https://kiosapi.com/v1/chat/completions

Headers

Request Body

string
required
The model to use for the request (e.g. gpt-4o).
array
required
An array of message objects representing the conversation history so far.
array
required
An array of tool definitions that the model may call. Each element describes one callable function.

Example Request

Response

When the model decides to call a function, the response contains a tool_calls array in the message object rather than a text content value.

Response Fields

array
Present when the model wants to invoke one or more functions. Each element contains an id, a type of "function", and a function object with name and arguments (a JSON-encoded string).
string
Set to "tool_calls" when the model is requesting a function invocation rather than producing a final text response.
When finish_reason is "tool_calls", you should parse the arguments string, execute the function on your end, and send the result back to the model in a new message with role: "tool". The model will then produce its final response based on that result.