Skip to navigation

Create Chat Completion

Generate the next assistant message for a conversation. The request and response follow the OpenAI Chat Completions shape.

Authentication

AuthorizationBearer

Your Reka API key, sent as Authorization: Bearer <key>.

Request

This endpoint expects an object.
modelstringRequired

A model ID from GET /v1/models, such as reka-flash-3. IDs have no namespace prefix.

messageslist of objectsRequired
The conversation so far.
streambooleanOptionalDefaults to false

Return the response as server-sent events. Usage totals arrive on the final chunk.

max_tokensintegerOptional
Maximum number of tokens to generate, capped by the model's maximum output length.
temperaturedoubleOptional
Sampling temperature. Lower values give more predictable output.
top_pdoubleOptional
Nucleus sampling probability mass.
top_kintegerOptional

Only sample from the top_k most likely tokens. Honored by models that list it in supported_sampling_parameters.

stopstring or list of stringsOptional
A string or list of strings that end generation.
seedintegerOptional

Random seed. Honored by models that list it in supported_sampling_parameters.

frequency_penaltydoubleOptional

Penalize tokens by how often they have appeared. Honored by models that list it in supported_sampling_parameters.

presence_penaltydoubleOptional

Penalize tokens that have already appeared. Honored by models that list it in supported_sampling_parameters.

toolslist of objectsOptional

Functions the model may call. Supported by models that list tools in supported_features.

tool_choiceenumOptional

auto lets the model decide, none disables tool calls, required forces at least one call. Defaults to auto when tools is set.

Allowed values:
response_formatobjectOptional

Constrain the output to a JSON schema. Supported by models that list structured_outputs in supported_features.

logprobsbooleanOptional

Return log probabilities of the output tokens. Supported by models that list logprobs in supported_features.

Response

The completion. With stream set to true, the body is a stream of server-sent events, each carrying a chat.completion.chunk object.

idstring
objectstring

chat.completion, or chat.completion.chunk for streamed events.

createdinteger
Unix timestamp in seconds.
modelstring
choiceslist of objects
usageobjectOptional
metadataobjectOptional

Errors

400
Bad Request Error
401
Unauthorized Error
404
Not Found Error
429
Too Many Requests Error