Completions
POST
Generate text continuations from one or more prompts. Best for simple text generation, autocomplete, and single-turn tasks.
Image inputs, structured chat messages, reasoning controls, structured outputs, and tools require Chat Completions.
Request
Headers
The media type of the request body.Possible values:
application/json, application/vnd.msgpackDefault: application/jsonSee Payload Optimization for details.The compression encoding applied to the request body.Possible values:
gzipWhen set, the request body must be gzip-compressed. Can be combined with any supported Content-Type.See Payload Optimization for details.Body
The prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays.
The model to use for completion. See Supported Models for a list of available models.
Streams partial completion data as data-only server-sent events as tokens become available. The stream ends with a
data: [DONE] message.Default: falseThe maximum number of tokens that can be generated in the completion. The total length of input tokens and generated tokens is limited by the model’s context length.Default:
nullThe minimum number of tokens to generate for a completion. If not specified or set to 0, the model will generate as many tokens as it deems necessary. Setting to -1 sets to max sequence length.Default:
nullMakes a best effort to sample deterministically so repeated requests with the same
seed and parameters return the same result. Determinism is not guaranteed.Default: nullUp to four sequences that cause the API to stop generating further tokens. The returned text does not contain the stop sequence.Default:
nullSampling temperature between 0 and 2. Higher values, such as 0.8, make output more random; lower values, such as 0.2, make it more focused and deterministic. We recommend changing either this value or
top_p, but not both.Constraints: min: 0, max: 2Default: 1Nucleus sampling parameter between 0 and 1. The model considers only tokens comprising the top
top_p probability mass. For example, 0.1 means only tokens comprising the top 10% probability mass are considered. We recommend changing either this value or temperature, but not both.Constraints: min: 0, max: 1Default: 1Returns the prompt in addition to the completion. This parameter is incompatible with
return_raw_tokens: true.Default: falseA unique identifier representing your end-user, which can help Cerebras to monitor and detect abuse.Default:
nullAn opaque identifier that groups related requests so they reuse the same prompt cache. Requests sharing the same
prompt_cache_key are routed together, which increases cache hits and reduces time to first token.Set it to a stable conversation, session, or workflow ID.Maximum length: 1024 characters.Default: nullReturns log probabilities of the output tokens.For example, if
logprobs is 5, the API returns the five most likely tokens. The API always returns the log probability of the sampled token, so there may be up to logprobs + 1 elements in the response.Constraints: min: 0, max: 20Default: nullSetting
logprobs to 0 is different from setting it to null. A value of null disables log probabilities. A value of 0 returns the sampled token’s log probability without alternative token log probabilities.Completion Response
Identifies the backend configuration used by the model. Use it with the
seed request parameter to determine whether backend changes might affect determinism.
