Documentation
¶
Overview ¶
Package modelusage propagates actual model-call accounting across optional middleware without depending on the agent or changing provider contracts.
Index ¶
- func Before(ctx context.Context) error
- func CheckAccounting(ctx context.Context) error
- func Record(ctx context.Context, usage providers.Usage) error
- func RecordAccounting(ctx context.Context, usage providers.Usage) error
- func RecordSample(ctx context.Context, model string, usage providers.Usage, reported bool) error
- func WithAccounting(ctx context.Context, accounting Accounting) context.Context
- func WithCallbacks(ctx context.Context, before func(context.Context) error, ...) context.Context
- func WithSample(ctx context.Context, model string, reported bool) context.Context
- type Accounting
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckAccounting ¶
func Record ¶
Record accepts only a provider-reported usage value; estimates of prompt or output size are not billable usage and must never be supplied here.
func RecordSample ¶
func WithAccounting ¶
func WithAccounting(ctx context.Context, accounting Accounting) context.Context
func WithCallbacks ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.