check_balance
Check your YaparAI credit balance and total credits used with no charge for this operation.
Instructions
Check your YaparAI credit balance.
Returns your current credit balance, total credits used, and the currency (credits).
No credits are charged for this operation.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/yaparai/tools/balance.py:8-18 (handler)Handler: async function that creates a YaparAIClient and calls get_balance() to retrieve the credit balance.
async def check_balance() -> dict: """ Check your YaparAI credit balance. Returns your current credit balance, total credits used, and the currency (credits). No credits are charged for this operation. """ client = YaparAIClient() return await client.get_balance() - src/yaparai/client.py:134-136 (helper)Helper: YaparAIClient.get_balance() makes a GET request to /v1/public/balance to fetch credit balance from the API.
async def get_balance(self) -> dict: """Get credit balance.""" return await self._request("GET", "/v1/public/balance") - src/yaparai/server.py:185-185 (registration)Registration: The check_balance function is registered as an MCP tool via mcp.tool(check_balance).
mcp.tool(check_balance) - src/yaparai/client.py:64-64 (helper)Helper: The _request method is the underlying HTTP request handler with retry logic used by get_balance().
async def _request(self, method: str, path: str, retries: int = 3, **kwargs) -> dict: - src/yaparai/server.py:104-104 (registration)Registration: Import statement that brings check_balance into the server module for registration.
from yaparai.tools.balance import check_balance