Function: useMastraModels()
useMastraModels(
enabled?):object
Fetch the cached Model Serving endpoint catalogue exposed by the
Mastra plugin (client.models()). Filters out non-LLM endpoints
(anything without a llm/v1/* task) so the dropdown doesn’t surface
embedding / vision / agent-bricks endpoints. The response itself is
server-cached for 5 minutes so polling cost is negligible.
Pass enabled: false to skip the fetch entirely (e.g. when the
model picker is hidden), in which case models stays empty.
Parameters
Section titled “Parameters”enabled?
Section titled “enabled?”boolean = true
Returns
Section titled “Returns”object
error:
Error|null
loading
Section titled “loading”loading:
boolean
models
Section titled “models”models:
object[]