Install any skill in seconds. Free to start, no credit card required.
Get Started Free →jeremylongshore/langfuse-cost-tuning
Monitor and optimize LLM costs using Langfuse analytics and dashboards.
Passed 21 of 23 test cases with the skill, and 12 of 23 without it.
and 9 more in the full report
9 fixed12 passed either way2 still failing0 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 9 test cases the skill fixed. Same model, same prompt, with and without the skill.
When querying the Metrics API to build custom cost reports, developers often try calling langfuse.api.observations.get(). To fetch all generation observations belonging to a trace, which list method and filter parameter should be used?
| Checked | Without skill | With skill |
|---|---|---|
| Calls langfuse.api.observations.list | Missed | Passed |
| Filters by type GENERATION | Passed | Passed |
The instructions your model reads when the skill loads.
Track, analyze, and optimize LLM costs using Langfuse's built-in token/cost tracking, the Metrics API for programmatic cost analysis, model routing for cost reduction, and automated budget alerts.
observeOpenAI or manual usage fields)@langfuse/client installedLangfuse automatically calculates costs for supported models (OpenAI, Anthropic, Google) when token usage is captured. For custom models, you can configure pricing in the Langfuse UI under Settings > Model Definitions.
Cost tracking works on observations of type generation and embedding. The observeOpenAI wrapper captures usage automatically; for manual tracing, include usage in your observation updates.
// Automatic: observeOpenAI captures everything
import { observeOpenAI } from "@langfuse/openai";
const openai = observeOpenAI(new OpenAI());
// Tokens, model, latency, and cost are all auto-tracked
// Manual: include usage in generation observations
import { startActiveObservation, updateActiveObservation } from "@langfuse/tracing";
await startActiveObservation(
{ name: "llm-call", asType: "generation" },
async () => {
updateActiveObservation({ model: "gpt-4o" }); // Model required for cost calc
const response = await openai.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: prompt }],
});
test cases passed, vs 12 / 23 without
More skills from the same source and nearby in the registry, with their headline benchmark lift.