get_wallet_balance
Check your Prime Intellect wallet balance and recent billings to estimate how long a quoted pod can run or diagnose insufficient-funds errors.
Instructions
Return the current Prime Intellect wallet balance and recent billings.
Use this to estimate how long a quoted pod can run, or to check why pod_create returned an insufficient-funds error.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The actual tool handler for get_wallet_balance. It is an async function decorated with @mcp.tool, calls clients.wallet.get(limit=5), and returns the wallet data as a dict.
@mcp.tool async def get_wallet_balance() -> dict[str, Any]: """Return the current Prime Intellect wallet balance and recent billings. Use this to estimate how long a quoted pod can run, or to check why pod_create returned an insufficient-funds error. """ clients = await get_clients() try: wallet = clients.wallet.get(limit=5) except Exception as e: raise _err(e) from e return wallet.model_dump() - src/prime_intellect_mcp/server.py:161-173 (registration)The tool is registered via the @mcp.tool decorator on line 161, making it available as 'get_wallet_balance' on the FastMCP server.
@mcp.tool async def get_wallet_balance() -> dict[str, Any]: """Return the current Prime Intellect wallet balance and recent billings. Use this to estimate how long a quoted pod can run, or to check why pod_create returned an insufficient-funds error. """ clients = await get_clients() try: wallet = clients.wallet.get(limit=5) except Exception as e: raise _err(e) from e return wallet.model_dump() - The handler takes no parameters and returns dict[str, Any] — no Pydantic schema or Field is defined for inputs since this tool needs no arguments.
@mcp.tool async def get_wallet_balance() -> dict[str, Any]: """Return the current Prime Intellect wallet balance and recent billings. Use this to estimate how long a quoted pod can run, or to check why pod_create returned an insufficient-funds error. """ clients = await get_clients() try: wallet = clients.wallet.get(limit=5) except Exception as e: raise _err(e) from e return wallet.model_dump() - The wallet_balance_usd field on PodQuote model used by the tool for reporting balance information in quotes.
wallet_balance_usd: float | None = Field( default=None, description="Current wallet balance in USD; None if not retrievable.", ) estimated_runway_hours: float | None = Field( default=None, description="wallet_balance_usd / hourly_usd, if both known.", ) - The check_caps function is used elsewhere in the server to validate wallet balance against spend caps.
def check_caps( hourly_usd: float, max_lifetime_hours: int, wallet_balance_usd: float | None, ) -> None: """Raise SpendCapExceeded with a model-readable explanation if any cap is breached.""" h_cap = max_hourly_usd() t_cap = max_total_usd() estimated_total = hourly_usd * max_lifetime_hours if hourly_usd > h_cap: raise SpendCapExceeded( f"Hourly rate ${hourly_usd:.2f}/hr exceeds PRIME_MAX_HOURLY_USD cap of " f"${h_cap:.2f}/hr. Either pick a cheaper GPU or raise the cap." ) if estimated_total > t_cap: raise SpendCapExceeded( f"Estimated total ${estimated_total:.2f} (={hourly_usd:.2f} × " f"{max_lifetime_hours}h) exceeds PRIME_MAX_TOTAL_USD cap of " f"${t_cap:.2f}. Either lower max_lifetime_hours or raise the cap." ) if wallet_balance_usd is not None and estimated_total > wallet_balance_usd: raise SpendCapExceeded( f"Estimated total ${estimated_total:.2f} exceeds wallet balance " f"${wallet_balance_usd:.2f}. Top up at primeintellect.ai/wallet " "or lower max_lifetime_hours." )