Option to correct model costs #10026
-
|
We have this issue that a model config that was not available in Langfuse was used to send some traces and now we are missing costs for the traces. Is there anyway to fill out the costs for the traces where this information was missing. The model config is now added so new traces have cost information already |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
|
Based on the documentation, when you add a new model definition to Langfuse, it only applies to newly ingested traces.(1) For self-hosted Langfuse instances, you need to run a migration script to apply new model/price definitions to existing data.(1) The documentation states: "If you self-host Langfuse, new model/price definitions are applied to all newly ingested traces. You need to run a migration script to apply them to your existing data in Langfuse."(1) For traces that were already ingested before the model config was added, the cost information won't be automatically backfilled. The migration script mentioned is specifically for applying model definitions to historical traces in self-hosted deployments.(1) If you're using Langfuse Cloud, there isn't a documented way to retroactively correct costs for traces that were ingested without proper model definitions. The ingested usage and cost are prioritized over inferred values, so traces without this information at ingestion time will remain without cost data.(2) 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
@inkeep Can you write some python SDK code to do this migration? |
Beta Was this translation helpful? Give feedback.
-
|
@inkeep your migration script is for upgrading langfuse v1 to v2. Now that langfuse is on v3, how can I apply new model definition to existing traces? |
Beta Was this translation helpful? Give feedback.
-
|
I don't have specific documentation about applying new model definitions to existing traces in Langfuse v3. The migration approach may have changed with the v3 architecture update. For Langfuse v3 deployments, I'd recommend:
If you're self-hosting, you may need to run database operations directly or use administrative scripts that are compatible with v3's architecture (which introduced ClickHouse, worker containers, and other infrastructure changes). Since this involves modifying existing production data, I'd strongly suggest reaching out through Langfuse's official support channels to get the correct procedure for your specific v3 deployment. Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
Hi @talrejanikhil, changing traces is not supported because we are transitioning to treating traces as immutable objects, in accordance with OpenTelemetry conventions. If it's important for the costs to be accurately reflected, you can always add the traces again to your project now that model config is correctly set up. |
Beta Was this translation helpful? Give feedback.
Hi @talrejanikhil, changing traces is not supported because we are transitioning to treating traces as immutable objects, in accordance with OpenTelemetry conventions. If it's important for the costs to be accurately reflected, you can always add the traces again to your project now that model config is correctly set up.