API Reference
Log In
API Reference

Chat completion.

Given a list of messages comprising a conversation, returns a response from the model.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Body Params
string

ID of the model to use. Defaults to "".

rag_params

Retrieval Augmented Generation params. Defaults to None (disabled).

tools
length ≥ 1

A list of tools available for the chat model to use.

enum

Controls which (if any) tool is called by the model. "none" means the model will not call any tool and instead generates a message. "auto" means the model can pick between generating a message or calling one or more tools. "required" means the model must call one or more tools. Specifying a particular tool via {"type": "function", "function": {"name": "my_function"} forces the model to call that tool. "none" is the default when no tools are present. "auto" is the default if tools are present.

number
≥ 0.001
Defaults to 0.2

What sampling temperature to use. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. Note that this parameter will be ignored for models that do not support it, such as OpenAI's reasoning models and Anthropic with extended thinking.

number
≥ 0.001
Defaults to 0.6

An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. Note that this parameter will be ignored for models that do not support it, such as OpenAI's reasoning models and Anthropic with extended thinking.

boolean
Defaults to false

If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as server-sent events (SSE) as they become available, with the stream terminated by a 'data: [DONE]' message.

integer
Defaults to 2048

The maximum number of tokens to generate in the chat completion. Must be in [1, context_length - 1). Default is 2048. The total length of input tokens and generated tokens is limited by the model's context length.

stop
length ≥ 1

A list of sequences where the API will stop generating further tokens. Note that this parameter will be ignored for models that do not support it, such as OpenAI's reasoning models.

number
Defaults to 0

Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. Note that this parameter will be ignored for models that do not support it, such as OpenAI's reasoning models.

number
Defaults to 0

Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. Note that this parameter will be ignored for models that do not support it, such as OpenAI's reasoning models.

logit_bias
object

Modify the likelihood of specified tokens appearing in the completion. Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. Note that this parameter will be ignored for models that do not support it, such as OpenAI's reasoning models.

string

Chat ID for logging. Defaults to "".

messages
array of objects
required
length ≥ 1

A list of messages comprising the conversation so far.

Messages*

An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens. Must be in [1, context_length - 1). Default is 2048. If both max_completion_tokens and max_tokens are set, max_completion_tokens will be used.

Positive non-zero integer.

integer
Defaults to 1

How many chat completion choices to generate for each input message.

string

A unique identifier representing your end-user. For monitoring and debugging purposes.

Headers
string
required

User PAT or service key.

string

User ID. Can be omitted if PAT is used as token.

string

Project ID. Can be omitted if PAT is used as token.

Responses

Language
Credentials
Bearer
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json