Usage
Revised
Ollama's API responses include metrics that can be used for measuring performance and model usage:
total_duration: How long the response took to generateload_duration: How long the model took to loadprompt_eval_count: How many input tokens were in the promptprompt_eval_cached_count: How many prompt tokens were read from the cacheprompt_eval_duration: How long it took to evaluate the uncached prompt tokenseval_count: How many output tokens were processed1eval_duration: How long it took to generate the output tokens
All timing values are measured in nanoseconds.
Example response
For endpoints that return usage metrics, the response body includes2 the usage fields. For example, a nonstreaming3 call to /api/generate may return the following response:
{
"model": "gemma4",
"created_at": "2025-10-17T23:14:07.414671Z",
"response": "Hello! How can I help you today?",
"done": true,
"done_reason": "stop",
"total_duration": 174560334,
"load_duration": 101397084,
"prompt_eval_count": 11,
"prompt_eval_cached_count": 8,
"prompt_eval_duration": 13074791,
"eval_count": 18,
"eval_duration": 52479709
}
For endpoints that return streaming responses, usage fields are included as part of the final chunk, where done is true.
Notes on this page
1 Wording Audit: improved Fixes a typo: the field counts tokens that were processed.
Was:
processesusage-nonstandard-words2 Wording Audit: improved Uses the present tense for what is true now.
Was:
will includevoice-present-tense3 Wording Audit: improved Closes the prefix.
Was:
non-streamingClosedPrefixes
Original
Ollama's API responses include metrics that can be used for measuring performance and model usage:
total_duration: How long the response took to generateload_duration: How long the model took to loadprompt_eval_count: How many input tokens were in the promptprompt_eval_cached_count: How many prompt tokens were read from the cacheprompt_eval_duration: How long it took to evaluate the uncached prompt tokenseval_count: How many output tokens were processeseval_duration: How long it took to generate the output tokens
All timing values are measured in nanoseconds.
Example response
For endpoints that return usage metrics, the response body will include the usage fields. For example, a non-streaming call to /api/generate may return the following response:
{
"model": "gemma4",
"created_at": "2025-10-17T23:14:07.414671Z",
"response": "Hello! How can I help you today?",
"done": true,
"done_reason": "stop",
"total_duration": 174560334,
"load_duration": 101397084,
"prompt_eval_count": 11,
"prompt_eval_cached_count": 8,
"prompt_eval_duration": 13074791,
"eval_count": 18,
"eval_duration": 52479709
}
For endpoints that return streaming responses, usage fields are included as part of the final chunk, where done is true.
What Changed
A typo in the eval_count entry is fixed, one verb moves to the present tense, and a hyphenated prefix is closed. The field list and example are unchanged.
Content type: reference. The page lists the usage metric fields a response returns, with their meaning and an example.
Automated check, original: 0 errors, 1 warnings, 0 suggestions. Revised: 0 errors, 0 warnings, 0 suggestions.
Independent audit (GPT-6): improved. The revision fixes a typo and makes two wording edits that preserve the meaning. It could make the example heading more descriptive, as the standard requires.
What the revision missed:
- The heading “Example response” does not say what is under it; the standard calls for descriptive headings.