lightninglabs / aperture

⚡️L402 (Lightning HTTP 402) Reverse Proxy ⚡️
http://l402.tech/
MIT License
233 stars 58 forks source link

pricesrpc: add additional request context to GetPriceRequest #97

Open Roasbeef opened 1 year ago

Roasbeef commented 1 year ago

Right now we only pass along the path of the request to the backend: https://github.com/lightninglabs/aperture/blob/master/pricesrpc/rpc.proto#L12

This is useful or pricing distinct calls to diff paths, but isn't as useful for more advanced use cases. One example is proxying access to an LLM, but scaling the pricing per query, based on things like the chosen model, the context size, etc, etc. All information that will be sent along with the rest as JSON encoded body params.

We should pass along all/some of the other request level context: https://pkg.go.dev/net/http#Request

Roasbeef commented 1 year ago

Relevant context: https://github.com/lightninglabs/aperture/blob/9b85f8bbc629c17bb9c4a8f00db33dcadf68e147/proxy/proxy.go#L158-L161