v9

latestOpenAPI 3.1.0MITraw.githubusercontent.com2026-07-21123457.5 KB

Generate a response

Generates a response for the provided prompt

post/api/generate

Request body

modelstring required

Model name

promptstring

Text for the model to generate a response from

suffixstring

Used for fill-in-the-middle models, text that appears after the user prompt and before the model response

imagesstring[]
systemstring

System prompt for the model to generate a response from

streamboolean

When true, returns a stream of partial responses

rawboolean

When true, returns the raw response from the model without any prompt templating

logprobsboolean

Whether to return log probabilities of the output tokens

top_logprobsinteger

Number of most likely tokens to return at each token position when logprobs are enabled

Response

Generation responses

modelstring

Model name

created_atstring

ISO 8601 timestamp of response creation

responsestring

The model's generated text response

thinkingstring

The model's generated thinking output

doneboolean

Indicates whether generation has finished

done_reasonstring

Reason the generation stopped

total_durationinteger

Time spent generating the response in nanoseconds

load_durationinteger

Time spent loading the model in nanoseconds

prompt_eval_countinteger

Number of input tokens in the prompt

prompt_eval_durationinteger

Time spent evaluating the prompt in nanoseconds

eval_countinteger

Number of output tokens generated in the response

eval_durationinteger

Time spent generating tokens in nanoseconds

All 12 operations