From beb7e432d66a892e9cf8219eef94992120120e36 Mon Sep 17 00:00:00 2001 From: Agustin Torres Date: Mon, 26 Oct 2026 20:39:21 +0000 Subject: [PATCH 1/2] fix(groq): replace the models api.groq.com retired Groq has shut down the default model, llama3-70b-8192, and the other models in our Groq list, so requests naming them now fail. The Groq default and recommended model are now openai/gpt-oss-120b, and the Groq model list now offers Groq's named replacements, openai/gpt-oss-120b and openai/gpt-oss-20b. Duplicates are merged and llama-guard-3-8b is kept. Notice groq-retired-models-2026-08 about api.groq.com's API describes the change. It was read from a file and is not signed by the provider. --- src/commands/config.ts | 12 ++++-------- src/utils/errors.ts | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/commands/config.ts b/src/commands/config.ts index f4033864..1b82240a 100644 --- a/src/commands/config.ts +++ b/src/commands/config.ts @@ -92,13 +92,9 @@ export const MODEL_LIST = { ], groq: [ - 'llama3-70b-8192', // Meta Llama 3 70B (default one, no daily token limit and 14 400 reqs/day) - 'llama3-8b-8192', // Meta Llama 3 8B - 'llama-guard-3-8b', // Llama Guard 3 8B - 'llama-3.1-8b-instant', // Llama 3.1 8B (Preview) - 'llama-3.1-70b-versatile', // Llama 3.1 70B (Preview) - 'gemma-7b-it', // Gemma 7B - 'gemma2-9b-it' // Gemma 2 9B + 'openai/gpt-oss-120b', // GPT-OSS 120B (default one) + 'openai/gpt-oss-20b', // GPT-OSS 20B + 'llama-guard-3-8b' // Llama Guard 3 8B ], mistral: [ @@ -932,7 +928,7 @@ export const RECOMMENDED_MODELS: Record = { [OCO_AI_PROVIDER_ENUM.OPENAI]: 'gpt-4o-mini', [OCO_AI_PROVIDER_ENUM.ANTHROPIC]: 'claude-sonnet-4-6', [OCO_AI_PROVIDER_ENUM.GEMINI]: 'gemini-1.5-flash', - [OCO_AI_PROVIDER_ENUM.GROQ]: 'llama3-70b-8192', + [OCO_AI_PROVIDER_ENUM.GROQ]: 'openai/gpt-oss-120b', [OCO_AI_PROVIDER_ENUM.MISTRAL]: 'mistral-small-latest', [OCO_AI_PROVIDER_ENUM.DEEPSEEK]: 'deepseek-v4-flash', [OCO_AI_PROVIDER_ENUM.OPENROUTER]: 'openai/gpt-4o-mini', diff --git a/src/utils/errors.ts b/src/utils/errors.ts index 40925cd4..9aec36bf 100644 --- a/src/utils/errors.ts +++ b/src/utils/errors.ts @@ -199,7 +199,7 @@ export function getRecommendedModel(provider: string): string | null { case OCO_AI_PROVIDER_ENUM.GEMINI: return 'gemini-1.5-flash'; case OCO_AI_PROVIDER_ENUM.GROQ: - return 'llama3-70b-8192'; + return 'openai/gpt-oss-120b'; case OCO_AI_PROVIDER_ENUM.MISTRAL: return 'mistral-small-latest'; case OCO_AI_PROVIDER_ENUM.DEEPSEEK: From 62a8aeb748beaaccc91bb93b8a821c4be94b4bb5 Mon Sep 17 00:00:00 2001 From: Agustin Torres Date: Fri, 13 Nov 2026 00:52:09 +0000 Subject: [PATCH 2/2] fix(groq): treat the gpt-oss models as reasoning models Groq's openai/gpt-oss-* models, the new default and its replacement, are reasoning models: their reasoning counts toward the completion limit. When OCO_REASONING is not set, the Groq engine now sends max_completion_tokens with OCO_REASONING_MAX_TOKENS instead of max_tokens and the sampling parameters, and the diff splitting reserves that budget too. Other providers send the same requests as before, and an explicit OCO_REASONING still wins. --- src/engine/groq.ts | 11 ++++++++++ src/generateCommitMessageFromGitDiff.ts | 6 +++++- test/unit/openAi.test.ts | 28 +++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/engine/groq.ts b/src/engine/groq.ts index bed882dd..952de0d5 100644 --- a/src/engine/groq.ts +++ b/src/engine/groq.ts @@ -2,9 +2,20 @@ import { OpenAiConfig, OpenAiEngine } from './openAi'; interface GroqConfig extends OpenAiConfig {} +// Groq serves OpenAI's gpt-oss models as reasoning models: their reasoning +// counts toward the completion token limit. +export const isGroqReasoningModel = (model: string): boolean => + /^openai\/gpt-oss/.test(model); + export class GroqEngine extends OpenAiEngine { constructor(config: GroqConfig) { config.baseURL = 'https://api.groq.com/openai/v1'; + if ( + typeof config.isReasoning !== 'boolean' && + isGroqReasoningModel(config.model) + ) { + config.isReasoning = true; + } super(config); } } diff --git a/src/generateCommitMessageFromGitDiff.ts b/src/generateCommitMessageFromGitDiff.ts index ab9975cf..c799d51f 100644 --- a/src/generateCommitMessageFromGitDiff.ts +++ b/src/generateCommitMessageFromGitDiff.ts @@ -7,8 +7,10 @@ import { setGlobalConfig, getGlobalConfig, MODEL_LIST, + OCO_AI_PROVIDER_ENUM, RECOMMENDED_MODELS } from './commands/config'; +import { isGroqReasoningModel } from './engine/groq'; import { getMainCommitPrompt } from './prompts'; import { getEngine } from './utils/engine'; import { @@ -162,7 +164,9 @@ export const generateCommitMessageByDiff = async ( const isReasoningModel = typeof currentConfig.OCO_REASONING === 'boolean' ? currentConfig.OCO_REASONING - : /^(o[1-9]|gpt-5)/.test(currentModel); + : /^(o[1-9]|gpt-5)/.test(currentModel) || + (provider === OCO_AI_PROVIDER_ENUM.GROQ && + isGroqReasoningModel(currentModel)); const maxInputTokens = currentConfig.OCO_TOKENS_MAX_INPUT ?? diff --git a/test/unit/openAi.test.ts b/test/unit/openAi.test.ts index f2780492..7ecb1c9e 100644 --- a/test/unit/openAi.test.ts +++ b/test/unit/openAi.test.ts @@ -1,5 +1,6 @@ import { OpenAI } from 'openai'; import { getConfig } from '../../src/commands/config'; +import { GroqEngine } from '../../src/engine/groq'; import { OpenAiEngine } from '../../src/engine/openAi'; import { getEngine } from '../../src/utils/engine'; import { prepareFile } from './utils'; @@ -136,6 +137,33 @@ describe('OpenAiEngine', () => { ); }); + it('uses max_completion_tokens for Groq gpt-oss reasoning models', async () => { + const engine = new GroqEngine({ + ...baseConfig, + model: 'openai/gpt-oss-120b' + }); + + const create = jest + .spyOn(engine.client.chat.completions, 'create') + .mockResolvedValue({ + choices: [{ message: { content: 'feat(groq): reasoning path' } }] + } as any); + + await engine.generateCommitMessage(messages); + + expect(create).toHaveBeenCalledWith( + expect.objectContaining({ + model: 'openai/gpt-oss-120b', + max_completion_tokens: 1024 + }) + ); + expect(create).toHaveBeenCalledWith( + expect.not.objectContaining({ + max_tokens: expect.anything() + }) + ); + }); + it('auto-detects a reasoning model through the real default config and engine path', async () => { const envFile = await prepareFile('.env', '');