You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
OpenRouter's BYOK billing rule lives in Imp.Core #265
Imp.Core.reported_cost/2 knows about OpenRouter's bring-your-own-key (BYOK) billing: when usage["is_byok"] is true, it adds cost_details.upstream_inference_cost to "cost". That's a single provider's billing rule sitting in Imp's provider-neutral core. It belongs with the OpenRouter-specific code, in Imp.Clients.ReqLLM, or in ReqLLM's OpenRouter provider if that's where usage gets normalised. Core should then read one provider-neutral charge.
Done when core has no provider names in it, the BYOK behaviour is unchanged (the existing tests pass), and those tests live beside the OpenRouter-specific code.
Imp.Core.reported_cost/2 matched usage with "is_byok" and added "cost" to cost_details.upstream_inference_cost. The OpenRouter field names and the fee-plus-upstream rule sat in the provider-neutral cost reader instead of with the client that sees OpenRouter usage.
Imp.Clients.ReqLLM.resolve_openrouter_charge/2 now resolves a charge only for an OpenRouter model whose usage has "is_byok": the fee plus upstream_inference_cost when both are numbers, otherwise nil.
Status, 2026-10-08: #303 is open for this. Its checks have not run, as a first-time contributor's run needs approval, and it has no review. Moved to In review.
Activity
deepfates commentedon Oct 8, 2026
Triage, 2026-10-08: still open. The BYOK rule is still in
Imp.Core.reported_cost/2(lib/imp/core.ex:305-310) on main (b736d00).mvanhorn commentedon Oct 8, 2026
Imp.Core.reported_cost/2 matched usage with "is_byok" and added "cost" to cost_details.upstream_inference_cost. The OpenRouter field names and the fee-plus-upstream rule sat in the provider-neutral cost reader instead of with the client that sees OpenRouter usage.
Imp.Clients.ReqLLM.resolve_openrouter_charge/2 now resolves a charge only for an OpenRouter model whose usage has "is_byok": the fee plus upstream_inference_cost when both are numbers, otherwise nil.
deepfates commentedon Oct 8, 2026
Status, 2026-10-08: #303 is open for this. Its checks have not run, as a first-time contributor's run needs approval, and it has no review. Moved to In review.
Move OpenRouter BYOK billing out of Imp.Core (#303)