
Cerebras ChatCompletion
CertifiedGenerate a chat completion with Cerebras
Cerebras ChatCompletion
Generate a chat completion with Cerebras
Calls the Cerebras Chat Completions API (POST /chat/completions). Optional parameters are only sent when set, so Cerebras remains the authority on what each model supports. With stream: true the task consumes the whole stream and returns one final output with the same shape as the non-streamed call.
type: io.kestra.plugin.cerebras.ChatCompletionExamples
Generate a completion with Cerebras.
id: cerebras_chat
namespace: company.team
inputs:
- id: prompt
type: STRING
defaults: "Summarize the benefits of fast AI inference in 3 bullet points."
tasks:
- id: generate
type: io.kestra.plugin.cerebras.ChatCompletion
apiKey: "{{ secret('CEREBRAS_API_KEY') }}"
model: gpt-oss-120b
messages:
- role: user
content: "{{ inputs.prompt }}"
temperature: 0.7
maxCompletionTokens: 512
- id: log
type: io.kestra.plugin.core.log.Log
message: "{{ outputs.generate.content }}"
Let the model call a function and read the requested call from the output.
id: cerebras_tools
namespace: company.team
tasks:
- id: ask
type: io.kestra.plugin.cerebras.ChatCompletion
apiKey: "{{ secret('CEREBRAS_API_KEY') }}"
model: gpt-oss-120b
messages:
- role: user
content: "What is the weather in Paris?"
toolChoice: auto
tools:
- type: function
function:
name: get_weather
description: Get the current weather for a city
parameters:
type: object
properties:
city:
type: string
required:
- city
- id: log
type: io.kestra.plugin.core.log.Log
message: "{{ outputs.ask.toolCalls[0].arguments }}"
Properties
apiKey *string
Cerebras API key
Sent as a Bearer token. Store it in a secret, e.g. {{ secret('CEREBRAS_API_KEY') }}.
messages *array
Messages
List of messages sent as-is to the API. Each message needs a role (system, user, assistant or tool) and its content; other fields such as tool_call_id are forwarded unchanged.
model *string
Model ID
Cerebras model identifier, e.g. gpt-oss-120b. Use the models listed in the Cerebras docs.
assets
Assets this task consumes as inputs or produces as outputs, for lineage tracking and the asset graph (Enterprise Edition). A flow declaring this property on a task is rejected in the open-source edition.
io.kestra.core.models.assets.AssetsDeclaration
IGNOREFAILWARNAsset failure behavior
Behavior applied to the task state when a declared asset fails to render, emit, or be persisted (e.g. a lock conflict): FAIL escalates it to FAILED, WARN (default) warns it if it would otherwise succeed, IGNORE leaves the state untouched.
Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.
The assets consumed as inputs.
io.kestra.core.models.assets.AssetIdentifier
1The assets produced as outputs.
io.kestra.plugin.ee.assets.Dataset
1150{}1150io.kestra.plugin.ee.assets.File
1150{}1150io.kestra.plugin.ee.assets.Table
1150{}1150io.kestra.plugin.ee.assets.VM
1150{}1150io.kestra.core.models.assets.External
1150{}1150io.kestra.core.models.assets.Custom
11501Custom asset type
{}1150baseUrl string
https://api.cerebras.ai/v1Cerebras API base URL
Defaults to https://api.cerebras.ai/v1. Override it to target a different Cerebras-compatible endpoint.
maxCompletionTokens integerstring
Max completion tokens
Upper bound on generated tokens, including reasoning tokens when the model uses them.
reasoningEffort string
Reasoning effort
Reasoning effort for models that support it, e.g. low, medium or high. Accepted values depend on the model.
responseFormat object
Response format
Forwarded as response_format, e.g. {type: json_schema, json_schema: {...}} for structured output.
seed integerstring
Seed
Best-effort deterministic sampling.
stop array
Stop sequences
Generation stops when one of these sequences is produced.
stream booleanstring
Stream the response
When true, the task consumes the full stream, concatenates the deltas and returns one final output. There is no incremental output.
temperature numberstring
Sampling temperature
Higher values increase randomness. Not sent when unset.
toolChoice string
Tool choice
auto, none, required, or the name of a function from tools to force that function.
tools array
Tools
Tool definitions forwarded as tools, in the Chat Completions format (type: function with a function object).
topP numberstring
Top-p nucleus sampling
Not sent when unset.
Outputs
content string
Generated text
Content of the first choice. Null when the model only returned tool calls.
finishReason string
Finish reason
Why generation stopped, e.g. stop, length or tool_calls.
id string
Completion ID
model string
Model used
toolCalls array
Tool calls requested by the model
Empty when the model did not request any tool call.
io.kestra.plugin.cerebras.ChatCompletion-Output-ToolCall
Function arguments
JSON-encoded arguments, as returned by the model.
Tool call ID
Function name
usage
Token usage
io.kestra.plugin.cerebras.ChatCompletion-Output-Usage
Completion tokens
Prompt tokens
Total tokens
Metrics
usage.completion.tokens counter
tokensNumber of completion tokens.
usage.prompt.tokens counter
tokensNumber of prompt tokens.
usage.total.tokens counter
tokensTotal number of tokens.