POST
/
v1
/
chat

Authorizations

Authorization
string
headerrequired

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
model
string
default: palmyra-x-004required

Specifies the model to be used for generating responses. The chat model is always palmyra-x-004 for conversational use.

messages
object[]
required

An array of message objects that form the conversation history or context for the model to respond to. The array must contain at least one message.

max_tokens
integer
default: 16

Defines the maximum number of tokens (words and characters) that the model can generate in the response. The default value is set to 16, but it can be adjusted to allow for longer or shorter responses as needed.

temperature
number
default: 1

Controls the randomness or creativity of the model's responses. A higher temperature results in more varied and less predictable text, while a lower temperature produces more deterministic and conservative outputs.

top_p
number

Sets the threshold for "nucleus sampling," a technique to focus the model's token generation on the most likely subset of tokens. Only tokens with cumulative probability above this threshold are considered, controlling the trade-off between creativity and coherence.

n
integer

Specifies the number of completions (responses) to generate from the model in a single request. This parameter allows multiple responses to be generated, offering a variety of potential replies from which to choose.

stop

A token or sequence of tokens that, when generated, will cause the model to stop producing further content. This can be a single token or an array of tokens, acting as a signal to end the output.

logprobs
boolean
default: false

Specifies whether to return log probabilities of the output tokens.

stream
boolean

Indicates whether the response should be streamed incrementally as it is generated or only returned once fully complete. Streaming can be useful for providing real-time feedback in interactive applications.

tools
object[]

[Beta] An array of tools described to the model using JSON schema that the model can use to generate responses. Please note that tool calling is in beta and subject to change. Passing graph IDs will automatically use the Knowledge Graph tool.

tool_choice
object

Configure how the model will call functions: auto will allow the model to automatically choose the best tool, none disables tool calling. You can also pass a specific previously defined function as a string.

stream_options
object

Additional options for streaming.

Response

200 - application/json
id
string
required

A globally unique identifier (UUID) for the response generated by the API. This ID can be used to reference the specific operation or transaction within the system for tracking or debugging purposes.

object
string
required

The type of object returned, which is always chat.completion for chat responses.

choices
object[]
required

An array of objects representing the different outcomes or results produced by the model based on the input provided.

created
integer
required

The Unix timestamp (in seconds) when the response was created. This timestamp can be used to verify the timing of the response relative to other events or operations.

model
string
required

Identifies the specific model used to generate the response.

usage
object

Usage information for the chat completion response. Please note that at this time Knowledge Graph tool usage is not included in this object.

system_fingerprint
string

A string representing the backend configuration that the model runs with.

service_tier
string

The service tier used for processing the request.