Implement LLM-WP-0008: provider-scoped account balance CLI
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s

Add pluggable balance registry, OpenRouter credits/key limit client,
and llm-connect balance with one-shot --provider that does not change
library defaults.
This commit is contained in:
tegwick 2026-08-03 23:49:01 +02:00
parent c0d5c4ad08
commit ed7c632155
11 changed files with 783 additions and 14 deletions

View file

@ -90,6 +90,30 @@ class LLMBudgetExceededError(LLMError):
self.requested = requested
class LLMBalanceUnsupportedError(LLMConfigurationError):
"""Account balance is not supported for the selected provider.
Attributes:
provider: Provider id that was requested.
supported: Provider ids that currently implement balance.
"""
def __init__(
self,
message: str,
provider: str = "",
supported: Optional[list[str]] = None,
cause: Optional[Exception] = None,
context: Optional[Dict[str, Any]] = None,
):
supported_list = list(supported or [])
if context is None:
context = {"provider": provider, "supported": supported_list}
super().__init__(message, cause=cause, context=context)
self.provider = provider
self.supported = supported_list
class LLMSubprocessError(LLMError):
"""Claude Code CLI subprocess failed.