NAME

Langertha::Metrics - DEPRECATED back-compat facade over Langertha::Usage / Pricing / Cost / UsageRecord — use the value objects directly

VERSION

version 0.503

DEPRECATION

Langertha::Metrics is a thin back-compat facade kept solely so existing Skeid/Knarr consumers keep working. It is scheduled for removal in Langertha 0.504. New code must construct the value objects directly — no replacement module, just stop calling this one.

Migration map (one-to-one):

  • normalize_usage($hash)

    = Langertha::Usage->from_hash($hash)->to_hash

  • usage_from_response($response)

    = Langertha::Usage->from_response($response)->to_hash

  • estimate_cost_usd(usage = ..., pricing => ...)>

    = Langertha::Pricing->new( default_rule => $pricing )->cost_for( Langertha::Usage->from_hash($usage), $model )->to_hash

  • build_record(...)

    Construct Langertha::UsageRecord directly: build a Langertha::Usage from the response or hash, build a Langertha::Pricing with the pricing rule, call ->cost_for($usage, $model), then Langertha::UsageRecord->new( usage => $usage, cost => $cost, provider => ..., engine => ..., model => ..., route => ..., api_key_id => ..., duration_ms => ..., started_at => ..., finished_at => ..., tool_calls => ..., tool_names => ..., pricing_version => ... ) and ->to_hash.

Note: Langertha::Response's usage attribute is the raw provider payload as returned on the wire — it is unrelated to this facade's normalization helpers and is not affected by the deprecation.

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/langertha/issues.

IRC

Join #langertha on irc.perl.org or message Getty directly.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <getty@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus https://raudssus.de/.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.