You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: app/(chat)/api/chat/route.ts
+11-1Lines changed: 11 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -220,7 +220,17 @@ export async function POST(request: Request) {
220
220
});
221
221
}
222
222
},
223
-
onError: ()=>"Oops, an error occurred!",
223
+
onError: (error)=>{
224
+
if(
225
+
errorinstanceofError&&
226
+
error.message?.includes(
227
+
"AI Gateway requires a valid credit card on file to service requests",
228
+
)
229
+
){
230
+
return"AI Gateway requires a valid credit card on file to service requests. Please visit https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%3Fmodal%3Dadd-credit-card to add a card and unlock your free credits.";
0 commit comments