1. Init
.env.local as VENDO_API_KEY, and Vendo’s own screen turns run on it with
nothing else to set. Your own provider key works too. Init writes the
models: line that selects it, because a key
sitting loose in the environment selects nothing.
2. Share one instance
Init writescreateVendo inside the wire route. Move it to lib/vendo.ts so
your chat route uses the same instance, and export the identity init already
wrote — step 3 needs it to resolve the caller. Keep whichever line init wrote.
auth and principal fill the same seam, so createVendo refuses a config
that sets both.
3. Spread the pack
The pack takes the resolved caller — a{ kind, subject } object — so build
it inside the handler, once you know who is asking. Vendo mints no principals,
so a visitor your resolver can’t place gets a 401.
vendoModel() rides the same ladder
Vendo’s internal turns do, so the Cloud key from step 1 pays for both seats;
Mastra’s openai/… pin needs an OPENAI_API_KEY of its own. Either way:
Two models, two credentials.
Framework notes: AI SDK · Mastra.
4. Render the results
vendo_* calls arrive in your chat as dynamic-tool parts. Hand the finished
ones to <VendoToolResult>, anywhere under one <VendoProvider>.