Docs menu · Reference

Runs a text-generation request against a local or cloud model and returns the completion, the reason generation stopped, and the provider-reported prompt and completion token counts. The request controls the maximum completion tokens, sampling temperature, top-k and top-p cutoffs, an optional deterministic seed, string and token-id stop sequences, and an optional GBNF grammar for constrained generation. Chat models expect their chat template already applied in the prompt. Local models require a build with the local execution feature; cloud providers require the matching provider feature and an API key.

Parameters

NameTypeRequiredDescription
modelstringyesModel spec.
frequency_penaltynumbernoFrequency penalty.
grammarstringnoGBNF grammar for constrained generation (local).
logit_biasobjectnoPer-token logit bias (token id → bias).
logprobsbooleannoWhether to return log-probabilities.
max_tokensintegernoMaximum completion tokens.
messagesChatMessage[]noChat messages (system/user/assistant/tool).
min_pnumbernoMin-p sampling cutoff.
mirostatMirostatnoMirostat sampling.
model_configModelConfignoPer-model load/context configuration.
presence_penaltynumbernoPresence penalty.
promptstringnoRaw completion prompt (base models / full control).
repeat_last_nintegernoRepetition penalty look-back window.
repeat_penaltynumbernoRepetition penalty.
response_formatResponseFormatnoOutput format constraint.
seedintegernoDeterministic sampling seed.
stopstring[]noStop sequences.
stop_token_idsinteger[]noToken-id stop sequences (local).
temperaturenumbernoSampling temperature.
tfs_znumbernoTail-free sampling z.
tool_choiceToolChoicenoHow the model should choose among tools.
toolsTool[]noTools (functions) the model may call.
top_kintegernoTop-k sampling cutoff.
top_logprobsintegernoNumber of top log-probabilities to return per token.
top_pnumbernoNucleus sampling cutoff.
typical_pnumbernoTypical-p (locally typical) sampling.

Returns

ChatResponse.

Errors

Invocation

  • CLI: strata inference generate
  • Wire type: inference_generate

agents: this page as markdown → /docs/reference/inference/generate.md