summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAman <51832938+amanshaw4511@users.noreply.github.com>2025-07-29 14:30:25 +0530
committerGitHub <noreply@github.com>2025-07-29 17:00:25 +0800
commitc354f77baaed8df4a9bb114293b6e86d51d8fdaa (patch)
tree2a790e0e90ec2f529298242ec2ae403c415a3d4f /src
parent1ce2b6e1f91b307a84e69c6c7f0bf3adf317c1d2 (diff)
downloadaichat-c354f77baaed8df4a9bb114293b6e86d51d8fdaa.tar.gz
feat: gemini pass API key in header for security (#1360)
Co-authored-by: Aman Shaw <amanshaw4511@protonmail.com> Co-authored-by: aman <aman.saw@batonsystems.com>
Diffstat (limited to 'src')
-rw-r--r--src/client/gemini.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/client/gemini.rs b/src/client/gemini.rs
index 77304e7..3c8778d 100644
--- a/src/client/gemini.rs
+++ b/src/client/gemini.rs
@@ -52,16 +52,17 @@ fn prepare_chat_completions(
};
let url = format!(
- "{}/models/{}:{}?key={}",
+ "{}/models/{}:{}",
api_base.trim_end_matches('/'),
self_.model.real_name(),
- func,
- api_key
+ func
);
let body = gemini_build_chat_completions_body(data, &self_.model)?;
- let request_data = RequestData::new(url, body);
+ let mut request_data = RequestData::new(url, body);
+
+ request_data.header("x-goog-api-key", api_key);
Ok(request_data)
}