跳到主要内容
非官方简体中文翻译,内容版权归 Mastra 所有,遵循 Apache-2.0 许可。

Mastra.listGateways()

Returns a record of all registered gateways, indexed by their registration keys.

Usage example
Usage example的直接链接

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}`)
}

Parameters
Parameters的直接链接

None.

Returns
Returns的直接链接

gateways:

Record<string, MastraModelGateway>
A record of gateway instances indexed by registration key
On this page