Langfuse v3+ not displaying the cost #8382

Closed
opened 2026-02-21 18:25:23 -05:00 by yindo · 6 comments
Owner

Originally created by @DavideDelbianco on GitHub (Feb 18, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.15.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Attach LangFuse v3 to a dify workflow that uses LLM nodes and Knowledge Retrieval nodes

✔️ Expected Behavior

Every node that uses LLM:

  • Knowledge Retrieval
  • Parameter Extractor
  • LLM
    Should report the number of tokens used and the model_id of the model used

Actual Behavior

PR https://github.com/langgenius/dify/pull/13117
Supposedly fixed this issue, but in langfuse I keep seeing model_name instead of model_id and in some nodes I don't even see model_name

Originally created by @DavideDelbianco on GitHub (Feb 18, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.15.3 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Attach LangFuse v3 to a dify workflow that uses LLM nodes and Knowledge Retrieval nodes ### ✔️ Expected Behavior Every node that uses LLM: - Knowledge Retrieval - Parameter Extractor - LLM Should report the number of tokens used and the model_id of the model used ### ❌ Actual Behavior PR https://github.com/langgenius/dify/pull/13117 Supposedly fixed this issue, but in langfuse I keep seeing model_name instead of model_id and in some nodes I don't even see model_name
yindo added the 🐞 bug label 2026-02-21 18:25:23 -05:00
yindo closed this issue 2026-02-21 18:25:23 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Feb 18, 2025):

The issue you're experiencing with Langfuse not parsing the model_id and instead showing model_name, or missing it entirely, seems to be related to the changes made in pull request #13117. This pull request was intended to address the reporting of model usage in LLM nodes and Knowledge Retrieval nodes, but it appears that the fix may not have fully resolved the issue.

Currently, Dify handles the reporting of model_id and model_name by including them in the process_data dictionary for LLM nodes. The model_name is stored under the key "model_name", and the model_mode is stored under the key "model_mode" [1]. However, if you're seeing discrepancies in Langfuse, it might be due to how this data is being processed or reported in the integration.

To resolve this, you might want to check the implementation details in your setup to ensure that the process_data is correctly populated and reported. Additionally, reviewing the changes in the pull request #13117 might provide insights into any potential oversights or areas that need further adjustment. If the issue persists, it may require further investigation or a follow-up fix in the Dify repository.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Feb 18, 2025): <!-- Answer --> The issue you're experiencing with Langfuse not parsing the `model_id` and instead showing `model_name`, or missing it entirely, seems to be related to the changes made in pull request #13117. This pull request was intended to address the reporting of model usage in LLM nodes and Knowledge Retrieval nodes, but it appears that the fix may not have fully resolved the issue. Currently, Dify handles the reporting of `model_id` and `model_name` by including them in the `process_data` dictionary for LLM nodes. The `model_name` is stored under the key `"model_name"`, and the `model_mode` is stored under the key `"model_mode"` <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/core/workflow/nodes/llm/node.py)</sup>. However, if you're seeing discrepancies in Langfuse, it might be due to how this data is being processed or reported in the integration. To resolve this, you might want to check the implementation details in your setup to ensure that the `process_data` is correctly populated and reported. Additionally, reviewing the changes in the pull request #13117 might provide insights into any potential oversights or areas that need further adjustment. If the issue persists, it may require further investigation or a follow-up fix in the Dify repository. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/b63e1e2d-9241-4a01-9662-9270c91615bf?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/b63e1e2d-9241-4a01-9662-9270c91615bf?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/b63e1e2d-9241-4a01-9662-9270c91615bf?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/b63e1e2d-9241-4a01-9662-9270c91615bf?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/b63e1e2d-9241-4a01-9662-9270c91615bf?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/b63e1e2d-9241-4a01-9662-9270c91615bf?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/b63e1e2d-9241-4a01-9662-9270c91615bf?feedback_type=other)</sup>
Author
Owner

@DavideDelbianco commented on GitHub (Mar 4, 2025):

Anyone from the team willing to fix the LangFuse integration?
It is stated in their official docs: https://python.reference.langfuse.com/langfuse/client#Langfuse.generation
some properties are deprecated

And langfuse_trace.py clearly still uses them and is not passing data in the correct way (no input token, output token, just total token, no model name, etc...)

Image

@DavideDelbianco commented on GitHub (Mar 4, 2025): Anyone from the team willing to fix the LangFuse integration? It is stated in their official docs: https://python.reference.langfuse.com/langfuse/client#Langfuse.generation some properties are deprecated And `langfuse_trace.py` clearly still uses them and is not passing data in the correct way (no input token, output token, just total token, no model name, etc...) ![Image](https://github.com/user-attachments/assets/7f938f55-dbdb-43b8-b4b8-ec98a3c0abed)
Author
Owner

@DavideDelbianco commented on GitHub (Mar 14, 2025):

Any news? Am I the only one using Langfuse v3+ that cannot see the costs , token in, token out ? :(

@DavideDelbianco commented on GitHub (Mar 14, 2025): Any news? Am I the only one using Langfuse v3+ that cannot see the costs , token in, token out ? :(
Author
Owner

@DavideDelbianco commented on GitHub (Mar 19, 2025):

I want to add that LLM nodes that errors out, will report the price (calculated by LangFuse)
Image

Succesful nodes will not
Image

This could restrict the possibilities to an issue with the total_price and currency metadata
Even though I don't know how LangFuse was able to calculate token_in and token_out in case of error

@DavideDelbianco commented on GitHub (Mar 19, 2025): I want to add that LLM nodes that errors out, will report the price (calculated by LangFuse) ![Image](https://github.com/user-attachments/assets/226b0511-e12d-4456-a389-792072e57f54) Succesful nodes will not ![Image](https://github.com/user-attachments/assets/22d18af0-b585-4592-a16e-a928195f2058) This could restrict the possibilities to an issue with the total_price and currency metadata Even though I don't know how LangFuse was able to calculate token_in and token_out in case of error
Author
Owner

@DavideDelbianco commented on GitHub (Mar 26, 2025):

bumping this issue.

One of the features that sets Dify apart from other tools is the analytical / logging part.
How comes that no one cares that the LangFuse implementation is not working as expected?

@crazywoola it's been a month since this issue was opened, can someone at least acknowledge this bug?
Not asking to fix it right away, if there's something more important, but the inability to track prices per-user is becoming a real issue, and with an ever-growing list of issues it feels like those that not on the main page are ignored until dosubot closes them because stale

@DavideDelbianco commented on GitHub (Mar 26, 2025): bumping this issue. One of the features that sets Dify apart from other tools is the analytical / logging part. How comes that no one cares that the LangFuse implementation is not working as expected? @crazywoola it's been a month since this issue was opened, can someone at least acknowledge this bug? Not asking to fix it right away, if there's something more important, but the inability to track prices per-user is becoming a real issue, and with an ever-growing list of issues it feels like those that not on the main page are ignored until dosubot closes them because stale
Author
Owner

@ZhouhaoJiang commented on GitHub (Mar 27, 2025):

I’ve already fixed the tracking of Parameter Extractor and LLM usage data in Langfuse. As for Knowledge Retrieval, we’re currently not collecting token or model usage statistics for that component.

@ZhouhaoJiang commented on GitHub (Mar 27, 2025): I’ve already fixed the tracking of Parameter Extractor and LLM usage data in Langfuse. As for Knowledge Retrieval, we’re currently not collecting token or model usage statistics for that component.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#8382