github latitude-dev/latitude-llm typescript-telemetry-4.2.0
TypeScript Telemetry v4.2.0

latest releases: typescript-telemetry-4.3.0, python-telemetry-3.8.4, typescript-telemetry-4.2.1...
3 hours ago

Added

  • Bring your own LLM cost. capture(name, fn, { cost: { input, output } | { total } }) sets the
    cost (USD) of every LLM-call span inside the capture (never the capture's own wrapper span).
    new Latitude({ pricing: { "<provider>/<model>": { inputPer1M, outputPer1M } } }) prices LLM
    calls from their token counts, and new Latitude({ costResolver }) lets costResolver(usage)
    return a cost or undefined to fall back. setLlmCost(span, { input, output, total }) sets the
    cost of one span. Precedence: setLlmCost > capture cost > costResolver > pricing >
    Latitude's server-side pricing.
  • Where the SDK sets cost it writes gen_ai.usage.input_cost, gen_ai.usage.output_cost and
    gen_ai.usage.total_cost plus latitude.cost.source="user", replacing any cost the
    instrumentation wrote on that span. total defaults to input + output, a total-only cost
    drops the instrumentation's input/output costs, and an explicit 0 is honoured. Cost is applied
    at export through an exporter wrapper, so other processors on a shared provider see the span
    unchanged. New exports: setLlmCost, ATTRIBUTES (now including costInput / costOutput /
    costTotal / costSource), COST_SOURCE_USER and the LlmCost, LlmUsage, ModelPricing
    and CostResolver types. LLM calls, provider, model and token counts are read from
    OpenTelemetry GenAI, OpenInference (including CrewAI's AGENT span), OpenLLMetry and Vercel AI
    SDK (ai.model.*, ai.usage.*) attributes, and cost is resolved when each span ends, before
    redaction.

Don't miss a new latitude-llm release

NewReleases is sending notifications on new releases.