Agent skill · Audited from source
Langfuse Cost Tuning
skill · jeremylongshore/claude-code-plugins-plus-skillsMIT licenceAudited 9 Oct 2026 · source 4f83675ca38a
Is it safe? Yes — SAFE, grade B (89/100). We read this skill's source at commit 4f83675ca38a and found no filesystem, network or shell access and no hard-coded secrets. What it does: Monitor and optimize LLM costs using Langfuse analytics and dashboards.
Cite
Cite this page
ModelsAtlas. “Langfuse Cost Tuning (jeremylongshore/claude-code-plugins-plus-skills)”. Retrieved 9 Oct 2026. https://modelsatlas.com/skills/jeremylongshore/langfuse-cost-tuning
Trust audit
Audit 0.4.1 · source read 9 Oct 2026
SAFE means nothing in the source contradicts what the skill says it does. Grade B is shared by 17,406 of 18,389 audited skills.
What the source does
- FilesystemNone observedNo reads or writes in the source
- NetworkNone observedNo outbound calls in the source
- ShellNone observedNo commands run in the source
- DependenciesPinnedNothing floats
- SecretsNone foundNo keys in source
Five audit layers
| Layer | What we check | Result | Findings |
|---|---|---|---|
L0 Provenance | Repo owner, licence, archive status, activity | PASS | 0 |
L1 Static source | Secrets, path traversal, supply chain, hidden code | PASS | 0 |
L2 Instructions | Prompt injection, authority framing, hidden directives | PASS | 0 |
L3 Inventory | The files and declarations match the source | PASS | 0 |
L4 Sandbox | Run in isolation and watch behaviour | SKIPPED why | 0 |
Gates applied: no behavioural pass.
Findings (0)
No findings at any severity. We re-audit when the source changes.
Audit 0.4.1 · source sha 4f83675ca38a · 9 Oct 2026Report an issue or request a re-scan
Provenance
Who published it, and what the verdict is pinned to
- Publisherjeremylongshore GitHub userOwner of the repository this skill is read from
- Source folderjeremylongshore/claude-code-plugins-plus-skills/plugins/saas-packs/langfuse-pack/skills/langfuse-cost-tuningThe exact folder we audited
- LicenceMITAs the repository states it
- Commit pinned for this verdict4f83675ca38aA new audit runs when the source changes
- Repository statusNot archivedPushed today
- Sandboxed runNot runSkills are read, not executed; layer L4 is skipped
What it tells the agent
Full source on GitHub ↗Its description: Monitor and optimize LLM costs using Langfuse analytics and dashboards.
--- name: langfuse-cost-tuning description: '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". ' allowed-tools: Read, Write, Edit version: 1.17.0 license: MIT author: Jeremy Longshore <[email protected]> tags: - saas - langfuse - monitoring - llm - analytics compatibility: Designed for Claude Code --- # 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 openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "user", content: prompt }], }); updateActiveObservation({ output: response.choices[0].message.content, usage: { promptTokens: response.usage?.prompt_tokens, completionTokens: response.usage?.completion_tokens, totalTokens: response.usage?.total_tokens, }, // Optional: override inferred cost (in USD) // costInUsd: 0.0015, }); } ); ``` ### Step 2: Query Costs via Metrics API ```typescript import { LangfuseClient } from "@langfuse/client"; const langfuse = new LangfuseClient(); // Fetch aggregated cost metrics async function getCostReport(days: number) { const fromTimestamp = new Date(Date.now() - days * 86400000).toISOString(); // Use the API to list traces with cost data const traces = await langfuse.api.traces.list({ fromTimestamp, limit: 1000, orderBy: "timestamp", }); const costByModel = new Map<string, { cost: number; tokens: number; count: number }>(); for (const trace of traces.data) { const observations = await langfuse.api.observations.list({ traceId: trace.id, type: "GENERATION", }); for (const obs of observations.data) { const model = obs.model || "unknown"; const existing = costByModel.get(model) || { cost: 0, tokens: 0, count: 0 }; existing.cost += obs.calculatedTotalCost || 0; existing.tokens += obs.totalTokens || 0; existing.count += 1; costByModel.set(model, existing); } } console.log("\n=== LLM Cost Report ==="); console.log(`Period: Last ${days} days\n`); let totalCost = 0; for (const [model, data] of costByModel.entries()) { console.log(`${model}:`); console.log(` Calls: ${data.count}`); console.log(` Tokens: ${data.tokens.toLocaleString()}`); console.log(` Cost: $${data.cost.toFixed(4)}`); totalCost += data.cost; } console.log(`\nTotal: $${totalCost.toFixed(4)}`); } getCostReport(7); ``` ### Step 3: Implement Smart Model Routing Route requests to cheaper models when appropriate: ```typescript import { observe, updateActiveObservation } from "@langfuse/tracing"; interface ModelConfig { model: string; costPer1MInput: number; costPer1MOutput: number; maxComplexity: "simple" | "moderate" | "complex"; } const MODELS: ModelConfig[] = [ { model: "gpt-4o-mini", costPer1MInput: 0.15, costPer1MOutput: 0.60, maxComplexity: "simple" }, { model: "gpt-4o", costPer1MInput: 2.50, costPer1MOutput: 10.00, maxComplexity: "moderate" }, { model: "claude-sonnet-4-20250514", costPer1MInput: 3.00, costPer1MOutput: 15.00, maxComplexity: "complex" }, ]; function selectModel(task: string, inputLength: number): ModelConfig { const simpleTasks = ["classify", "extract", "summarize-short", "translate"]; const isSimple = simpleTasks.some((t) => task.includes(t)); const isShort = inputLength < 500; if (isSimple && isShort) return MODELS[0]; // gpt-4o-mini if (isSimple || inputLength < 2000) return MODELS[1]; // gpt-4o return MODELS[2]; // claude-sonnet-4 } const costOptimizedLLM = observe( { name: "cost-optimized-llm", asType: "generation" }, async (task: string, input: string) => { const config = selectModel(task, input.length); updateActiveObservation({ model: config.model, metadata: { task, selectedReason: `${config.maxComplexity} tier`, estimatedCostPer1M: config.costPer1MInput, }, }); const response = await callModel(config.model, input); updateActiveObservation({ output: response.content, usage: response.usage, }); return response; } ); ``` ### Step 4: Budget Alerts ```typescript // scripts/cost-alert.ts -- run as cron job import { LangfuseClient } from "@langfuse/client"; const langfuse = new LangfuseClient(); const ALERT_THRESHOLDS = { dai
Excerpt, first 6,000 characters of SKILL.md, verbatim from the audited commit. It is text from someone else’s repository, quoted so you can judge it before your agent reads it.
Install
Pinned to the audited commit 4f83675
git clone https://github.com/jeremylongshore/claude-code-plugins-plus-skills git -C claude-code-plugins-plus-skills checkout 4f83675ca38a
The author documents no install command, so this uses the repository directly. Our verdict covers commit 4f83675ca38a only.
Works in which agents?
What its own text says, not a test
| Agent | Status | More |
|---|---|---|
| Claude Code | Mentioned in its text, not tested | Skills for Claude Code · About Claude Code |
Audit history
Every audit, every source change
- ✓SAFE B 89 / 100
first audit · source
4f83675ca38a
README badge
For maintainers · shows the latest audit
[](https://modelsatlas.com/skills/jeremylongshore/langfuse-cost-tuning/)
The badge shows our verdict and grade for this skill, and links back to this page. It changes when the audit does.
Similar skills
jeremylongshore/claude-code-plugins-plus
Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com.
jeremylongshore/claude-code-plugins-plus
Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com.
jeremylongshore/claude-code-plugins-plus
Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com.
jeremylongshore/claude-code-plugins-plus
Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com.
jeremylongshore/claude-code-plugins-plus
Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com.
jeremylongshore/claude-code-plugins-plus
Deploy and orchestrate Vertex AI ADK agents using A2A protocol. Manages
Add this badge to your README
[](https://modelsatlas.com/skills/jeremylongshore/langfuse-cost-tuning/)
<a href="https://modelsatlas.com/skills/jeremylongshore/langfuse-cost-tuning/"><img src="https://modelsatlas.com/skills/jeremylongshore/langfuse-cost-tuning/badge.svg" alt="ModelsAtlas: SAFE B"></a>
Questions about Langfuse Cost Tuning
What does the Langfuse Cost Tuning skill do?
Is Langfuse Cost Tuning safe to install?
What can Langfuse Cost Tuning access on my machine?
Which assistants does Langfuse Cost Tuning work with?
How current is this page?
Sources
- github.com/jeremylongshore/claude-code-plugins-plus-skills/tree/ — the audited source at commit 4f83675ca38a and every finding aboveObserved · 9 Oct 2026
Spotted something wrong? Report a correction · Methodology
Keep going in your AI
Opens with this page as the source. We add nothing else to the prompt.
- What does the Langfuse Cost Tuning skill do?
- Is Langfuse Cost Tuning safe to install?
- What can Langfuse Cost Tuning access on my machine?