Recent Chats
Sign in to access your chat history.
When using Sourcebot's chat feature, I'm able to get langfuse traces. However, it can only detect the model (and pricing) when using claude sonnet 4. If I try to use gemini 2.5 pro I see the traces in langfuse but it doesn't detect which model I'm using. What could be causing this?
Details
Answer
The issue is that Langfuse cannot identify the gemini-2.5-pro
model because it is not defined in its model pricing configuration. While you are able to use the model in Sourcebot, Langfuse requires a corresponding entry to properly trace and report on it.
Here's a breakdown of the problem:
default-model-prices.json
default-model-prices.json to identify and calculate costs for different language models.gemini-2.5-pro
model is not present in this configuration file. While other models like claude-3-sonnet-20240229
default-model-prices.json:836-854 and even gemini-2.5-flash
default-model-prices.json:1854-1873 are defined, gemini-2.5-pro
is missing.gemini-2.5-pro
in its documentation language-model-providers.mdx:14-21, which is why you are able to use it in the chat feature.To resolve this, you will need to add an entry for gemini-2.5-pro
to the default-model-prices.json
file within the Langfuse repository. This will allow Langfuse to recognize the model and provide the correct tracing information.
is there a guide on how to add a new entry into default-model-prices.json ?
Details
Answer
While there isn't an explicit guide in the Langfuse documentation on how to add a new model to the pricing configuration, the process can be inferred from the structure of the default-model-prices.json
file default-model-prices.json and the surrounding code.
Here’s a guide on how to add a new entry for gemini-2.5-pro
:
Each model in the default-model-prices.json
file default-model-prices.json is a JSON object with the following key fields:
id
: A unique identifier. You can generate a new one for your entry.model_name
: The standardized name for the model (e.g., "gemini-2.5-pro").match_pattern
: A regular expression used to match the model name as it appears in traces. This is crucial for Langfuse to identify the model correctly. For Gemini models, a pattern like (?i)^(gemini-2.5-pro)(@[a-zA-Z0-9]+)?$
is typically used, as seen with gemini-1.5-pro
default-model-prices.json:995-1003.prices
: An object specifying the cost per unit (e.g., per character or token) for both input and output. You will need to find the official pricing for gemini-2.5-pro
to fill this in.tokenizer_id
: The tokenizer used for the model. For Gemini models, this is often set to null
default-model-prices.json:992-992 as the token count is expected to be provided in the trace.tokenizer_config
: Additional configuration for the tokenizer, also typically null
for Gemini models default-model-prices.json:991-991.You would need to create a new JSON object for gemini-2.5-pro
and add it to the array in default-model-prices.json
default-model-prices.json. Here is a template you can use, which you'll need to populate with the correct pricing information:
Replace the placeholder values with the correct data.
Since default-model-prices.json
default-model-prices.json is part of the Langfuse repository, you have a few options:
langfuse/langfuse
GitHub repository, requesting the addition of gemini-2.5-pro
to the default-model-prices.json
file. This is the recommended approach as it will benefit the entire community.By adding the model definition, Langfuse will be able to correctly identify gemini-2.5-pro
in your traces and provide accurate pricing and analytics.