I have read and followed all the instructions provided in the README.md.
I am on the latest version of both Open WebUI and Ollama.
I have included the browser console logs.
I have included the Docker container logs.
I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below.
Description
Bug Summary:
I have enabled the Usage capability in the model configuration. I can see the metrics in the UI. However, when I send a request to the model using the API:
The response does not present the usage field anymore. This is the response I got from the previous CURL command:
{"id":"qwen2.5-coder:1.5b-42777d3f-5429-4f7b-9bed-35f2516f823c","created":1736846829,"model":"qwen2.5-coder:1.5b","choices":[{"index":0,"logprobs":null,"finish_reason":"stop","message":{"content":"Hello! How can I assist you today?","role":"assistant"}}],"object":"chat.completion"}
Reproduction Details
Steps to Reproduce:
1 - Send request to OpenwebUI API:
This is affecting to the Langfuse pipeline since it is not receiving the usage data.
Originally created by @alejandrods on GitHub (Jan 14, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/8548
## Environment
- **Open WebUI Version:** v0.5.4
- **Ollama (if applicable):** 0.5.5
- **Operating System:** Mac (Sonoma 14.7)
**Confirmation:**
- [x] I have read and followed all the instructions provided in the README.md.
- [x] I am on the latest version of both Open WebUI and Ollama.
- [x] I have included the browser console logs.
- [x] I have included the Docker container logs.
- [x] I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below.
## Description
**Bug Summary:**
I have enabled the `Usage` capability in the model configuration. I can see the metrics in the UI. However, when I send a request to the model using the API:
```bash
curl -X POST http://localhost:3000/api/chat/completions \
-H "Authorization: Bearer API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen2.5-coder:1.5b",
"messages": [
{
"role": "user",
"content": "Hello"
}
]
}'
```
The response does not present the `usage` field anymore. This is the response I got from the previous CURL command:
```json
{"id":"qwen2.5-coder:1.5b-42777d3f-5429-4f7b-9bed-35f2516f823c","created":1736846829,"model":"qwen2.5-coder:1.5b","choices":[{"index":0,"logprobs":null,"finish_reason":"stop","message":{"content":"Hello! How can I assist you today?","role":"assistant"}}],"object":"chat.completion"}
```
## Reproduction Details
**Steps to Reproduce:**
1 - Send request to OpenwebUI API:
```bash
curl -X POST http://localhost:3000/api/chat/completions \
-H "Authorization: Bearer API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen2.5-coder:1.5b",
"messages": [
{
"role": "user",
"content": "Hello"
}
]
}'
```
## Logs and Screenshots


## Additional Information
This is affecting to the Langfuse pipeline since it is not receiving the usage data.
API: i have a previus working agent build upon langchain that was usign the OpenAI apis and now it that stopped working because the usage field disappeared.
Function: I also have a filter function that was counting the token after each model usage to have a sort of overview on the general usage that also stopped working for the same problem. The response message in the outlet method has no more the usage field
<!-- gh-comment-id:2611146436 -->
@Seniorsimo commented on GitHub (Jan 23, 2025):
I'm facing the same problem:
API: i have a previus working agent build upon langchain that was usign the OpenAI apis and now it that stopped working because the usage field disappeared.
Function: I also have a filter function that was counting the token after each model usage to have a sort of overview on the general usage that also stopped working for the same problem. The response message in the outlet method has no more the usage field
Should be resolved with 8727b91664, testing wanted here.
<!-- gh-comment-id:2623530152 -->
@tjbck commented on GitHub (Jan 30, 2025):
Should be resolved with 8727b916642c94e18347d6e8a00f2af5e84acf1b, testing wanted here.
{"id":"qwen2.5:14b-011634f0-ced9-43cc-b6e4-d61dc7cd05d7","created":1738872260,"model":"qwen2.5:14b","choices":[{"index":0,"logprobs":null,"finish_reason":"stop","message":{"content":"Hello there! How can I assist you today? If you have any questions or need help with something, feel free to ask.","role":"assistant"}}],"object":"chat.completion","usage":{"response_token/s":63.83,"prompt_token/s":236.64,"total_duration":3438517480,"load_duration":2507632834,"prompt_eval_count":31,"prompt_eval_duration":131000000,"eval_count":27,"eval_duration":423000000,"approximate_total":"0h0m3s"}}
Unfortunatly i'm still facing problem with my langchain integration due to this because it expects "prompt_tokens", "completion_tokens" and "total_tokens" to exist in this dictionary.
<!-- gh-comment-id:2640901662 -->
@Seniorsimo commented on GitHub (Feb 6, 2025):
Tested today.
```bash
curl https://**********.com/api/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ********************" \
-d '{
"model": "pc.qwen2.5:14b",
"messages": [
{
"role": "developer",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Hello!"
}
]
}'
```
Response
```json
{
"id":"qwen2.5:14b-011634f0-ced9-43cc-b6e4-d61dc7cd05d7",
"created":1738872260,
"model":"qwen2.5:14b",
"choices":[
{
"index":0,
"logprobs":null,
"finish_reason":"stop",
"message":{
"content":"Hello there! How can I assist you today? If you have any questions or need help with something, feel free to ask.",
"role":"assistant"
}
}
],
"object":"chat.completion",
"usage":{
"response_token/s":63.83,
"prompt_token/s":236.64,
"total_duration":3438517480,
"load_duration":2507632834,
"prompt_eval_count":31,
"prompt_eval_duration":131000000,
"eval_count":27,
"eval_duration":423000000,
"approximate_total":"0h0m3s"
}
}
```
The usage statistics are present, but are different from the one that are supposed to be returned by an OpenAI compatible APIs.
As from documentation:
https://platform.openai.com/docs/api-reference/chat/create
this should be:
```json
"usage": {
"prompt_tokens": 9,
"completion_tokens": 12,
"total_tokens": 21,
"completion_tokens_details": {
"reasoning_tokens": 0,
"accepted_prediction_tokens": 0,
"rejected_prediction_tokens": 0
}
}
```
Unfortunatly i'm still facing problem with my langchain integration due to this because it expects "prompt_tokens", "completion_tokens" and "total_tokens" to exist in this dictionary.
This should works in theory
```python
"prompt_tokens": int(data.get("prompt_eval_count", 0)),
"completion_tokens": int(data.get("eval_count", 0)),
"total_tokens": int(
data.get("prompt_eval_count", 0) + data.get("eval_count", 0)
)
```
But I'm not sure if ollama has something equivalent for the "completion_tokens_details" dictionary 🤔
Made the changes myself today :)
https://github.com/open-webui/open-webui/pull/9655
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @alejandrods on GitHub (Jan 14, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/8548
Environment
Open WebUI Version: v0.5.4
Ollama (if applicable): 0.5.5
Operating System: Mac (Sonoma 14.7)
Confirmation:
Description
Bug Summary:
I have enabled the
Usagecapability in the model configuration. I can see the metrics in the UI. However, when I send a request to the model using the API:The response does not present the
usagefield anymore. This is the response I got from the previous CURL command:Reproduction Details
Steps to Reproduce:
1 - Send request to OpenwebUI API:
Logs and Screenshots
Additional Information
This is affecting to the Langfuse pipeline since it is not receiving the usage data.
@Seniorsimo commented on GitHub (Jan 23, 2025):
I'm facing the same problem:
API: i have a previus working agent build upon langchain that was usign the OpenAI apis and now it that stopped working because the usage field disappeared.
Function: I also have a filter function that was counting the token after each model usage to have a sort of overview on the general usage that also stopped working for the same problem. The response message in the outlet method has no more the usage field
@tjbck commented on GitHub (Jan 30, 2025):
Should be resolved with
8727b91664, testing wanted here.@Seniorsimo commented on GitHub (Feb 6, 2025):
Tested today.
Response
The usage statistics are present, but are different from the one that are supposed to be returned by an OpenAI compatible APIs.
As from documentation:
https://platform.openai.com/docs/api-reference/chat/create
this should be:
Unfortunatly i'm still facing problem with my langchain integration due to this because it expects "prompt_tokens", "completion_tokens" and "total_tokens" to exist in this dictionary.
This should works in theory
But I'm not sure if ollama has something equivalent for the "completion_tokens_details" dictionary 🤔
Made the changes myself today :)
https://github.com/open-webui/open-webui/pull/9655