Skip to content

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.

boolean = true

object

error: Error | null

loading: boolean

models: object[]