langfuse-cost-tuning

Featured

Monitor and optimize LLM costs using Langfuse analytics and dashboards. Use when tracking LLM spending, identifying cost anomalies, or implementing cost controls for AI applications. Trigger with phrases like "langfuse costs", "LLM spending", "track AI costs", "langfuse token usage", "optimize LLM budget".

AI & Automation 2,266 stars 315 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Langfuse Cost Tuning ## Overview 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. ## Prerequisites - Langfuse tracing with token usage captured (via `observeOpenAI` or manual `usage` fields) - For Metrics API: `@langfuse/client` installed - Understanding of LLM pricing models ## How Langfuse Tracks Costs Langfuse 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. ## Instructions ### Step 1: Ensure Token Usage is Captured ```typescript // 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...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
7 months ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Solid

langfuse-integration

LangFuse LLM observability integration for tracing, analytics, and cost tracking

1,034 Updated today
a5c-ai
AI & Automation Featured

langfuse-observability

Set up comprehensive observability for Langfuse with metrics, dashboards, and alerts. Use when implementing monitoring for LLM operations, setting up dashboards, or configuring alerting for Langfuse integration health. Trigger with phrases like "langfuse monitoring", "langfuse metrics", "langfuse observability", "monitor langfuse", "langfuse alerts", "langfuse dashboard".

2,266 Updated today
jeremylongshore
AI & Automation Featured

langchain-cost-tuning

Optimize LangChain API costs with token tracking, model tiering, caching, prompt compression, and budget enforcement. Trigger: "langchain cost", "langchain tokens", "reduce langchain cost", "langchain billing", "langchain budget", "token optimization".

2,266 Updated today
jeremylongshore
AI & Automation Solid

langfuse

Expert in Langfuse - the open-source LLM observability platform. Covers tracing, prompt management, evaluation, datasets, and integration with LangChain, LlamaIndex, and OpenAI. Essential for debugging, monitoring, and improving LLM applications in production. Use when: langfuse, llm observability, llm tracing, prompt management, llm evaluation.

27,681 Updated today
davila7
AI & Automation Listed

langfuse

Expert in Langfuse - the open-source LLM observability platform. Covers tracing, prompt management, evaluation, datasets, and integration with LangChain, LlamaIndex, and OpenAI. Essential for debugging, monitoring, and improving LLM applications in production. Use when: langfuse, llm observability, llm tracing, prompt management, llm evaluation.

335 Updated today
aiskillstore