Usage


目录

Ollama's API responses include metrics that can be used for measuring performance and model usage:

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.


版本号 #2
由 壳壳虫 创建于 2026-10-31 13:16:34 UTC
由 壳壳虫 更新于 2026-10-31 13:16:34 UTC