Why teams add custom model prices to self-hosted Langfuse
If your traces show token counts for a model Langfuse does not price, your cost dashboards will read zero or incomplete, even though the usage is being recorded. Langfuse stores the input and output tokens each generation reports, but it can only turn those tokens into a dollar figure when it has a price for the model name on the trace. When a team runs a self-hosted model, a fine-tuned variant of a supported model, a private endpoint, or a model released after the Langfuse build it runs, the name on the trace often has no matching price. The result is a spend report that looks cheaper than it is, and a finance or platform owner who sees gaps they cannot explain.
Teams usually add custom definitions in three situations: they serve their own or open-weight models, they fine-tune models that inherit a base model's pricing from a provider, or they use a model that the built-in catalog does not yet include. Each case needs a decision about which name the trace will carry, which price applies, and who owns that price when it changes. The open source version of Langfuse includes core features and APIs without limits, and self-hosted deployments run the same codebase as Langfuse Cloud, so model definitions are not a paid add-on. Before you start, confirm with your Langfuse version and your instrumentation which model string each application actually sends, because that string is what any definition must match.
Which pricing approach fits which model
This table compares the four ways to put a price on a model Langfuse does not know, along with per-usage-type and tiered prices. Read each row against the model you run: the right choice depends on how many models share a price, how often prices change, and whether the provider reports cost itself. The main takeaway is that broad match patterns are cheapest to start with but need the most checking, while cost passed at ingestion is the most precise and the most work in your application code.
| Approach | When it fits | What it costs to maintain |
|---|---|---|
| Match pattern for a model family | Many fine-tuned or versioned variants that share one base price, such as a family of checkpoints from one base model | Low upkeep for new variants, but review the pattern after each rename so it does not match an unintended model |
| Exact model name for one self-hosted model | A single model you serve yourself with a fixed cost basis, where a wrong match would misstate spend | Add one definition per model and update it only when your cost basis changes, such as new hardware pricing |
| Per-usage-type prices | Models that bill input, output, cached or reasoning tokens at different rates, so one blended price would distort totals | Confirm which usage types your SDK or integration reports, and add a price for each one you actually receive |
| Tiered pricing by prompt size | Providers or contracts that charge a different rate once a prompt crosses a size threshold | Re-check thresholds whenever the provider changes its tiers, and test a prompt on each side of the boundary |
| Cost passed at ingestion | Cases where your gateway or application already knows the real cost, such as negotiated rates or self-hosted GPU time allocation | Your code must calculate and send cost on every generation, so the logic lives with your engineers and needs tests |
Setting up a custom model definition step by step
This sequence takes a model Langfuse does not recognize from an unmatched trace to a verified cost figure. Each step ends with a check so the team knows the definition works before it is relied on for reporting or chargeback.
Confirm the model name the SDK sends
Start by finding the exact model string your application or integration writes to each generation. Open a recent trace in the Langfuse UI and read the model field, or check the model parameter in your SDK call or gateway configuration. Match casing, version suffixes and provider prefixes exactly, because Langfuse matches definitions against this string. Done means you have written down one string per deployed model and can see it on a real generation.
Create the model definition in settings
In the Langfuse UI, open the model settings for your project or organization and add a new model definition. Enter a name, then a match pattern that covers the model string you confirmed, and choose whether it applies to the project or the organization. Confirm the UI path against the Langfuse version you run, since menus move between releases. Done means the definition appears in the model list with the pattern you intended.
Enter prices per usage type and unit
Add a price for each usage type your provider or hosting cost model charges for, such as input, output or cached tokens, and set the unit each price applies to. Use the price sheet or internal cost calculation as the source, and record the currency and the date the price was taken. Prices are entered by your team, so someone who owns the cost figures should review them. Done means every usage type you bill or track has a price and a unit on the definition.
Send one test trace
Run one request through the application or integration that uses the custom model, and include the usage counts the model returns. Open the resulting trace and confirm the generation is linked to your new definition rather than shown as unmatched. If the cost is still empty, return to the match pattern and compare it with the model string you recorded in the first step. Done means one generation shows a computed cost with the expected model name.
Compare the computed cost with a hand calculation
Take the input and output token counts from the test generation and multiply them by your per-unit prices by hand, then add the results. Compare that figure with the cost Langfuse shows for the same generation. If the two differ, check the units (per token or per thousand tokens), the usage types included, and whether a cached or reasoning usage type is being counted twice. Done means the computed and hand-calculated figures agree within the rounding you accept, and the differences you found are written down.
Confirm tiers and tokenizer assumptions
If the provider prices by volume tiers or a context-length threshold, check that your definition reflects the tier that applies to the test request. Also confirm that the token counts come from the provider's own usage response rather than an estimate from a local tokenizer, since estimated counts can drift from invoices. Ask the provider or your platform owner to confirm both points. Done means you can state which tier and which count source the test cost depends on.
Roll out and monitor the definition
Apply the verified definition to the wider set of projects or integrations that use the model, then review cost totals for the first full reporting period against the provider invoice. Add a recurring check to update prices when the provider changes them, and record who owns that update. Done means the model's cost appears across the intended projects and the invoice comparison has been filed with the date of the last price change.
How a trace becomes a cost figure
The flow starts when your application sends a generation that carries a model name and token usage counts. Langfuse ingests the event, looks for a model definition whose match pattern fits that model name, and applies the stored price for each usage type and pricing tier. The resulting cost is stored on the observation, and the Metrics API and dashboards read it from there. Check the match step first: if no definition matches, the cost field stays empty and every total built on it will be understated.
Cost is only calculated when the model name matches a definition.
Putting a cost on GPU-served models
A self-hosted model has no per-token invoice, so the cost Langfuse records for it is only as good as the unit price you define for it. Before you add a custom model definition for a GPU-served model, choose the basis for that price and write it down. The usual basis is an internal cost per token derived from the cost of the GPU hours that served the requests, the amortized cost of the hardware or reserved capacity, and the utilization you actually achieve. Utilization matters because an idle GPU still costs money, so a cost per token calculated at full load will understate spend when traffic is light. Ask your finance and platform teams to agree on which components are included, how often the figure is recalculated, and who owns the number when hardware or cloud rates change.
Token counts are the second variable, and they differ between models. Two models given the same text can split it into different numbers of tokens because they use different tokenizers, so a price per token means different amounts of work across models. If you compare a self-hosted model with a hosted one, or move traffic between two self-hosted models, confirm which tokenizer produced the counts you are pricing. Where possible, record usage reported by the serving engine itself rather than estimating it from the text in the request and response. Check the usage fields your serving stack returns, confirm that Langfuse receives them on each generation, and compare a sample of traces against the engine's own logs before you trust the totals.
Finally, document the unit cost as an internal assumption, not as a vendor price. Store the basis, the date it was set and the owner next to the model definition so that auditors and chargeback reviewers can trace each cost figure back to its inputs. Re-check the figure when hardware, utilization or the serving model changes, and create a new definition rather than overwriting history, so that past costs stay correct. Ask the platform team to confirm the exact steps for setting prices on custom models in the Langfuse version you run, since the model definition interface can change between releases.
Where custom pricing goes wrong
Custom prices are easy to add and easy to get subtly wrong. The risks below all produce cost figures that look plausible in the dashboard but do not match what you pay, so each one needs a check before totals are used for budgets, chargeback or billing.
Match patterns catching unrelated models
A pattern that is too broad can match a model you never meant to price, such as a short name fragment that also appears in a different model family or version. The result is a wrong price applied silently to existing generations. Before saving, test each pattern against the full list of model names your applications send, and confirm that only the intended models match. Review the order in which definitions apply when more than one could match.
Prices not updated after provider changes
Providers change list prices, introduce new tiers and retire model versions. A custom definition written for last quarter's rate keeps producing cost figures that look valid but no longer match invoices. Assign an owner to each price, record the date and source of every value, and add a recurring review tied to your provider contract and pricing pages. Confirm that the Langfuse version you run supports the price changes you need to record.
Usage types that bill cached tokens wrongly
If a model has cached input tokens, cache writes or reasoning tokens, each usage type needs its own price. Mapping cached tokens to the standard input rate overstates cost, and omitting a usage type understates it. Compare one sample request's usage fields from the provider response with the cost Langfuse calculates for the same generation. Mismatches usually come from usage type names that do not match what the integration sends.
Tokenizer mismatch for self-hosted models
Token counts depend on the tokenizer. When Langfuse infers usage from text for a self-hosted or fine-tuned model, a tokenizer that differs from the one the model actually uses produces counts that drift from reality. Pick the tokenizer that matches the model's vocabulary, and test it against counts the serving stack reports. Where the serving stack returns exact usage, prefer ingesting those values over inference.
Stale GPU cost assumptions
A per-token price for a GPU-served model is an allocation, not a vendor rate. It depends on hardware cost, utilization, power, hosting and the throughput your serving stack achieves. An assumption set during a pilot can drift as batch sizes, instance types or traffic change. Document the inputs behind the rate, the period they cover and who approves changes, so the figure can be recalculated rather than trusted indefinitely.
Totals not reconciled to invoices
Dashboards built on custom prices are only as credible as their reconciliation. Compare monthly totals per model against provider invoices and your internal chargeback records, and document any accepted gap, such as rounding, free credits or cache discounts applied after the fact. Without this step, a team can present a cost report that finance later rejects. Agree the reconciliation method and tolerance with finance before the figures leave the platform team.
Langfuse self-hosting docsQuestions teams ask before pricing custom models
How long does it take to add custom model pricing in Langfuse?
No single duration fits every team, because the work scales with how many models you price and how complicated their price rules are. The main drivers are the number of models, whether each one needs match patterns that cover several version names, how many usage types you bill separately (input, output, cached and reasoning tokens, for example), whether prices change by volume or time, and whether you have a tokenizer that matches the model. A short list of hosted models with flat prices is a small task. A set of fine-tuned and GPU-served models with tiered prices needs agreed pricing data, testing against provider invoices and a process for future price changes. Ask any partner to break its estimate down by model and rule type.
Can our own engineers add custom model prices without outside help?
In most organizations, yes. Model definitions and prices are configuration work that an engineer who already runs the self-hosted instance can handle, provided someone owns the pricing data and checks the results. Langfuse states that all core features and APIs are available in the MIT-licensed open source version without limits, but confirm that model definitions are covered for the version you run in the official documentation. The work that usually stays with your team is the business side: who approves a price, where the source figures come from and how often they are reviewed. Outside help is most useful when the pricing logic is complex or the deadline is short.
What does a partner add when pricing custom models?
A partner adds delivery capacity and a second set of checks, not a different pricing feature. DeployOpen plans, implements and documents self-hosted Langfuse inside your own cloud accounts, data centers or air-gapped networks, so the model definitions sit in the same environment as your traces. Typical work includes mapping each model's match patterns, building tiered and per-usage-type prices, reconciling test traces against provider invoices, writing the runbook for price updates and handing over the configuration in a form your team can maintain. Compare this with the support tier the vendor sells. The vendor's Self-Hosted Enterprise plan adds a named support engineer and a support SLA, which covers the product, not your pricing data.
How should we set a cost for a model we serve on our own GPUs?
Start from the total cost of the hardware and the power, then divide it by the tokens the model produces over a period you can measure. The inputs are the purchase or lease cost spread over its useful life, power and cooling, hosting, storage and the engineering time to run the service, and the throughput you actually achieve in production. Utilization is the largest swing factor: an accelerator that sits idle carries the same fixed cost but produces fewer tokens to charge against. Record the assumptions with the price so that anyone reviewing a chargeback number can see how it was built. Revisit the figure when hardware, utilization or energy costs change, and label it as an internal estimate rather than a provider price.
Do existing traces update when we change a model price?
Confirm this in the documentation for your Langfuse version before you change prices for production data. Whether a price change reaches traces that were already recorded depends on how the cost was stored when each trace arrived, and that behavior is the first thing to verify. The safe approach is to create a test project, send a known set of generations with known token counts, change the price and check which totals move. Keep a record of each price change with its effective date, so that historic reports can be explained to finance and auditors. If old costs must stay fixed for billing, store the cost at ingestion or export a snapshot before you change the definition.
What should we ask for in a written scope for model pricing?
A written scope turns a rough idea into work you can check. Ask for a list of every model and version to be priced, with the match pattern and usage types for each, plus the source of every price and the date it was taken. Require a test plan that compares Langfuse totals with provider invoices or your own GPU cost model for a stated sample period. Confirm who maintains the pricing data after handover, how price changes are approved and whether historic traces will be affected. Also ask for the deliverables: configuration exported to version control, a runbook for updates and a short acceptance check. Fixed-scope engagements agree these items in writing before work starts, so you can compare quotes on the same basis.
How DeployOpen scopes custom model pricing
DeployOpen approaches custom model pricing in Langfuse as a scoped piece of work inside your own self-hosted instance. We first map which models, providers and GPU-served endpoints need prices, then define and test the model entries before anything reaches your cost dashboards. Engagements are fixed-scope, with the deliverables agreed in writing first.
How we scope
- Inventory every model that lacks a built-in price, including self-hosted, fine-tuned and GPU-served endpoints.
- Agree in writing which match patterns, usage types and pricing tiers the definitions must cover.
- Confirm with your finance or FinOps team which price sources and invoice totals the cost figures must reconcile against.
How we build
- Create model definitions in the self-hosted Langfuse instance with match patterns tested against real model name strings.
- Set prices per usage type, such as input, output and cached tokens, using the rates your contracts or hardware costs support.
- Document the tokenizer choice and the method used to attach an hourly GPU cost to served models, with its assumptions stated.
How we hand over
- Deliver a written register of model definitions, match patterns, prices, tiers and their owners, so future changes have a record.
- Walk your platform and finance teams through checking calculated cost against provider invoices for a sample period.
- Provide a change procedure for adding new models or updating prices, including who approves each change.
How we support
- Ongoing support, upgrades and continuous testing are available as retainers, so new models can be priced as they appear.
- Re-check match patterns after Langfuse upgrades or when provider model names change.
- Agree in the written scope how price updates are reviewed and retested before the next reporting cycle.

