Utilities toAiMessageProps and mapMessageParts are auto-imported. For RAG and custom transports see Custom Transport & RAG.
useAiChat(options?)
With api: wraps @ai-sdk/vue Chat + DefaultChatTransport. Supports body, headers, credentials (plain or () => ({ ... })) for dynamic requests. Without api: local-only messages.
const chat = useAiChat({
api: '/api/chat',
body: () => ({ conversationId: id.value, model: model.value }),
})
useAiChatLocal(options?)
Local message array for demos and custom backends. Same surface shape as useAiChat without network.
const chat = useAiChatLocal({ initialMessages: [] })
useAiChatPersisted(options?)
Persists local-only chats to localStorage/sessionStorage. With api, persistence hooks are no-ops.
const chat = useAiChatPersisted({ key: 'chat', storage: 'localStorage' })
useAiAgent(options?)
Agent steps, plan, tasks, pendingConfirmation, approve/deny on top of useAiChat.
const agent = useAiAgent({ api: '/api/chat' })
useAiTools(defs, agent)
Declarative per-tool metadata; pendingApprovals, getToolMeta, approveTool/denyTool.
const tools = useAiTools([{ name: 'search' }], agent)
useAiWorkflow(data?, options?)
Graph state: nodes, edges, selection, add/remove/move, canConnect, toJSON/fromJSON.
const wf = useAiWorkflow({ nodes: [], edges: [] })
useAiCompletion(options?)
Thin wrapper around @ai-sdk/vue useCompletion.
const { completion, complete } = useAiCompletion({ api: '/api/completion' })
useAiMarkdown(content, options?)
Markdown to sanitized HTML (GFM via marked, sanitized). Pass { parse: simpleParse } for a lightweight fallback that skips tables — useful during streaming when marked's buffering causes layout shifts. simpleParse is auto-imported in Nuxt.
// Default (GFM + tables via marked):
const { html } = useAiMarkdown(() => markdownSource)
// Lightweight fallback during streaming (no tables, no marked):
const { html } = useAiMarkdown(() => markdownSource, { parse: simpleParse })