Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

release-app pass key to deepgram

Louis Beaumont6f9038a0e388
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.toml
index 862631fce..603993b73 100644
--- a/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "0.18.1"
+version = "0.18.2"
description = ""
authors = ["you"]
license = ""
diff --git a/screenpipe-app-tauri/src-tauri/src/sidecar.rs b/screenpipe-app-tauri/src-tauri/src/sidecar.rs
index ef3f13999..b54fa91ba 100644
--- a/screenpipe-app-tauri/src-tauri/src/sidecar.rs
+++ b/screenpipe-app-tauri/src-tauri/src/sidecar.rs
@@ -368,6 +368,10 @@ fn spawn_sidecar(app: &tauri::AppHandle) -> Result<CommandChild, String> {
"DEEPGRAM_API_URL",
"https://ai-proxy.i-f9f.workers.dev/v1/listen",
);
+ // Add token if screenpipe-cloud is selected and user has a token
+ if user.token.is_some() {
+ c = c.env("CUSTOM_DEEPGRAM_API_TOKEN", user.token.as_ref().unwrap());
+ }
}
let c = c.args(&args);
@@ -394,6 +398,10 @@ fn spawn_sidecar(app: &tauri::AppHandle) -> Result<CommandChild, String> {
"DEEPGRAM_API_URL",
"https://ai-proxy.i-f9f.workers.dev/v1/listen",
);
+ // Add token if screenpipe-cloud is selected and user has a token
+ if user.token.is_some() {
+ c = c.env("CUSTOM_DEEPGRAM_API_TOKEN", user.token.as_ref().unwrap());
+ }
}
let c = c.args(&args);
diff --git a/screenpipe-audio/src/stt.rs b/screenpipe-audio/src/stt.rs
index 9a8a92914..a5e86076c 100644
--- a/screenpipe-audio/src/stt.rs
+++ b/screenpipe-audio/src/stt.rs
@@ -43,6 +43,8 @@ use std::env;
lazy_static! {
static ref DEEPGRAM_API_URL: String = env::var("DEEPGRAM_API_URL")
.unwrap_or_else(|_| "https://api.deepgram.com/v1/listen".to_string());
+ static ref CUSTOM_DEEPGRAM_API_TOKEN: String =
+ env::var("CUSTOM_DEEPGRAM_API_TOKEN").unwrap_or_else(|_| String::new());
}
async fn transcribe_with_deepgram(
@@ -55,6 +57,12 @@ async fn transcribe_with_deepgram(
debug!("starting deepgram transcription");
let client = Client::new();
+ // Use token from env var
+ let custom_api_key = CUSTOM_DEEPGRAM_API_TOKEN.as_str();
+ if custom_api_key.is_empty() {
+ return Err(anyhow!("CUSTOM_DEEPGRAM_API_TOKEN not set"));
+ }
+
// Create a WAV file in memory
let mut cursor = Cursor::new(Vec::new());
{
@@ -92,10 +100,16 @@ async fn transcribe_with_deepgram(
.concat();
}
+ let api_key_to_use = if custom_api_key.is_empty() {
+ api_key
+ } else {
+ custom_api_key
+ };
+
let response = client
.post(format!("{}?{}", *DEEPGRAM_API_URL, query_params))
.header("Content-Type", "audio/wav")
- .header("Authorization", format!("Token {}", api_key))
+ .header("Authorization", format!("Token {}", api_key_to_use))
.body(wav_data)
.send();