Add Gemini option

This commit is contained in:
Thomas Krijnen
2026-04-03 10:49:36 +02:00
parent 5bcf8685ab
commit 5d748c5b04
5 changed files with 63 additions and 6 deletions
+6 -2
View File
@@ -1,6 +1,10 @@
function getChatCompletionsUrl(baseURL) {
const root = (baseURL || "https://api.openai.com/v1").replace(/\/+$/, "");
return `${root}/chat/completions`;
}
export async function chat({ apiKey, model, messages, tools }) {
const res = await fetch("https://api.openai.com/v1/chat/completions", {
export async function chat({ apiKey, baseURL, model, messages, tools }) {
const res = await fetch(getChatCompletionsUrl(baseURL), {
method: "POST",
headers: {
"Content-Type": "application/json",