From c30a9f3f3edbb623175adddabdee1177ef81b240 Mon Sep 17 00:00:00 2001 From: Elias Kohout Date: Sat, 14 Feb 2026 20:00:19 +0100 Subject: [PATCH] change ai provider from openai to openrouter --- Dockerfile | 2 +- src/internal/util/openai.go | 21 +++------------------ 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5e73f5a..e557d66 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # --- Stage 1: Build the Go application --- -FROM golang:1.23 AS builder +FROM golang:1.24 AS builder ENV CGO_ENABLED=0 ENV GOOS=linux diff --git a/src/internal/util/openai.go b/src/internal/util/openai.go index 02603a6..33ec713 100644 --- a/src/internal/util/openai.go +++ b/src/internal/util/openai.go @@ -7,8 +7,6 @@ import ( "fmt" "io" "net/http" - - "github.com/pkoukk/tiktoken-go" ) type response struct { @@ -24,14 +22,14 @@ type OpenAi struct { } func (oai *OpenAi) Summarize(text string) (string, error) { - apiURL := "https://api.openai.com/v1/chat/completions" + apiURL := "https://openrouter.ai/api/v1/chat/completions" // Request payload payload := map[string]interface{}{ - "model": "gpt-4o-mini", + "model": "google/gemini-2.5-flash-lite", "messages": []map[string]string{ { - "role": "developer", + "role": "system", "content": "Fasse den folgenden Zeitungsartikel in maximal 75 Wörtern zusammen. Konzentriere dich auf die wichtigsten Informationen, wie das Hauptthema, die zentralen Aussagen und relevante Hintergründe. Gib **außschließlich** die Zusammenfassung zurück.", }, { @@ -88,16 +86,3 @@ func (oai *OpenAi) Summarize(text string) (string, error) { return content, nil } - -func (oai *OpenAi) CountTokens(text string) int { - tkm, err := tiktoken.GetEncoding("o200k_base") - if err != nil { - err = fmt.Errorf("getEncoding: %v", err) - return -1 - } - - // encode - token := tkm.Encode(text, nil, nil) - - return len(token) -}