mirror of
https://github.com/Gitlawb/openclaude.git
synced 2026-08-24 10:14:19 -05:00
fix(groq): strip unsupported store field (#983)
This commit is contained in:
@@ -159,11 +159,13 @@ export OPENAI_MODEL=meta-llama/Llama-3.3-70B-Instruct-Turbo
|
||||
|
||||
```bash
|
||||
export CLAUDE_CODE_USE_OPENAI=1
|
||||
export OPENAI_API_KEY=gsk_...
|
||||
export GROQ_API_KEY=gsk_...
|
||||
export OPENAI_BASE_URL=https://api.groq.com/openai/v1
|
||||
export OPENAI_MODEL=llama-3.3-70b-versatile
|
||||
```
|
||||
|
||||
`GROQ_API_KEY` matches the built-in Groq gateway preset. `OPENAI_API_KEY` also works as a fallback on the generic OpenAI-compatible path, but `GROQ_API_KEY` is the preferred variable for Groq-specific setup.
|
||||
|
||||
### Mistral
|
||||
|
||||
```bash
|
||||
|
||||
@@ -16,6 +16,7 @@ export default defineGateway({
|
||||
kind: 'openai-compatible',
|
||||
openaiShim: {
|
||||
supportsAuthHeaders: true,
|
||||
removeBodyFields: ['store'],
|
||||
},
|
||||
},
|
||||
preset: {
|
||||
|
||||
@@ -4098,6 +4098,40 @@ test('Moonshot: uses max_tokens (not max_completion_tokens) and strips store', a
|
||||
expect(requestBody?.store).toBeUndefined()
|
||||
})
|
||||
|
||||
test('Groq: keeps max_completion_tokens and strips unsupported store', async () => {
|
||||
process.env.OPENAI_BASE_URL = 'https://api.groq.com/openai/v1'
|
||||
process.env.OPENAI_API_KEY = 'gsk-test'
|
||||
|
||||
let requestBody: Record<string, unknown> | undefined
|
||||
globalThis.fetch = (async (_input, init) => {
|
||||
requestBody = JSON.parse(String(init?.body))
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
id: 'chatcmpl-1',
|
||||
model: 'llama-3.3-70b-versatile',
|
||||
choices: [
|
||||
{ message: { role: 'assistant', content: 'ok' }, finish_reason: 'stop' },
|
||||
],
|
||||
usage: { prompt_tokens: 3, completion_tokens: 1, total_tokens: 4 },
|
||||
}),
|
||||
{ headers: { 'Content-Type': 'application/json' } },
|
||||
)
|
||||
}) as FetchType
|
||||
|
||||
const client = createOpenAIShimClient({}) as OpenAIShimClient
|
||||
await client.beta.messages.create({
|
||||
model: 'llama-3.3-70b-versatile',
|
||||
system: 'you are groq',
|
||||
messages: [{ role: 'user', content: 'hi' }],
|
||||
max_tokens: 256,
|
||||
stream: false,
|
||||
})
|
||||
|
||||
expect(requestBody?.max_completion_tokens).toBe(256)
|
||||
expect(requestBody?.max_tokens).toBeUndefined()
|
||||
expect(requestBody?.store).toBeUndefined()
|
||||
})
|
||||
|
||||
test('Moonshot: echoes reasoning_content on assistant tool-call messages', async () => {
|
||||
// Regression for: "API Error: 400 {"error":{"message":"thinking is enabled
|
||||
// but reasoning_content is missing in assistant tool call message at index
|
||||
|
||||
Reference in New Issue
Block a user