get_account_balance
Check your Kling AI account balance and available credits to monitor your video generation resource usage and account status.
Instructions
Check your Kling AI account balance and total available credits. Provides a comprehensive overview of your account status including total balance and breakdown by resource packages.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/kling-client.ts:467-479 (handler)Core handler function that makes API call to retrieve Kling AI account balanceasync getAccountBalance(): Promise<AccountBalance> { const path = '/v1/account/balance'; try { const response = await this.axiosInstance.get(path); return response.data.data; } catch (error) { if (axios.isAxiosError(error)) { throw new Error(`Kling API error: ${error.response?.data?.message || error.message}`); } throw error; } }
- src/index.ts:727-750 (handler)MCP server handler case that invokes klingClient.getAccountBalance and formats response for the tool callcase 'get_account_balance': { const balance = await klingClient.getAccountBalance(); let balanceText = `Kling AI Account Balance:\n\nTotal Balance: ${balance.total_balance} credits`; if (balance.resource_packages && balance.resource_packages.length > 0) { balanceText += '\n\nResource Packages Breakdown:'; balance.resource_packages.forEach((pkg, index) => { balanceText += `\n\nPackage ${index + 1}:`; balanceText += `\n- Name: ${pkg.name}`; balanceText += `\n- Amount: ${pkg.amount} credits`; balanceText += `\n- Expires: ${new Date(pkg.expire_at).toLocaleString()}`; }); } return { content: [ { type: 'text', text: balanceText, }, ], }; }
- src/index.ts:422-430 (registration)Tool registration in TOOLS array with name, description, and empty input schema{ name: 'get_account_balance', description: 'Check your Kling AI account balance and total available credits. Provides a comprehensive overview of your account status including total balance and breakdown by resource packages.', inputSchema: { type: 'object', properties: {}, required: [], }, },
- src/kling-client.ts:104-107 (schema)TypeScript interface defining the output structure of account balance response (schema for handler result)export interface AccountBalance { total_balance: number; resource_packages: ResourcePackage[]; }