> Discover all available pages from the documentation index: https://mastra.zisheng.pro/llms.txt # Mastra.listGateways() 返回以注册键为索引的所有已注册 gateway 的记录。 ## 使用示例 ```typescript import { Mastra } from '@mastra/core' const mastra = new Mastra({ gateways: { myGateway: new MyCustomGateway(), anotherGateway: new AnotherGateway(), }, }) const gateways = mastra.listGateways() console.log(Object.keys(gateways)) // ['myGateway', 'anotherGateway'] // Iterate over all gateways for (const [key, gateway] of Object.entries(gateways)) { console.log(`${key}: ${gateway.name}`) } ``` ## 参数 无。 ## 返回值 **gateways** (`Record`): 以注册键为索引的 gateway 实例记录 ## 相关内容 - [Mastra.getGateway()](https://mastra.zisheng.pro/reference/core/getGateway): 按注册键获取 gateway - [Mastra.getGatewayById()](https://mastra.zisheng.pro/reference/core/getGatewayById): 按 ID 获取 gateway - [Mastra.addGateway()](https://mastra.zisheng.pro/reference/core/addGateway): 添加 gateway - [MastraModelGateway](https://mastra.zisheng.pro/reference/core/mastra-model-gateway): Gateway 基类 - [自定义 Gateway 指南](https://mastra.zisheng.pro/models/gateways/custom-gateways): 创建自定义 gateway