get_credits
Check your available credits for generating videos and images with Luma AI's Dream Machine.
Instructions
Gets credit information for the current user
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_credits"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/luma_ai_mcp_server/server.py:461-472 (handler)The handler function that executes the get_credits tool by calling the Luma API /credits endpoint and formatting the credit balance.
async def get_credits(parameters: dict) -> str: """Get the credit information for the current user.""" try: result = await _make_luma_request("GET", "/credits") if not isinstance(result, dict): raise ValueError("Invalid response from API") return f"Credit Information:\nAvailable Credits: {result.get('credit_balance', 0)}" except Exception as e: logger.error(f"Error in get_credits: {str(e)}", exc_info=True) return f"Error retrieving credit information: {str(e)}" - Pydantic input schema for the get_credits tool (no parameters required).
class GetCreditsInput(BaseModel): pass - src/luma_ai_mcp_server/server.py:538-542 (registration)Registration of the get_credits tool in the list_tools() function.
Tool( name=LumaTools.GET_CREDITS, description="Gets credit information for the current user", inputSchema=GetCreditsInput.model_json_schema(), ), - src/luma_ai_mcp_server/server.py:587-589 (registration)Dispatch case for get_credits in the call_tool() function.
case LumaTools.GET_CREDITS: result = await get_credits(arguments) return [TextContent(type="text", text=result)] - src/luma_ai_mcp_server/server.py:103-103 (registration)Tool name constant in LumaTools enum.
GET_CREDITS = "get_credits"