Open
Description
Feature Description
For useChat
, if we need to pass the Authorization: Bearer ${token} to it, given we should not have auth code on the client side, I presume (1) either have useChat on the server side; or (2) have a customized API like /api/custom-chat
on the vercel servide, that API invokes the fastapi API /fastapi/custom-chat
.
But I don't see any example nor discussion about it. Please illustrate.
useChat({
api: chatEndpoint,
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
...
https://github.com/vercel/ai/blob/main/examples/next-fastapi/app/(examples)/01-chat-text/page.tsx
Use Cases
No response
Additional context
No response