Skip to content

7.4 billion tokens per month. 34 free LLM providers. 635 free model endpoints. All behind one /v1 endpoint, plus any custom OpenAI-compatible endpoint. Smart routing, automatic failover, encrypted keys. Personal experimentation only.

TypeScript

fix(groq): clamp reasoning_effort to low/medium/high (#1480)

Silvertakanaaf66698b17a3
diff --git a/server/src/__tests__/lib/sampling-params.test.ts b/server/src/__tests__/lib/sampling-params.test.ts
index 2f5a04d1..cfa8aa94 100644
--- a/server/src/__tests__/lib/sampling-params.test.ts
+++ b/server/src/__tests__/lib/sampling-params.test.ts
@@ -206,12 +206,18 @@ describe('reasoning_effort normalization (#619 — off-scale values must not 400
expect(pickSamplingParams({ reasoning_effort: 'nonsense', seed: 3 })).toEqual({ seed: 3 });
});
- it('per-platform clamping: github takes only low/medium/high', () => {
+ it('per-platform clamping: github and groq take only low/medium/high', () => {
expect(extendedBodyParams('github', { reasoning_effort: 'none' }).reasoning_effort).toBe('low');
expect(extendedBodyParams('github', { reasoning_effort: 'minimal' }).reasoning_effort).toBe('low');
expect(extendedBodyParams('github', { reasoning_effort: 'medium' }).reasoning_effort).toBe('medium');
+ // Groq's enum is the same three values, so 'none'/'minimal' are clamped
+ // instead of being sent and 400ing the request off the platform.
+ expect(extendedBodyParams('groq', { reasoning_effort: 'none' }).reasoning_effort).toBe('low');
+ expect(extendedBodyParams('groq', { reasoning_effort: 'minimal' }).reasoning_effort).toBe('low');
+ expect(extendedBodyParams('groq', { reasoning_effort: 'medium' }).reasoning_effort).toBe('medium');
+ expect(extendedBodyParams('groq', { reasoning_effort: 'high' }).reasoning_effort).toBe('high');
// Platforms without a restriction still get the value verbatim.
- expect(extendedBodyParams('groq', { reasoning_effort: 'none' }).reasoning_effort).toBe('none');
+ expect(extendedBodyParams('cerebras', { reasoning_effort: 'none' }).reasoning_effort).toBe('none');
});
});
diff --git a/server/src/lib/sampling-params.ts b/server/src/lib/sampling-params.ts
index 55b0d0d8..0262a6b3 100644
--- a/server/src/lib/sampling-params.ts
+++ b/server/src/lib/sampling-params.ts
@@ -273,8 +273,16 @@ export const PLATFORM_PARAM_POLICIES: Partial<Record<Platform, PlatformParamPoli
rename: { seed: 'random_seed' },
},
// Groq documents logprobs / top_logprobs / logit_bias as unsupported and
- // rejects requests that include them.
- groq: { drop: ['logprobs', 'top_logprobs', 'logit_bias'] },
+ // rejects requests that include them. Its reasoning_effort enum is the plain
+ // low/medium/high one as well: 'none' and 'minimal' are rejected with a 400
+ // ("must be one of low, medium, or high", observed on openai/gpt-oss-120b),
+ // which cost the request a fallback hop onto another platform's copy of the
+ // same model. Clamped rather than dropped so the knob still arrives, at the
+ // weakest setting Groq accepts.
+ groq: {
+ drop: ['logprobs', 'top_logprobs', 'logit_bias'],
+ reasoningEfforts: ['low', 'medium', 'high'],
+ },
// GitHub Models sits on Azure OpenAI, which 400s "Unrecognized request
// argument" for knobs outside the OpenAI set. Its reasoning_effort enum is
// the older low/medium/high one, so 'none'/'minimal' are clamped rather