Skip to main content
The Chat completion API generates responses based on a given conversation. It supports both text-based and multimodal inputs.
Please see the Text generation capabilities document for additional usage information.

Endpoint

For SambaStack, developers should check with their system administrator for the correct URL.

Request parameters

The following table outlines the parameters required to make a chat completion request, parameter type, and description.

Required parameters

Message object structure

Each message object within the messages array consists of role and content.

Example string content

Example multimodal content

Optional parameters

The following table outlines the optional parameters that can be used to fine-tune the model’s behavior. You can see the parameter type, description, and default values.

Function calling parameters

Models that support function calling will have the following three parameters available to use. You can find detailed information about these parameters and supported models on the function calling page.

Example usage of tools parameter

The following table outlines the structure of the tools parameter.

Accepted values for tool choice

The following table illustrates how the tool_choice parameter controls the model’s interaction with external functions.

Example requests

Below is a sample request body for a streaming response for a text model.
Example text model request

Example response format

The API returns a chat completion object , or a streamed sequence of chat completion chunk objects, if the request is streamed.

Chat completion response

Represents a chat completion response returned by model, based on the provided input.
Chat completing response

Streaming response (chunked)

Represents a streaming response (chunked) returned by model, based on the provided input.
Streaming chat response (chunked)

Response fields

The following table provides a list of key properties, parameter type, and description.
If a request fails, the response body provides a JSON object with details about the error. For more information on errors, please see the API error codes page.