Imp.Core.LMResponse (Imp v0.5.0)

Copy Markdown View Source

Provider-neutral LM response: normalized outputs, usage, cost, and raw data.

cost is the provider's reported total for this call in USD as a non-negative float, or nil when the provider reported nothing Imp can read as a number. Providers report that total in several shapes — a bare number, a string, a Decimal, or a cost breakdown map carrying a total — and Imp reads the number out of all of them here, so a host reading a call's money never has to learn a provider library's private shape.

billing is the provider's cost breakdown map, untouched, when the provider reported one, and nil otherwise. It is the detail behind cost (line items, input and output splits); its shape belongs to the provider, so it is evidence to inspect rather than a contract to depend on.

Summary

Types

t()

@type t() :: %Imp.Core.LMResponse{
  billing: map() | nil,
  cost: number() | nil,
  metadata: map(),
  outputs: list(),
  raw: term(),
  usage: map()
}