Implement LLM-WP-0008: provider-scoped account balance CLI
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:
parent
c0d5c4ad08
commit
ed7c632155
11 changed files with 783 additions and 14 deletions
|
|
@ -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.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue