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

thinkboolean

When true, returns separate thinking output in addition to content

rawboolean

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

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

Changes