diff --git a/src/khoj/interface/web/chat.html b/src/khoj/interface/web/chat.html
index e85759fb..aa6bd4b9 100644
--- a/src/khoj/interface/web/chat.html
+++ b/src/khoj/interface/web/chat.html
@@ -642,6 +642,8 @@ To get started, just start typing below. You can also type / to see a list of co
flashStatusInChatInput("⛔️ Configure speech-to-text model on server.")
} else if (err.status === 422) {
flashStatusInChatInput("⛔️ Audio file to large to process.")
+ } else if (err.status === 429) {
+ flashStatusInChatInput("⛔️ " + err.statusText);
} else {
flashStatusInChatInput("⛔️ Failed to transcribe audio.")
}
diff --git a/src/khoj/routers/api.py b/src/khoj/routers/api.py
index 65516a9c..a4063afa 100644
--- a/src/khoj/routers/api.py
+++ b/src/khoj/routers/api.py
@@ -606,7 +606,13 @@ async def chat_options(
@api.post("/transcribe")
@requires(["authenticated"])
-async def transcribe(request: Request, common: CommonQueryParams, file: UploadFile = File(...)):
+async def transcribe(
+ request: Request,
+ common: CommonQueryParams,
+ file: UploadFile = File(...),
+ rate_limiter_per_minute=Depends(ApiUserRateLimiter(requests=1, subscribed_requests=10, window=60)),
+ rate_limiter_per_day=Depends(ApiUserRateLimiter(requests=10, subscribed_requests=600, window=60 * 60 * 24)),
+):
user: KhojUser = request.user.object
audio_filename = f"{user.uuid}-{str(uuid.uuid4())}.webm"
user_message: str = None