From 4af8ed1d040c740148d0cc806c732593c58a37a7 Mon Sep 17 00:00:00 2001 From: PixelTux Date: Thu, 26 Feb 2026 22:15:21 +0100 Subject: [PATCH] fix(openai_compat): exclude groq from prompt caching --- pkg/providers/openai_compat/provider.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/providers/openai_compat/provider.go b/pkg/providers/openai_compat/provider.go index 7dace71f2..4e17cc2e9 100644 --- a/pkg/providers/openai_compat/provider.go +++ b/pkg/providers/openai_compat/provider.go @@ -154,9 +154,11 @@ func (p *Provider) Chat( // The key is typically the agent ID — stable per agent, shared across requests. // See: https://platform.openai.com/docs/guides/prompt-caching // Prompt caching is only supported by OpenAI-native endpoints. - // Gemini and other providers reject unknown fields, so skip for non-OpenAI APIs. + // Gemini and Groq reject unknown fields, so skip for non-OpenAI APIs. if cacheKey, ok := options["prompt_cache_key"].(string); ok && cacheKey != "" { - if !strings.Contains(p.apiBase, "generativelanguage.googleapis.com") { + apiBase := strings.ToLower(p.apiBase) + if !strings.Contains(apiBase, "generativelanguage.googleapis.com") && + !strings.Contains(apiBase, "groq.com") { requestBody["prompt_cache_key"] = cacheKey } }