From 205687fc8939e99de902c8cbbcca40fbc4bc9ffa Mon Sep 17 00:00:00 2001 From: Felix Martin Date: Mon, 3 Aug 2026 20:38:34 -0400 Subject: [PATCH] Identify Blurt in OpenRouter requests --- blurt.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/blurt.py b/blurt.py index 8b4e17b..2b1c613 100644 --- a/blurt.py +++ b/blurt.py @@ -24,6 +24,8 @@ from scipy.io import wavfile OPENAI_TRANSCRIPTIONS_URL = "https://api.openai.com/v1/audio/transcriptions" OPENROUTER_TRANSCRIPTIONS_URL = "https://openrouter.ai/api/v1/audio/transcriptions" +OPENROUTER_APP_URL = "https://git.felixm.de/felixm/blurt" +OPENROUTER_APP_TITLE = "Blurt" DEFAULT_TRANSCRIPTION_MODEL = "whisper-1" DEFAULT_TRANSCRIPTION_LANGUAGE = "en" # (model_id, menu_label, provider). The provider selects both the API endpoint @@ -547,7 +549,11 @@ class BlurtApp: audio_b64 = base64.b64encode(wav_bytes).decode("ascii") response = self.session.post( OPENROUTER_TRANSCRIPTIONS_URL, - headers={"Authorization": f"Bearer {self.api_keys['openrouter']}"}, + headers={ + "Authorization": f"Bearer {self.api_keys['openrouter']}", + "HTTP-Referer": OPENROUTER_APP_URL, + "X-OpenRouter-Title": OPENROUTER_APP_TITLE, + }, json={ "model": self.transcription_model, "input_audio": {"data": audio_b64, "format": "wav"},