@openclaw/groq-provider 2026.7.2-beta.3 → 2026.7.2-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/api.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region extensions/groq/api.ts
2
- const GROQ_QWEN3_32B_ID = "qwen/qwen3-32b";
2
+ const GROQ_QWEN3_6_27B_ID = "qwen/qwen3.6-27b";
3
3
  const GROQ_GPT_OSS_REASONING_IDS = /* @__PURE__ */ new Set([
4
4
  "openai/gpt-oss-20b",
5
5
  "openai/gpt-oss-120b",
@@ -27,7 +27,7 @@ function normalizeGroqModelId(modelId) {
27
27
  }
28
28
  function resolveGroqReasoningCompatPatch(modelId) {
29
29
  const normalized = normalizeGroqModelId(modelId);
30
- if (normalized === GROQ_QWEN3_32B_ID) return {
30
+ if (normalized === GROQ_QWEN3_6_27B_ID) return {
31
31
  supportsReasoningEffort: true,
32
32
  supportedReasoningEfforts: [...GROQ_QWEN_REASONING_EFFORTS],
33
33
  reasoningEffortMap: GROQ_QWEN_REASONING_EFFORT_MAP
package/dist/index.js CHANGED
@@ -1,38 +1,283 @@
1
1
  import { groqMediaUnderstandingProvider } from "./media-understanding-provider.js";
2
- import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
3
- import { createProviderApiKeyAuthMethod } from "openclaw/plugin-sdk/provider-auth-api-key";
2
+ import { createAssistantMessageEventStream, streamSimple } from "openclaw/plugin-sdk/llm";
3
+ import { defineSingleProviderPluginEntry } from "openclaw/plugin-sdk/provider-entry";
4
+ //#region extensions/groq/openclaw.plugin.json
5
+ var openclaw_plugin_default = {
6
+ id: "groq",
7
+ activation: { "onStartup": false },
8
+ enabledByDefault: true,
9
+ providers: ["groq"],
10
+ providerEndpoints: [{
11
+ "endpointClass": "groq-native",
12
+ "hosts": ["api.groq.com"]
13
+ }],
14
+ providerRequest: { "providers": { "groq": { "family": "groq" } } },
15
+ setup: { "providers": [{
16
+ "id": "groq",
17
+ "authMethods": ["api-key"],
18
+ "envVars": ["GROQ_API_KEY"]
19
+ }] },
20
+ providerAuthChoices: [{
21
+ "provider": "groq",
22
+ "method": "api-key",
23
+ "choiceId": "groq-api-key",
24
+ "appGuidedSecret": true,
25
+ "choiceLabel": "Groq API key",
26
+ "choiceHint": "Fast OpenAI-compatible inference",
27
+ "groupId": "groq",
28
+ "groupLabel": "Groq",
29
+ "optionKey": "groqApiKey",
30
+ "cliFlag": "--groq-api-key",
31
+ "cliOption": "--groq-api-key <key>",
32
+ "cliDescription": "Groq API key"
33
+ }],
34
+ modelCatalog: {
35
+ "providers": { "groq": {
36
+ "baseUrl": "https://api.groq.com/openai/v1",
37
+ "api": "openai-completions",
38
+ "defaultModel": "openai/gpt-oss-120b",
39
+ "models": [
40
+ {
41
+ "id": "groq/compound",
42
+ "name": "Compound",
43
+ "reasoning": false,
44
+ "input": ["text"],
45
+ "contextWindow": 131072,
46
+ "maxTokens": 8192,
47
+ "cost": {
48
+ "input": 0,
49
+ "output": 0,
50
+ "cacheRead": 0,
51
+ "cacheWrite": 0
52
+ }
53
+ },
54
+ {
55
+ "id": "groq/compound-mini",
56
+ "name": "Compound Mini",
57
+ "reasoning": false,
58
+ "input": ["text"],
59
+ "contextWindow": 131072,
60
+ "maxTokens": 8192,
61
+ "cost": {
62
+ "input": 0,
63
+ "output": 0,
64
+ "cacheRead": 0,
65
+ "cacheWrite": 0
66
+ }
67
+ },
68
+ {
69
+ "id": "llama-3.1-8b-instant",
70
+ "name": "Llama 3.1 8B Instant",
71
+ "status": "deprecated",
72
+ "replacedBy": "openai/gpt-oss-20b",
73
+ "reasoning": false,
74
+ "input": ["text"],
75
+ "contextWindow": 131072,
76
+ "maxTokens": 131072,
77
+ "cost": {
78
+ "input": .05,
79
+ "output": .08,
80
+ "cacheRead": 0,
81
+ "cacheWrite": 0
82
+ }
83
+ },
84
+ {
85
+ "id": "llama-3.3-70b-versatile",
86
+ "name": "Llama 3.3 70B Versatile",
87
+ "status": "deprecated",
88
+ "replacedBy": "openai/gpt-oss-120b",
89
+ "reasoning": false,
90
+ "input": ["text"],
91
+ "contextWindow": 131072,
92
+ "maxTokens": 32768,
93
+ "cost": {
94
+ "input": .59,
95
+ "output": .79,
96
+ "cacheRead": 0,
97
+ "cacheWrite": 0
98
+ }
99
+ },
100
+ {
101
+ "id": "openai/gpt-oss-120b",
102
+ "name": "GPT OSS 120B",
103
+ "reasoning": true,
104
+ "input": ["text"],
105
+ "contextWindow": 131072,
106
+ "maxTokens": 65536,
107
+ "cost": {
108
+ "input": .15,
109
+ "output": .6,
110
+ "cacheRead": .075,
111
+ "cacheWrite": 0
112
+ }
113
+ },
114
+ {
115
+ "id": "openai/gpt-oss-20b",
116
+ "name": "GPT OSS 20B",
117
+ "reasoning": true,
118
+ "input": ["text"],
119
+ "contextWindow": 131072,
120
+ "maxTokens": 65536,
121
+ "cost": {
122
+ "input": .075,
123
+ "output": .3,
124
+ "cacheRead": .0375,
125
+ "cacheWrite": 0
126
+ }
127
+ },
128
+ {
129
+ "id": "openai/gpt-oss-safeguard-20b",
130
+ "name": "Safety GPT OSS 20B",
131
+ "reasoning": true,
132
+ "input": ["text"],
133
+ "contextWindow": 131072,
134
+ "maxTokens": 65536,
135
+ "cost": {
136
+ "input": .075,
137
+ "output": .3,
138
+ "cacheRead": .037,
139
+ "cacheWrite": 0
140
+ }
141
+ },
142
+ {
143
+ "id": "qwen/qwen3.6-27b",
144
+ "name": "Qwen 3.6 27B",
145
+ "reasoning": true,
146
+ "input": ["text", "image"],
147
+ "contextWindow": 131072,
148
+ "maxTokens": 16384,
149
+ "cost": {
150
+ "input": .6,
151
+ "output": 3,
152
+ "cacheRead": 0,
153
+ "cacheWrite": 0
154
+ }
155
+ }
156
+ ]
157
+ } },
158
+ "discovery": { "groq": "refreshable" }
159
+ },
160
+ contracts: { "mediaUnderstandingProviders": ["groq"] },
161
+ mediaUnderstandingProviderMetadata: { "groq": {
162
+ "capabilities": ["audio"],
163
+ "defaultModels": { "audio": "whisper-large-v3-turbo" },
164
+ "autoPriority": { "audio": 20 }
165
+ } },
166
+ configSchema: {
167
+ "type": "object",
168
+ "additionalProperties": false,
169
+ "properties": {}
170
+ }
171
+ };
172
+ //#endregion
4
173
  //#region extensions/groq/index.ts
5
- const GROQ_DEFAULT_MODEL_REF = "groq/llama-3.3-70b-versatile";
6
- var groq_default = definePluginEntry({
174
+ const GROQ_OVERSIZED_RECOVERY_MODEL_ID = "llama-3.3-70b-versatile";
175
+ const GROQ_FALLBACK_MAX_TOKENS = 1024;
176
+ function hasWireMaxTokens(value) {
177
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
178
+ const record = value;
179
+ return record.max_completion_tokens !== void 0 || record.max_tokens !== void 0;
180
+ }
181
+ function hasExplicitMaxTokens(extraParams) {
182
+ return extraParams?.maxTokens !== void 0 || hasWireMaxTokens(extraParams) || hasWireMaxTokens(extraParams?.extra_body) || hasWireMaxTokens(extraParams?.extraBody);
183
+ }
184
+ function isGroqTpmRequestTooLargeEvent(event) {
185
+ if (event.type !== "error") return false;
186
+ const message = event.error.errorMessage?.toLowerCase() ?? "";
187
+ return message.includes("413 request too large for model") && message.includes("tokens per minute (tpm)") && message.includes("limit ") && message.includes("requested ");
188
+ }
189
+ function wrapGroqOversizedRequestRecovery(streamFn, enabled) {
190
+ const underlying = streamFn ?? streamSimple;
191
+ if (!enabled) return underlying;
192
+ const withoutTools = (model, context, options) => {
193
+ const originalOnPayload = options?.onPayload;
194
+ return underlying(model, context, {
195
+ ...options,
196
+ async onPayload(payload, payloadModel) {
197
+ const replacement = await originalOnPayload?.(payload, payloadModel);
198
+ const finalPayload = replacement && typeof replacement === "object" ? replacement : payload;
199
+ const record = finalPayload;
200
+ delete record.tools;
201
+ delete record.tool_choice;
202
+ delete record.parallel_tool_calls;
203
+ delete record.parallelToolCalls;
204
+ delete record.max_tokens;
205
+ delete record.max_completion_tokens;
206
+ record.max_completion_tokens = GROQ_FALLBACK_MAX_TOKENS;
207
+ return finalPayload;
208
+ }
209
+ });
210
+ };
211
+ return (model, context, options) => {
212
+ if (options?.maxTokens !== void 0) return underlying(model, context, options);
213
+ const initial = underlying(model, context, options);
214
+ const output = createAssistantMessageEventStream();
215
+ const writable = output;
216
+ (async () => {
217
+ try {
218
+ const resolvedInitial = await Promise.resolve(initial);
219
+ let forwarded = false;
220
+ let retryWithoutTools = false;
221
+ for await (const event of resolvedInitial) {
222
+ if (!forwarded && !options?.signal?.aborted && isGroqTpmRequestTooLargeEvent(event)) {
223
+ retryWithoutTools = true;
224
+ break;
225
+ }
226
+ writable.push(event);
227
+ forwarded = true;
228
+ }
229
+ if (retryWithoutTools) {
230
+ const fallback = await Promise.resolve(withoutTools(model, context, options));
231
+ for await (const event of fallback) writable.push(event);
232
+ }
233
+ } catch (error) {
234
+ writable.push({
235
+ type: "error",
236
+ reason: "error",
237
+ error: {
238
+ role: "assistant",
239
+ content: [],
240
+ api: model.api,
241
+ provider: model.provider,
242
+ model: model.id,
243
+ usage: {
244
+ input: 0,
245
+ output: 0,
246
+ cacheRead: 0,
247
+ cacheWrite: 0,
248
+ totalTokens: 0,
249
+ cost: {
250
+ input: 0,
251
+ output: 0,
252
+ cacheRead: 0,
253
+ cacheWrite: 0,
254
+ total: 0
255
+ }
256
+ },
257
+ stopReason: "error",
258
+ errorMessage: error instanceof Error ? error.message : String(error),
259
+ timestamp: Date.now()
260
+ }
261
+ });
262
+ } finally {
263
+ writable.end();
264
+ }
265
+ })();
266
+ return output;
267
+ };
268
+ }
269
+ var groq_default = defineSingleProviderPluginEntry({
7
270
  id: "groq",
8
271
  name: "Groq Provider",
9
272
  description: "Bundled Groq provider plugin",
273
+ manifest: openclaw_plugin_default,
274
+ provider: {
275
+ label: "Groq",
276
+ docsPath: "/providers/groq",
277
+ catalog: { liveModelDiscovery: true },
278
+ wrapStreamFn: (ctx) => wrapGroqOversizedRequestRecovery(ctx.streamFn, ctx.modelId === GROQ_OVERSIZED_RECOVERY_MODEL_ID && !hasExplicitMaxTokens(ctx.extraParams) && !hasExplicitMaxTokens(ctx.model?.params) && ctx.model?.maxTokensSource === "discovered")
279
+ },
10
280
  register(api) {
11
- api.registerProvider({
12
- id: "groq",
13
- label: "Groq",
14
- docsPath: "/providers/groq",
15
- envVars: ["GROQ_API_KEY"],
16
- auth: [createProviderApiKeyAuthMethod({
17
- providerId: "groq",
18
- methodId: "api-key",
19
- label: "Groq API key",
20
- hint: "Fast OpenAI-compatible inference",
21
- optionKey: "groqApiKey",
22
- flagName: "--groq-api-key",
23
- envVar: "GROQ_API_KEY",
24
- promptMessage: "Enter Groq API key",
25
- defaultModel: GROQ_DEFAULT_MODEL_REF,
26
- wizard: {
27
- choiceId: "groq-api-key",
28
- choiceLabel: "Groq API key",
29
- choiceHint: "Fast OpenAI-compatible inference",
30
- groupId: "groq",
31
- groupLabel: "Groq",
32
- groupHint: "Fast OpenAI-compatible inference"
33
- }
34
- })]
35
- });
36
281
  api.registerMediaUnderstandingProvider(groqMediaUnderstandingProvider);
37
282
  }
38
283
  });
@@ -48,11 +48,12 @@
48
48
  "groq": {
49
49
  "baseUrl": "https://api.groq.com/openai/v1",
50
50
  "api": "openai-completions",
51
+ "defaultModel": "openai/gpt-oss-120b",
51
52
  "models": [
52
53
  {
53
54
  "id": "groq/compound",
54
55
  "name": "Compound",
55
- "reasoning": true,
56
+ "reasoning": false,
56
57
  "input": ["text"],
57
58
  "contextWindow": 131072,
58
59
  "maxTokens": 8192,
@@ -66,7 +67,7 @@
66
67
  {
67
68
  "id": "groq/compound-mini",
68
69
  "name": "Compound Mini",
69
- "reasoning": true,
70
+ "reasoning": false,
70
71
  "input": ["text"],
71
72
  "contextWindow": 131072,
72
73
  "maxTokens": 8192,
@@ -80,6 +81,8 @@
80
81
  {
81
82
  "id": "llama-3.1-8b-instant",
82
83
  "name": "Llama 3.1 8B Instant",
84
+ "status": "deprecated",
85
+ "replacedBy": "openai/gpt-oss-20b",
83
86
  "reasoning": false,
84
87
  "input": ["text"],
85
88
  "contextWindow": 131072,
@@ -94,6 +97,8 @@
94
97
  {
95
98
  "id": "llama-3.3-70b-versatile",
96
99
  "name": "Llama 3.3 70B Versatile",
100
+ "status": "deprecated",
101
+ "replacedBy": "openai/gpt-oss-120b",
97
102
  "reasoning": false,
98
103
  "input": ["text"],
99
104
  "contextWindow": 131072,
@@ -105,23 +110,6 @@
105
110
  "cacheWrite": 0
106
111
  }
107
112
  },
108
- {
109
- "id": "meta-llama/llama-4-scout-17b-16e-instruct",
110
- "name": "Llama 4 Scout 17B",
111
- "reasoning": false,
112
- "input": ["text", "image"],
113
- "mediaInput": {
114
- "image": { "maxPixels": 33177600, "preferredSidePx": 2048, "tokenMode": "provider" }
115
- },
116
- "contextWindow": 131072,
117
- "maxTokens": 8192,
118
- "cost": {
119
- "input": 0.11,
120
- "output": 0.34,
121
- "cacheRead": 0,
122
- "cacheWrite": 0
123
- }
124
- },
125
113
  {
126
114
  "id": "openai/gpt-oss-120b",
127
115
  "name": "GPT OSS 120B",
@@ -132,7 +120,7 @@
132
120
  "cost": {
133
121
  "input": 0.15,
134
122
  "output": 0.6,
135
- "cacheRead": 0,
123
+ "cacheRead": 0.075,
136
124
  "cacheWrite": 0
137
125
  }
138
126
  },
@@ -146,7 +134,7 @@
146
134
  "cost": {
147
135
  "input": 0.075,
148
136
  "output": 0.3,
149
- "cacheRead": 0,
137
+ "cacheRead": 0.0375,
150
138
  "cacheWrite": 0
151
139
  }
152
140
  },
@@ -165,15 +153,15 @@
165
153
  }
166
154
  },
167
155
  {
168
- "id": "qwen/qwen3-32b",
169
- "name": "Qwen3 32B",
156
+ "id": "qwen/qwen3.6-27b",
157
+ "name": "Qwen 3.6 27B",
170
158
  "reasoning": true,
171
- "input": ["text"],
159
+ "input": ["text", "image"],
172
160
  "contextWindow": 131072,
173
- "maxTokens": 40960,
161
+ "maxTokens": 16384,
174
162
  "cost": {
175
- "input": 0.29,
176
- "output": 0.59,
163
+ "input": 0.6,
164
+ "output": 3,
177
165
  "cacheRead": 0,
178
166
  "cacheWrite": 0
179
167
  }
@@ -182,7 +170,7 @@
182
170
  }
183
171
  },
184
172
  "discovery": {
185
- "groq": "static"
173
+ "groq": "refreshable"
186
174
  }
187
175
  },
188
176
  "contracts": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/groq-provider",
3
- "version": "2026.7.2-beta.3",
3
+ "version": "2026.7.2-beta.5",
4
4
  "description": "OpenClaw Groq media-understanding provider.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,10 +18,10 @@
18
18
  "minHostVersion": ">=2026.6.8"
19
19
  },
20
20
  "compat": {
21
- "pluginApi": ">=2026.7.2-beta.3"
21
+ "pluginApi": ">=2026.7.2-beta.5"
22
22
  },
23
23
  "build": {
24
- "openclawVersion": "2026.7.2-beta.3",
24
+ "openclawVersion": "2026.7.2-beta.5",
25
25
  "bundledDist": false
26
26
  },
27
27
  "release": {
@@ -35,11 +35,10 @@
35
35
  "files": [
36
36
  "dist/**",
37
37
  "openclaw.plugin.json",
38
- "npm-shrinkwrap.json",
39
38
  "README.md"
40
39
  ],
41
40
  "peerDependencies": {
42
- "openclaw": ">=2026.7.2-beta.3"
41
+ "openclaw": ">=2026.7.2-beta.5"
43
42
  },
44
43
  "peerDependenciesMeta": {
45
44
  "openclaw": {
@@ -1,12 +0,0 @@
1
- {
2
- "name": "@openclaw/groq-provider",
3
- "version": "2026.7.2-beta.3",
4
- "lockfileVersion": 3,
5
- "requires": true,
6
- "packages": {
7
- "": {
8
- "name": "@openclaw/groq-provider",
9
- "version": "2026.7.2-beta.3"
10
- }
11
- }
12
- }