TheDocumentation Index
Fetch the complete documentation index at: https://docs.tokmodel.com/llms.txt
Use this file to discover all available pages before exploring further.
/v1/chat/completions endpoint accepts a conversation as an array of messages and returns a model-generated response. It is fully compatible with the OpenAI Chat Completions API, so any client or library that targets OpenAI can be pointed at TokModel by changing only the base URL and API key. You can stream responses token-by-token using server-sent events (SSE) by setting stream to true.
Request parameters
The ID of the model to use for this request. Use the list models endpoint to retrieve available model IDs.
An array of message objects that make up the conversation. Each object must include a
role ("system", "user", or "assistant") and a content string.When
true, the response is streamed as server-sent events. Each event contains a partial ChatCompletionChunk object. The stream terminates with data: [DONE].Sampling temperature between
0 and 2. Lower values produce more deterministic output; higher values produce more varied output. Avoid setting both temperature and top_p at the same time.The maximum number of tokens to generate in the response. The model will stop once this limit is reached, even if the response is incomplete.
Nucleus sampling parameter. The model considers only the tokens comprising the top
top_p probability mass. A value of 0.1 means only the top 10% of probability mass is considered.How many independent completion choices to generate for each request. Each choice is billed separately.
One or more sequences at which the model will stop generating further tokens. The stop sequence itself is not included in the response.
Response fields
A unique identifier for this completion, prefixed with
chatcmpl-.Always
"chat.completion".Unix timestamp (seconds) of when the completion was created.
The model that was used to generate the response.
An array of completion choices. Contains
n items when n is set.Token usage for the request.