> Discover all available pages from the documentation index: https://mastra.zisheng.pro/ja/llms.txt # Mastra.getGatewayById() 一意の ID(Gateway インスタンスの `id` プロパティ)で Gateway を取得します。登録キーではなく Gateway 固有の識別子で検索する必要がある場合に便利です。 ## 使用例 ```typescript import { Mastra } from '@mastra/core' const mastra = new Mastra({ gateways: { customKey: new MyCustomGateway(), // id = 'my-custom-gateway' }, }) // Retrieve by ID (not registration key) const gateway = mastra.getGatewayById('my-custom-gateway') console.log(gateway.name) // 'My Custom Gateway' ``` ## ユースケース - Gateway のバージョン管理: バージョンごとに一意の ID(`'gateway-v1'`、`'gateway-v2'`)を使用 - 登録キーが不明な場合の Gateway 検索 - 異なる Mastra インスタンス間での Gateway の識別 ## パラメーター **id** (`string`): Gateway の一意の ID(gateway.id プロパティ) ## 戻り値 **gateway** (`MastraModelGateway | undefined`): Gateway インスタンス。見つからない場合は undefined ## 関連項目 - [Mastra.getGateway()](https://mastra.zisheng.pro/ja/reference/core/getGateway): 登録キーで Gateway を取得 - [Mastra.listGateways()](https://mastra.zisheng.pro/ja/reference/core/listGateways): すべての Gateway を一覧表示 - [Mastra.addGateway()](https://mastra.zisheng.pro/ja/reference/core/addGateway): Gateway を追加 - [MastraModelGateway](https://mastra.zisheng.pro/ja/reference/core/mastra-model-gateway): Gateway の基底クラス - [カスタム Gateway ガイド](https://mastra.zisheng.pro/ja/models/gateways/custom-gateways): カスタム Gateway の作成方法