Cerebras ChatCompletion

Cerebras ChatCompletion

Certified

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.

yaml
type: io.kestra.plugin.cerebras.ChatCompletion

Generate a completion with Cerebras.

yaml
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.

yaml
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

Cerebras API key

Sent as a Bearer token. Store it in a secret, e.g. {{ secret('CEREBRAS_API_KEY') }}.

SubTypeobject

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 ID

Cerebras model identifier, e.g. gpt-oss-120b. Use the models listed in the Cerebras docs.

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.

Definitions
assetFailureBehaviorstring
Possible Values
IGNOREFAILWARN

Asset 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.

enableAutobooleanstring

Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.

inputsarray

The assets consumed as inputs.

id*string
Min length1
typestring
outputs

The assets produced as outputs.

id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*string
Min length1

Custom asset type

descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
Defaulthttps://api.cerebras.ai/v1

Cerebras API base URL

Defaults to https://api.cerebras.ai/v1. Override it to target a different Cerebras-compatible endpoint.

Max completion tokens

Upper bound on generated tokens, including reasoning tokens when the model uses them.

Reasoning effort

Reasoning effort for models that support it, e.g. low, medium or high. Accepted values depend on the model.

Response format

Forwarded as response_format, e.g. {type: json_schema, json_schema: {...}} for structured output.

Seed

Best-effort deterministic sampling.

SubTypestring

Stop sequences

Generation stops when one of these sequences is produced.

Stream the response

When true, the task consumes the full stream, concatenates the deltas and returns one final output. There is no incremental output.

Sampling temperature

Higher values increase randomness. Not sent when unset.

Tool choice

auto, none, required, or the name of a function from tools to force that function.

SubTypeobject

Tools

Tool definitions forwarded as tools, in the Chat Completions format (type: function with a function object).

Top-p nucleus sampling

Not sent when unset.

Generated text

Content of the first choice. Null when the model only returned tool calls.

Finish reason

Why generation stopped, e.g. stop, length or tool_calls.

Completion ID

Model used

Tool calls requested by the model

Empty when the model did not request any tool call.

Definitions
argumentsstring

Function arguments

JSON-encoded arguments, as returned by the model.

idstring

Tool call ID

namestring

Function name

Token usage

Definitions
completionTokensinteger

Completion tokens

promptTokensinteger

Prompt tokens

totalTokensinteger

Total tokens

Unittokens

Number of completion tokens.

Unittokens

Number of prompt tokens.

Unittokens

Total number of tokens.