get_account_balance
Retrieve your Kling AI account balance and credit breakdown to monitor available resources. Designed to provide a clear overview of your usage status for effective management.
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 executes the API call to Kling AI's account balance endpoint and returns the AccountBalance data.async 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/kling-client.ts:104-107 (schema)TypeScript interface defining the structure of the account balance response (output schema).export interface AccountBalance { total_balance: number; resource_packages: ResourcePackage[]; }
- src/index.ts:422-430 (registration)Tool registration entry in the TOOLS array, including 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/index.ts:727-750 (handler)MCP server request handler case that invokes the KlingClient method and formats the response as MCP content.case '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, }, ], }; }