Documentation
¶
Overview ¶
Command cliproxy-costs is a CLIProxyAPI native plugin (build with -buildmode=c-shared). It exports the ABI 1 entry point and dispatches every RPC into internal/plugin.
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
abi
Package abi holds the wire structs and envelopes of the CLIProxyAPI native plugin ABI (ABI 1, JSON schema 6).
|
Package abi holds the wire structs and envelopes of the CLIProxyAPI native plugin ABI (ABI 1, JSON schema 6). |
|
api
Package api serves the plugin's management and resource routes: the data endpoints under CPA's management API (CPA enforces the management key) and the static dashboard assets under /v0/resource/plugins/, which carry no data.
|
Package api serves the plugin's management and resource routes: the data endpoints under CPA's management API (CPA enforces the management key) and the static dashboard assets under /v0/resource/plugins/, which carry no data. |
|
catalog
Package catalog fetches the pricing feed through the host, decodes and validates it, persists the last good snapshot and publishes parsed catalogs.
|
Package catalog fetches the pricing feed through the host, decodes and validates it, persists the last good snapshot and publishes parsed catalogs. |
|
config
Package config parses and validates the plugin's block of the CPA config.
|
Package config parses and validates the plugin's block of the CPA config. |
|
fx
Package fx fetches the ECB euro reference rates through the host, persists the last good snapshot and converts it to USD-based display rates.
|
Package fx fetches the ECB euro reference rates through the host, persists the last good snapshot and converts it to USD-based display rates. |
|
intercept
Package intercept implements response.intercept_after and response.intercept_stream_chunk: price the body's own usage and annotate the response.
|
Package intercept implements response.intercept_after and response.intercept_stream_chunk: price the body's own usage and annotate the response. |
|
ledger
Package ledger converts usage.handle records into ledger rows: it derives client fingerprints, strips secrets, normalizes tokens, prices, and extracts quota observations.
|
Package ledger converts usage.handle records into ledger rows: it derives client fingerprints, strips secrets, normalizes tokens, prices, and extracts quota observations. |
|
plugin
Package plugin owns the lifecycle: register/reconfigure/quiesce/shutdown, the shared state snapshot, background workers and RPC dispatch.
|
Package plugin owns the lifecycle: register/reconfigure/quiesce/shutdown, the shared state snapshot, background workers and RPC dispatch. |
|
pricing
Package pricing is the pure pricing core: rate cards, catalog lookup, model resolution, token normalization and cost computation.
|
Package pricing is the pure pricing core: rate cards, catalog lookup, model resolution, token normalization and cost computation. |
|
quota
Package quota turns allowlisted upstream response headers into per- credential subscription quota snapshots.
|
Package quota turns allowlisted upstream response headers into per- credential subscription quota snapshots. |
|
store
Package store owns the SQLite ledger: one writer goroutine with batched transactions fed by a bounded queue, a read-only pool for API queries, and retention.
|
Package store owns the SQLite ledger: one writer goroutine with batched transactions fed by a bounded queue, a read-only pool for API queries, and retention. |
|
usagebody
Package usagebody extracts token usage from downstream response bodies and inserts cost annotations, per downstream format.
|
Package usagebody extracts token usage from downstream response bodies and inserts cost annotations, per downstream format. |
|
Package web embeds the dashboard assets.
|
Package web embeds the dashboard assets. |
Click to show internal directories.
Click to hide internal directories.