Use thirdweb AI with the Vercel AI SDK

New package: @thirdweb-dev/ai-sdk-provider
- A thin provider that lets you plug thirdweb AI into the Vercel AI SDK.
It standardizes message parts, exposes wallet-aware tools (sign_transaction
, sign_swap
), and ships with types/utilities so you can build chat UIs that execute on-chain actions from AI responses.
If you’re using the Vercel AI SDK (ai
/ @ai-sdk/react
) and want your agent to request blockchain actions safely, this provider gives you:
- A server wrapper that streams AI output and tools.
- A message schema (
ThirdwebAiMessage
) compatible withuseChat
. - Ready-made thirdweb tools wired for signing and swaps.
Create a thirdweb ai provider instance and compatible with the AI SDK core by calling createThirdwebAI()
with your project secret key.
You can call useChat<ThirdwebAiMessage>()
to get typed responses and tools. This works nicely with the AI elements components to quickly build a chat UI with blockchain capabilities.
Checkout the playground example, for a more complete example, including how it handles session_id
, renders reasoning text, and handles transaction confirmations.