API Reference
Log In
API Reference

Chat Completions

Use this endpoint with chat models tailored to generate the next message in a conversation.

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

The chat model used to generate a completion.

Konko currently offers open source LLMs hosted by Konko and recommended LLMs provided by OpenAI.

See Available Models for details on which models work best for your use case.

messages
array of objects
required
length ≥ 1

A list of messages the chat model uses to generate the next completion.

See our prompting guidelines for more information.

Use the "Add" button below to add more messages. For each message added, you select one type of role for that message.

A typical conversation would start with a system and user message, then have repeating assistant and user messages.

messages*
integer | null
Defaults to 24

The chat completion's token limit, combined with input tokens, is bound by the model's context length. Different models have varying limits, with a common maximum being 2048 tokens, unless otherwise specified.

boolean | null
Defaults to false

When stream is set to True, the API sends partial message updates via HTTP streaming as they're available, useful for real-time data or large messages benefiting from incremental delivery.

number | null
0 to 2
Defaults to 1

What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.

We generally recommend altering this or top_p but not both.

number | null
0 to 1
Defaults to 1

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.

We generally recommend altering this or temperature but not both.

number | null
-2 to 2
Defaults to 0

Currently, only OpenAI provided models support frequency_penalty. Use repetition_penalty with all other models.

Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the generated text so far, decreasing the model's likelihood to repeat the same line verbatim.

number | null
-2 to 2
Defaults to 0

Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the input prompt and the generated text so far, decreasing the model's likelihood to repeat the same line verbatim.

logit_bias
object | null

Currently, only OpenAI provided models support logit_bias.

Adjusts the chances of specific tokens in the completion.

Uses a JSON object mapping tokens (by their ID) to a bias value (-100 to 100).

This bias tweaks the model's output before sampling.

Values between -1 and 1 subtly change token likelihood.

Values near -100 or 100 typically ban or exclusively pick that token.

integer | null
1 to 128
Defaults to 1

How many chat completion choices to generate for each input message.
n currently only works for OpenAI provided models.
Note that you will be charged based on the number of generated tokens across all of the choices. Keep n as 1 to minimize costs.

number | null
-2 to 2
Defaults to 0

Currently, only OpenAI provided models support presence_penalty. Use repetition_penalty with all other models.

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.

integer | null
-9223372036854776000 to 9223372036854776000

Currently, only OpenAI provided models support seed.

If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result.

Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.

Headers
string

OpenAI API key. Required for the Konko API to access the OpenAI API.

Response

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