Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your Writer API key.
Body
The ID of the model to use for creating the chat completion. Supports palmyra-x5
, palmyra-x4
, palmyra-fin
, palmyra-med
, palmyra-creative
, and palmyra-x-003-instruct
.
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.
1
Defines the maximum number of tokens (words and characters) that the model can generate in the response. This can be adjusted to allow for longer or shorter responses as needed. The maximum value varies by model. See the models overview for more information about the maximum number of tokens for each model.
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.
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.
Specifies the number of completions (responses) to generate from the model in a single request. This parameter allows for generating multiple responses, offering a variety of potential replies from which to choose.
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.
Specifies whether to return log probabilities of the output tokens.
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.
An array containing tool definitions for tools that the model can use to generate responses. The tool definitions use JSON schema. You can define your own functions or use one of the built-in graph
, llm
, translation
, or vision
tools. Note that you can only use one built-in tool type in the array (only one of graph
, llm
, translation
, or vision
). You can pass multiple custom tools of type function
in the same request.
Configure how the model will call functions:
auto
: allows the model to automatically choose the tool to use, or not call a toolnone
: disables tool calling; the model will instead generate a messagerequired
: requires the model to call one or more tools
You can also use a JSON object to force the model to call a specific tool. For example, {"type": "function", "function": {"name": "get_current_weather"}}
requires the model to call the get_current_weather
function, regardless of the prompt.
Additional options for streaming.
The response format to use for the chat completion, available with palmyra-x4
and palmyra-x5
.
text
is the default response format. JSON Schema is supported for structured responses. If you specify json_schema
, you must also provide a json_schema
object.
Response
Successful response
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.
The type of object returned, which is always chat.completion
for chat responses.
chat.completion
An array of objects representing the different outcomes or results produced by the model based on the input provided.
1
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.
Identifies the specific model used to generate the response.
Usage information for the chat completion response. Please note that at this time Knowledge Graph tool usage is not included in this object.
A string representing the backend configuration that the model runs with.
The service tier used for processing the request.