@warlock.js/ai-groq 5.46.0 → 5.47.1
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/CHANGELOG.md +11 -0
- package/README.md +3 -3
- package/cjs/index.cjs +102 -14
- package/cjs/index.cjs.map +1 -1
- package/esm/index.d.mts +3 -2
- package/esm/index.mjs +3 -2
- package/esm/known-lifecycle.d.mts +27 -0
- package/esm/known-lifecycle.d.mts.map +1 -0
- package/esm/known-lifecycle.mjs +88 -0
- package/esm/known-lifecycle.mjs.map +1 -0
- package/esm/known-models.d.mts +8 -10
- package/esm/known-models.d.mts.map +1 -1
- package/esm/known-models.mjs +8 -12
- package/esm/known-models.mjs.map +1 -1
- package/esm/sdk.d.mts +4 -2
- package/esm/sdk.d.mts.map +1 -1
- package/esm/sdk.mjs +5 -3
- package/esm/sdk.mjs.map +1 -1
- package/llms-full.txt +4 -0
- package/package.json +4 -4
- package/skills/SKILL.md +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,17 @@ All notable changes to `@warlock.js/ai-groq` are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). `@warlock.js/*` packages are released in lockstep — every package shares the same version number, so a version below may list only the changes that affected this package.
|
|
6
6
|
|
|
7
|
+
## 5.47.0 - 2026-11-06
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- `qwen/qwen3.8-27b` is in `GROQ_KNOWN_MODELS`.
|
|
12
|
+
- `GROQ_MODEL_LIFECYCLE` and `groqLifecycleFor(name)` give each model a status; `GROQ_DEFAULT_PRICING_AS_OF` dates the price table.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- `GROQ_KNOWN_MODELS` no longer lists `llama-3.3-70b-versatile`, `llama-3.1-8b-instant` (shut down 2026-08-16) and `deepseek-r1-distill-llama-70b` (shut down 2025-10-02). They are `retired` in `GROQ_MODEL_LIFECYCLE`, and `groq.model({ name })` still accepts them.
|
|
17
|
+
|
|
7
18
|
## 5.45.0 - 2026-11-05
|
|
8
19
|
|
|
9
20
|
### Added
|
package/README.md
CHANGED
|
@@ -53,10 +53,10 @@ A curated (not exhaustive, not an allow-list) set of current production ids is e
|
|
|
53
53
|
|
|
54
54
|
| Model id | Notes |
|
|
55
55
|
| -------------------------------------------- | ------------------------------------------------------ |
|
|
56
|
-
| `llama-3.3-70b-versatile` | Flagship general-purpose text |
|
|
57
|
-
| `llama-3.1-8b-instant` | Fastest / cheapest small text |
|
|
58
56
|
| `openai/gpt-oss-120b` / `openai/gpt-oss-20b` | OpenAI open-weight family — vision + reasoning capable |
|
|
59
|
-
| `
|
|
57
|
+
| `qwen/qwen3.8-27b` | Qwen 3.8 (a preview model on Groq) |
|
|
58
|
+
|
|
59
|
+
Ids Groq has shut down (`llama-3.3-70b-versatile`, `llama-3.1-8b-instant`, `deepseek-r1-distill-llama-70b`, …) are recorded as `retired`, with their date and replacement, in `GROQ_MODEL_LIFECYCLE` (`groqLifecycleFor(name)`).
|
|
60
60
|
|
|
61
61
|
`name` is the upstream open-weight id (e.g. `openai/gpt-oss-120b`), NOT an OpenAI id. `groq.model()` accepts any string, so a newly launched Groq id works the moment Groq ships it.
|
|
62
62
|
|
package/cjs/index.cjs
CHANGED
|
@@ -128,25 +128,21 @@ function inferReasoningCapability(modelId) {
|
|
|
128
128
|
return REASONING_CAPABLE_SUBSTRINGS.some((fragment) => normalized.includes(fragment));
|
|
129
129
|
}
|
|
130
130
|
/**
|
|
131
|
-
* Curated list of current Groq
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
131
|
+
* Curated list of current Groq chat model ids, for autocomplete, docs, and
|
|
132
|
+
* default selection. NOT exhaustive and NOT a runtime allow-list —
|
|
133
|
+
* `groq.model({ name })` accepts any string, so a newly launched id works
|
|
134
|
+
* the moment Groq ships it without a package bump. Ids Groq has shut down
|
|
135
|
+
* are left out here and recorded as `retired` in
|
|
136
|
+
* {@link GROQ_MODEL_LIFECYCLE}.
|
|
137
137
|
*
|
|
138
|
-
* - `llama-3.3-70b-versatile` — flagship general-purpose text model.
|
|
139
|
-
* - `llama-3.1-8b-instant` — fastest/cheapest small text model.
|
|
140
138
|
* - `openai/gpt-oss-120b` / `openai/gpt-oss-20b` — OpenAI open-weight
|
|
141
139
|
* family; vision + reasoning capable.
|
|
142
|
-
* - `
|
|
140
|
+
* - `qwen/qwen3.8-27b` — Qwen 3.8 (a preview model on Groq).
|
|
143
141
|
*/
|
|
144
142
|
const GROQ_KNOWN_MODELS = [
|
|
145
|
-
"llama-3.3-70b-versatile",
|
|
146
|
-
"llama-3.1-8b-instant",
|
|
147
143
|
"openai/gpt-oss-120b",
|
|
148
144
|
"openai/gpt-oss-20b",
|
|
149
|
-
"
|
|
145
|
+
"qwen/qwen3.8-27b"
|
|
150
146
|
];
|
|
151
147
|
|
|
152
148
|
//#endregion
|
|
@@ -283,13 +279,15 @@ var GroqSDK = class {
|
|
|
283
279
|
function defaultPricingFor(name) {
|
|
284
280
|
return GROQ_DEFAULT_PRICING[name];
|
|
285
281
|
}
|
|
282
|
+
/** The date the {@link GROQ_DEFAULT_PRICING} token rates were last checked against Groq's model page. */
|
|
283
|
+
const GROQ_DEFAULT_PRICING_AS_OF = "2026-11-06";
|
|
286
284
|
/**
|
|
287
285
|
* Default per-million-token USD rates for Groq models.
|
|
288
286
|
*
|
|
289
287
|
* Source: https://console.groq.com/docs/models (groq.com/pricing now
|
|
290
|
-
* redirects to the home page),
|
|
288
|
+
* redirects to the home page), as of {@link GROQ_DEFAULT_PRICING_AS_OF}. Cached input is 50%
|
|
291
289
|
* of the input rate for the gpt-oss models, the only ones Groq caches
|
|
292
|
-
* (https://console.groq.com/docs/prompt-caching; no write charge). The
|
|
290
|
+
* (https://console.groq.com/docs/prompt-caching, checked 2026-10-17; no write charge). The
|
|
293
291
|
* Llama models are listed as "Enterprise – Contact Sales" with no public
|
|
294
292
|
* price, so they stay unpriced — pass `pricing` for them.
|
|
295
293
|
*/
|
|
@@ -315,12 +313,102 @@ const GROQ_DEFAULT_PRICING = {
|
|
|
315
313
|
}
|
|
316
314
|
};
|
|
317
315
|
|
|
316
|
+
//#endregion
|
|
317
|
+
//#region ../../packages/ai-groq/src/known-lifecycle.ts
|
|
318
|
+
/**
|
|
319
|
+
* Where Groq's deprecations page and model catalog put the chat models the
|
|
320
|
+
* adapter knows, as of {@link GROQ_MODEL_LIFECYCLE_AS_OF}. `retired` ids
|
|
321
|
+
* are past their shutdown date; Groq applies several of these shutdowns to
|
|
322
|
+
* free and developer-tier usage only, so a committed-spend enterprise
|
|
323
|
+
* contract can still serve them.
|
|
324
|
+
*
|
|
325
|
+
* Sources: https://console.groq.com/docs/deprecations and
|
|
326
|
+
* https://console.groq.com/docs/models. Preview models (`qwen/qwen3.8-27b`,
|
|
327
|
+
* `openai/gpt-oss-safeguard-20b`) are listed as `current` while Groq
|
|
328
|
+
* serves them, but Groq may discontinue previews at short notice.
|
|
329
|
+
*/
|
|
330
|
+
const GROQ_MODEL_LIFECYCLE = {
|
|
331
|
+
"openai/gpt-oss-120b": { status: "current" },
|
|
332
|
+
"openai/gpt-oss-20b": { status: "current" },
|
|
333
|
+
"openai/gpt-oss-safeguard-20b": { status: "current" },
|
|
334
|
+
"qwen/qwen3.8-27b": { status: "current" },
|
|
335
|
+
"llama-3.3-70b-versatile": {
|
|
336
|
+
status: "retired",
|
|
337
|
+
retiresOn: "2026-08-16",
|
|
338
|
+
replacement: "openai/gpt-oss-120b"
|
|
339
|
+
},
|
|
340
|
+
"llama-3.1-8b-instant": {
|
|
341
|
+
status: "retired",
|
|
342
|
+
retiresOn: "2026-08-16",
|
|
343
|
+
replacement: "openai/gpt-oss-20b"
|
|
344
|
+
},
|
|
345
|
+
"deepseek-r1-distill-llama-70b": {
|
|
346
|
+
status: "retired",
|
|
347
|
+
retiresOn: "2025-10-02",
|
|
348
|
+
replacement: "openai/gpt-oss-120b"
|
|
349
|
+
},
|
|
350
|
+
"qwen/qwen3.6-27b": {
|
|
351
|
+
status: "retired",
|
|
352
|
+
retiresOn: "2026-09-14",
|
|
353
|
+
replacement: "qwen/qwen3.8-27b"
|
|
354
|
+
},
|
|
355
|
+
"qwen/qwen3-32b": {
|
|
356
|
+
status: "retired",
|
|
357
|
+
retiresOn: "2026-07-17",
|
|
358
|
+
replacement: "openai/gpt-oss-120b"
|
|
359
|
+
},
|
|
360
|
+
"meta-llama/llama-4-scout-17b-16e-instruct": {
|
|
361
|
+
status: "retired",
|
|
362
|
+
retiresOn: "2026-07-17",
|
|
363
|
+
replacement: "openai/gpt-oss-120b"
|
|
364
|
+
},
|
|
365
|
+
"meta-llama/llama-4-maverick-17b-128e-instruct": {
|
|
366
|
+
status: "retired",
|
|
367
|
+
retiresOn: "2026-03-09",
|
|
368
|
+
replacement: "openai/gpt-oss-120b"
|
|
369
|
+
},
|
|
370
|
+
"moonshotai/kimi-k2-instruct-0905": {
|
|
371
|
+
status: "retired",
|
|
372
|
+
retiresOn: "2026-04-15",
|
|
373
|
+
replacement: "openai/gpt-oss-120b"
|
|
374
|
+
},
|
|
375
|
+
"moonshotai/kimi-k2-instruct": {
|
|
376
|
+
status: "retired",
|
|
377
|
+
retiresOn: "2025-10-10",
|
|
378
|
+
replacement: "openai/gpt-oss-120b"
|
|
379
|
+
},
|
|
380
|
+
"groq/compound": {
|
|
381
|
+
status: "retired",
|
|
382
|
+
retiresOn: "2026-09-21"
|
|
383
|
+
},
|
|
384
|
+
"groq/compound-mini": {
|
|
385
|
+
status: "retired",
|
|
386
|
+
retiresOn: "2026-09-21"
|
|
387
|
+
}
|
|
388
|
+
};
|
|
389
|
+
/** The date {@link GROQ_MODEL_LIFECYCLE} was last checked against Groq's deprecations page. */
|
|
390
|
+
const GROQ_MODEL_LIFECYCLE_AS_OF = "2026-11-06";
|
|
391
|
+
/**
|
|
392
|
+
* Look up the lifecycle of a Groq model id (exact match), or `undefined`
|
|
393
|
+
* when the table does not cover it.
|
|
394
|
+
*
|
|
395
|
+
* @example
|
|
396
|
+
* groqLifecycleFor("llama-3.3-70b-versatile"); // { status: "retired", retiresOn: "2026-08-16", … }
|
|
397
|
+
*/
|
|
398
|
+
function groqLifecycleFor(modelName) {
|
|
399
|
+
return Object.hasOwn(GROQ_MODEL_LIFECYCLE, modelName) ? GROQ_MODEL_LIFECYCLE[modelName] : void 0;
|
|
400
|
+
}
|
|
401
|
+
|
|
318
402
|
//#endregion
|
|
319
403
|
exports.GROQ_BASE_URL = GROQ_BASE_URL;
|
|
320
404
|
exports.GROQ_DEFAULT_PRICING = GROQ_DEFAULT_PRICING;
|
|
405
|
+
exports.GROQ_DEFAULT_PRICING_AS_OF = GROQ_DEFAULT_PRICING_AS_OF;
|
|
321
406
|
exports.GROQ_KNOWN_MODELS = GROQ_KNOWN_MODELS;
|
|
407
|
+
exports.GROQ_MODEL_LIFECYCLE = GROQ_MODEL_LIFECYCLE;
|
|
408
|
+
exports.GROQ_MODEL_LIFECYCLE_AS_OF = GROQ_MODEL_LIFECYCLE_AS_OF;
|
|
322
409
|
exports.GROQ_PROVIDER = GROQ_PROVIDER;
|
|
323
410
|
exports.GroqSDK = GroqSDK;
|
|
411
|
+
exports.groqLifecycleFor = groqLifecycleFor;
|
|
324
412
|
exports.inferReasoningCapability = inferReasoningCapability;
|
|
325
413
|
exports.inferVisionCapability = inferVisionCapability;
|
|
326
414
|
//# sourceMappingURL=index.cjs.map
|
package/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["OpenAISDK"],"sources":["../../../../../../../packages/ai-groq/src/known-context-windows.ts","../../../../../../../packages/ai-groq/src/known-models.ts","../../../../../../../packages/ai-groq/src/sdk.ts"],"sourcesContent":["/*\n * Context windows of the chat models Groq hosts, from its model catalog:\n * the Llama, gpt-oss, Qwen3 and DeepSeek-R1 distill ids document 131,072\n * tokens, Kimi K2 262,144.\n * The longest matching fragment wins; ids that match nothing resolve to `undefined`, so a\n * window-relative trigger stays inert until the window is set with\n * `groq.model({ name, contextWindow })`.\n */\nconst KNOWN_WINDOWS: ReadonlyArray<readonly [fragment: string, window: number]> = [\n [\"llama-3\", 131_072],\n [\"llama-4\", 131_072],\n [\"gpt-oss\", 131_072],\n [\"qwen3\", 131_072],\n [\"deepseek-r1-distill\", 131_072],\n [\"kimi-k2\", 262_144],\n];\n\n/**\n * The known context window (tokens, input plus output) of a Groq-hosted chat\n * model id, or `undefined` when it is not in the table.\n *\n * @example\n * inferContextWindow(\"llama-3\"); // → 131072\n */\nexport function inferContextWindow(modelId: string): number | undefined {\n const id = modelId.toLowerCase();\n let best: readonly [string, number] | undefined;\n\n for (const entry of KNOWN_WINDOWS) {\n const fragment = entry[0];\n\n if (id.includes(fragment) && (!best || fragment.length > best[0].length)) {\n best = entry;\n }\n }\n\n return best?.[1];\n}\n","/**\n * Default base URL for Groq's OpenAI-compatible Chat Completions\n * endpoint. Groq exposes the same wire protocol as OpenAI under this\n * prefix, which is exactly why `GroqSDK` can delegate to the\n * battle-tested `OpenAISDK` instead of reimplementing the transport.\n *\n * Verified against Groq's \"OpenAI Compatibility\" docs (mid-2026).\n * Override via `new GroqSDK({ baseURL })` if Groq ever relocates it.\n */\nexport const GROQ_BASE_URL = \"https://api.groq.com/openai/v1\";\n\n/**\n * The provider label every model produced by `GroqSDK` self-identifies\n * with. Flows through to `ModelContract.provider`, `AgentReport.model`,\n * logs, and any provider-aware middleware. Kept as a constant so the\n * wrapper and the inner `OpenAISDK` agree on one spelling.\n */\nexport const GROQ_PROVIDER = \"groq\";\n\n/**\n * Substrings identifying Groq-hosted model ids whose family accepts\n * image input (vision).\n *\n * Groq hosts *open* models on its LPU hardware, so the ids are the\n * upstream open-weight names rather than OpenAI's — which is why the\n * OpenAI adapter's `gpt-4o*` prefix inference would never fire here and\n * this provider must carry its OWN list. Verified against Groq's\n * supported-models catalog (mid-2026):\n *\n * - `openai/gpt-oss-*` — natively multimodal OpenAI open-weight family\n * (the current production vision + reasoning models on Groq).\n * - `llama-4` / `llama-3.2-*-vision` — Meta's multimodal Llama families.\n * Kept as substrings so any still-hosted or re-introduced variant is\n * covered even though some `llama-4` ids were deprecated in 2026.\n *\n * Matched as a substring (not a prefix) because Groq prefixes several\n * ids with an org segment (`openai/`, `meta-llama/`) and appends size /\n * date suffixes. Override per-model via\n * `groq.model({ name, vision: true | false })`.\n */\nconst VISION_CAPABLE_SUBSTRINGS = [\n \"gpt-oss\",\n \"llama-4\",\n \"llama-3.2-11b-vision\",\n \"llama-3.2-90b-vision\",\n \"vision\",\n];\n\n/**\n * Substrings identifying Groq-hosted model ids that expose an internal\n * reasoning / thinking channel and accept the `reasoning_effort`\n * request parameter on the OpenAI-compatible Chat Completions endpoint.\n *\n * Verified against Groq's catalog (mid-2026):\n * - `gpt-oss` — the OpenAI open-weight family reasons by default.\n * - `deepseek-r1-distill` — DeepSeek-R1-style reasoning at Groq speed.\n * - `qwq` / `qwen3` — Qwen reasoning families (when hosted).\n *\n * Matched as a substring for the same org-prefix / suffix reason as the\n * vision list. Override per-model via\n * `groq.model({ name, reasoning: true | false })`.\n */\nconst REASONING_CAPABLE_SUBSTRINGS = [\n \"gpt-oss\",\n \"deepseek-r1\",\n \"deepseek-r1-distill\",\n \"qwq\",\n \"qwen3\",\n];\n\n/**\n * Infer whether a Groq-hosted model id supports vision based on the\n * known multimodal-family substrings. Unknown ids default to `false`\n * so passing an image attachment to a text-only model (e.g.\n * `llama-3.3-70b-versatile`) surfaces a clear, agent-side capability\n * error instead of an opaque upstream 400.\n *\n * @example\n * inferVisionCapability(\"openai/gpt-oss-120b\"); // → true\n * inferVisionCapability(\"meta-llama/llama-4-scout\"); // → true\n * inferVisionCapability(\"llama-3.3-70b-versatile\"); // → false\n * inferVisionCapability(\"llama-3.1-8b-instant\"); // → false\n */\nexport function inferVisionCapability(modelId: string): boolean {\n const normalized = modelId.toLowerCase();\n\n return VISION_CAPABLE_SUBSTRINGS.some((fragment) => normalized.includes(fragment));\n}\n\n/**\n * Infer whether a Groq-hosted model id is a reasoning model based on\n * the known reasoning-family substrings. Unknown ids default to `false`\n * so the adapter never forwards an unsupported `reasoning_effort` param\n * to a non-reasoning model (which would 400).\n *\n * @example\n * inferReasoningCapability(\"openai/gpt-oss-20b\"); // → true\n * inferReasoningCapability(\"deepseek-r1-distill-llama-70b\"); // → true\n * inferReasoningCapability(\"llama-3.3-70b-versatile\"); // → false\n */\nexport function inferReasoningCapability(modelId: string): boolean {\n const normalized = modelId.toLowerCase();\n\n return REASONING_CAPABLE_SUBSTRINGS.some((fragment) => normalized.includes(fragment));\n}\n\n/**\n * Curated list of current Groq production chat model ids (mid-2026),\n * for autocomplete, docs, and default selection. NOT exhaustive and NOT\n * a runtime allow-list — `groq.model({ name })` accepts any string, so\n * a newly launched id works the moment Groq ships it without a package\n * bump. Deprecated ids (e.g. several `llama-4` variants retired in 2026)\n * are intentionally excluded.\n *\n * - `llama-3.3-70b-versatile` — flagship general-purpose text model.\n * - `llama-3.1-8b-instant` — fastest/cheapest small text model.\n * - `openai/gpt-oss-120b` / `openai/gpt-oss-20b` — OpenAI open-weight\n * family; vision + reasoning capable.\n * - `deepseek-r1-distill-llama-70b` — DeepSeek-R1-style reasoning.\n */\nexport const GROQ_KNOWN_MODELS = [\n \"llama-3.3-70b-versatile\",\n \"llama-3.1-8b-instant\",\n \"openai/gpt-oss-120b\",\n \"openai/gpt-oss-20b\",\n \"deepseek-r1-distill-llama-70b\",\n] as const;\n","import type {\n ListModelsOptions,\n ModelInfo,\n EmbedderContract,\n ModelContract,\n ModelPricing,\n SDKAdapterContract,\n} from \"@warlock.js/ai\";\nimport { OpenAISDK } from \"@warlock.js/ai-openai\";\nimport type { GroqEmbedderConfig, GroqModelConfig, GroqSDKConfig } from \"./config.type\";\nimport { inferContextWindow } from \"./known-context-windows\";\nimport {\n GROQ_BASE_URL,\n GROQ_PROVIDER,\n inferReasoningCapability,\n inferVisionCapability,\n} from \"./known-models\";\n\n/**\n * Groq-backed implementation of `SDKAdapterContract`.\n *\n * **Role.** The package entry point for Groq-hosted open models\n * (`llama-3.3-70b-versatile`, `llama-3.1-8b-instant`,\n * `openai/gpt-oss-*`, `deepseek-r1-distill-*`, …) served on Groq's fast\n * LPU hardware. Because Groq exposes the OpenAI Chat Completions wire\n * protocol verbatim, `GroqSDK` is a **thin wrapper over the already\n * battle-tested {@link OpenAISDK}** rather than a fresh transport\n * implementation — it owns one internal `OpenAISDK` pointed at Groq's\n * `baseURL` with the `\"groq\"` provider label, and delegates `model()` /\n * `embedder()` / `count()` to it.\n *\n * **Why a wrapper and not `OpenAISDK` directly?** Groq hosts *open*\n * models whose ids are the upstream open-weight names (`llama-…`,\n * `openai/gpt-oss-…`), not OpenAI's (`gpt-4o`, `o3`). The OpenAI\n * adapter's capability inference keys on OpenAI prefixes and would never\n * fire here, so every Groq model would come back with `vision`/\n * `reasoning` silently `false`. `GroqSDK` fixes that by computing\n * **this provider's own** vision/reasoning inference (see\n * `known-models.ts`) and injecting the result as explicit capability\n * config — which wins over the inner adapter's inference — plus a set of\n * default per-model pricing rates. Everything else (transport, retries,\n * streaming, structured output, error wrapping, usage accounting) is\n * inherited unchanged from `OpenAISDK`.\n *\n * **Responsibility.**\n * - Owns: one long-lived internal `OpenAISDK` (auth + Groq base URL) and\n * this provider's capability + default-pricing inference.\n * - Does NOT own: the wire protocol, streaming loop, structured-output\n * mapping, or error wrapping — all inherited from `OpenAISDK`.\n *\n * Modeled as a class (see §4.2 of code-style.md — \"long-lived state\n * across many calls\"), fronted by FP usage like the other adapters.\n *\n * @example\n * const groq = new GroqSDK({ apiKey: process.env.GROQ_API_KEY! });\n * const model = groq.model({ name: \"llama-3.3-70b-versatile\", temperature: 0.7 });\n * const reasoner = groq.model({ name: \"openai/gpt-oss-120b\" }); // vision + reasoning auto-true\n *\n * @example\n * // Compose into an `ai.groq` namespace for ergonomic agent wiring\n * const ai = { agent, tool, systemPrompt, groq: new GroqSDK({ apiKey }) };\n * const myAgent = ai.agent({ model: ai.groq.model({ name: \"llama-3.1-8b-instant\" }) });\n */\nexport class GroqSDK implements SDKAdapterContract {\n /**\n * The wrapped OpenAI-compatible adapter, pre-pointed at Groq's\n * `baseURL` and labeled with the `\"groq\"` provider. All real wire work\n * happens here; `GroqSDK` only enriches the per-model config before\n * delegating.\n */\n private readonly openai: OpenAISDK;\n private readonly provider: string;\n private readonly pricing?: Record<string, ModelPricing>;\n\n public constructor(config: GroqSDKConfig) {\n const { baseURL, provider, pricing, ...clientOptions } = config;\n\n this.provider = provider ?? GROQ_PROVIDER;\n this.pricing = pricing;\n\n // Build the inner OpenAI-compatible client pointed at Groq. Forward\n // every other upstream ClientOptions (timeout, maxRetries,\n // defaultHeaders, fetch, …) verbatim — they type-check, so dropping\n // them would be a silent footgun. We pass `pricing` through too so\n // the inner registry stays a fallback, while THIS class's `model()`\n // layers Groq default rates on top.\n this.openai = new OpenAISDK({\n ...clientOptions,\n baseURL: baseURL ?? GROQ_BASE_URL,\n provider: this.provider,\n pricing,\n });\n }\n\n /**\n * Build a `ModelContract` bound to the internal Groq-pointed client.\n *\n * The wrapper's whole job lives here: it computes **Groq's** vision /\n * reasoning inference from the model id and forwards the result as\n * *explicit* `vision` / `reasoning` config to the inner\n * `OpenAISDK.model()`. Because explicit capability config wins over the\n * inner adapter's OpenAI-prefix inference, the returned model reports\n * the right capabilities even though the id isn't an OpenAI name. A\n * caller-supplied `vision` / `reasoning` still wins over this\n * inference (we only fill the gap when the field is omitted).\n *\n * Pricing resolution: per-model `config.pricing` wins; otherwise this\n * SDK's `pricing` registry keyed by `config.name`; otherwise the\n * adapter's built-in default rate for the model; otherwise `undefined`\n * (no cost computed).\n */\n public model(config: GroqModelConfig): ModelContract {\n const resolvedPricing =\n config.pricing ?? this.pricing?.[config.name] ?? defaultPricingFor(config.name);\n\n const window = config.contextWindow ?? inferContextWindow(config.name);\n\n return this.openai.model({\n ...config,\n ...(window !== undefined ? { contextWindow: window } : {}),\n // Fill capability inference only when the caller didn't pin it —\n // explicit caller config always wins, then Groq inference, then\n // (inside OpenAISDK) the harmless OpenAI inference that won't match.\n vision: config.vision ?? inferVisionCapability(config.name),\n reasoning: config.reasoning ?? inferReasoningCapability(config.name),\n structuredOutput: config.structuredOutput ?? true,\n pricing: resolvedPricing,\n });\n }\n\n /**\n * Rough offline token-count estimate. Delegated straight to the inner\n * `OpenAISDK`, which uses the core character-heuristic\n * (`approximateTokenCount`). Good for budgeting / quota guards, not for\n * billing.\n */\n public async count(text: string, model?: string): Promise<number> {\n return this.openai.count(text, model);\n }\n\n /**\n * Build an embedder bound to the internal client. Delegated to the\n * inner `OpenAISDK`.\n *\n * IMPORTANT: as of mid-2026 Groq does **not** expose an\n * OpenAI-compatible embeddings endpoint, so a live `.embed()` /\n * `.embedMany()` call will fail at the provider. The method is kept for\n * adapter symmetry; use `@warlock.js/ai-openai` or\n * `@warlock.js/ai-google` for retrieval embeddings.\n */\n public embedder(config: GroqEmbedderConfig): EmbedderContract {\n return this.openai.embedder(config);\n }\n\n // NOTE: `image()` is intentionally NOT implemented. Groq hosts no\n // image-generation API, and `SDKAdapterContract.image` is optional —\n // its structural absence IS the capability guard, so\n // `ai.groq.image(...)` is a compile-time error rather than a runtime\n // surprise (mirrors Anthropic / Bedrock / Ollama).\n /**\n * List the models this Groq account can use, live from the provider's\n * OpenAI-compatible `GET /models`, mapped to the common `ModelInfo`\n * shape. Groq models marked inactive are left out; `contextWindow` comes from `context_window`. Failures are thrown as the adapter's usual provider\n * errors, never an empty list.\n *\n * @example\n * const models = await groq.models();\n * models.map((model) => model.id);\n */\n public async models(options?: ListModelsOptions): Promise<ModelInfo[]> {\n return this.openai.models(options);\n }\n}\n\n/**\n * Built-in default USD-per-1,000,000-token rates for the Groq models with\n * a published price, used as the last fallback in `model()`'s pricing\n * resolution. A per-model or SDK-level `pricing` entry always wins over\n * these. Returns `undefined` for any unlisted id so cost stays an honest\n * absence rather than a false zero.\n */\nfunction defaultPricingFor(name: string): ModelPricing | undefined {\n return GROQ_DEFAULT_PRICING[name];\n}\n\n/**\n * Default per-million-token USD rates for Groq models.\n *\n * Source: https://console.groq.com/docs/models (groq.com/pricing now\n * redirects to the home page), fetched 2026-10-17. Cached input is 50%\n * of the input rate for the gpt-oss models, the only ones Groq caches\n * (https://console.groq.com/docs/prompt-caching; no write charge). The\n * Llama models are listed as \"Enterprise – Contact Sales\" with no public\n * price, so they stay unpriced — pass `pricing` for them.\n */\nexport const GROQ_DEFAULT_PRICING: Readonly<Record<string, ModelPricing>> = {\n \"openai/gpt-oss-120b\": { input: 0.15, output: 0.6, cachedInput: 0.075 },\n \"openai/gpt-oss-20b\": { input: 0.075, output: 0.3, cachedInput: 0.0375 },\n \"openai/gpt-oss-safeguard-20b\": { input: 0.075, output: 0.3, cachedInput: 0.0375 },\n \"qwen/qwen3.8-27b\": { input: 0.8, output: 4 },\n};\n"],"mappings":";;;;AAQA,MAAM,gBAA4E;CAChF,CAAC,WAAW,MAAO;CACnB,CAAC,WAAW,MAAO;CACnB,CAAC,WAAW,MAAO;CACnB,CAAC,SAAS,MAAO;CACjB,CAAC,uBAAuB,MAAO;CAC/B,CAAC,WAAW,MAAO;AACrB;;;;;;;;AASA,SAAgB,mBAAmB,SAAqC;CACtE,MAAM,KAAK,QAAQ,YAAY;CAC/B,IAAI;CAEJ,KAAK,MAAM,SAAS,eAAe;EACjC,MAAM,WAAW,MAAM;EAEvB,IAAI,GAAG,SAAS,QAAQ,MAAM,CAAC,QAAQ,SAAS,SAAS,KAAK,EAAE,CAAC,SAC/D,OAAO;CAEX;CAEA,OAAO,OAAO;AAChB;;;;;;;;;;;;;AC5BA,MAAa,gBAAgB;;;;;;;AAQ7B,MAAa,gBAAgB;;;;;;;;;;;;;;;;;;;;;;AAuB7B,MAAM,4BAA4B;CAChC;CACA;CACA;CACA;CACA;AACF;;;;;;;;;;;;;;;AAgBA,MAAM,+BAA+B;CACnC;CACA;CACA;CACA;CACA;AACF;;;;;;;;;;;;;;AAeA,SAAgB,sBAAsB,SAA0B;CAC9D,MAAM,aAAa,QAAQ,YAAY;CAEvC,OAAO,0BAA0B,MAAM,aAAa,WAAW,SAAS,QAAQ,CAAC;AACnF;;;;;;;;;;;;AAaA,SAAgB,yBAAyB,SAA0B;CACjE,MAAM,aAAa,QAAQ,YAAY;CAEvC,OAAO,6BAA6B,MAAM,aAAa,WAAW,SAAS,QAAQ,CAAC;AACtF;;;;;;;;;;;;;;;AAgBA,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC/DA,IAAa,UAAb,MAAmD;CAWjD,AAAO,YAAY,QAAuB;EACxC,MAAM,EAAE,SAAS,UAAU,SAAS,GAAG,kBAAkB;EAEzD,KAAK,WAAW;EAChB,KAAK,UAAU;EAQf,KAAK,SAAS,IAAIA,gCAAU;GAC1B,GAAG;GACH,SAAS;GACT,UAAU,KAAK;GACf;EACF,CAAC;CACH;;;;;;;;;;;;;;;;;;CAmBA,AAAO,MAAM,QAAwC;EACnD,MAAM,kBACJ,OAAO,WAAW,KAAK,UAAU,OAAO,SAAS,kBAAkB,OAAO,IAAI;EAEhF,MAAM,SAAS,OAAO,iBAAiB,mBAAmB,OAAO,IAAI;EAErE,OAAO,KAAK,OAAO,MAAM;GACvB,GAAG;GACH,GAAI,WAAW,SAAY,EAAE,eAAe,OAAO,IAAI,CAAC;GAIxD,QAAQ,OAAO,UAAU,sBAAsB,OAAO,IAAI;GAC1D,WAAW,OAAO,aAAa,yBAAyB,OAAO,IAAI;GACnE,kBAAkB,OAAO,oBAAoB;GAC7C,SAAS;EACX,CAAC;CACH;;;;;;;CAQA,MAAa,MAAM,MAAc,OAAiC;EAChE,OAAO,KAAK,OAAO,MAAM,MAAM,KAAK;CACtC;;;;;;;;;;;CAYA,AAAO,SAAS,QAA8C;EAC5D,OAAO,KAAK,OAAO,SAAS,MAAM;CACpC;;;;;;;;;;;CAiBA,MAAa,OAAO,SAAmD;EACrE,OAAO,KAAK,OAAO,OAAO,OAAO;CACnC;AACF;;;;;;;;AASA,SAAS,kBAAkB,MAAwC;CACjE,OAAO,qBAAqB;AAC9B;;;;;;;;;;;AAYA,MAAa,uBAA+D;CAC1E,uBAAuB;EAAE,OAAO;EAAM,QAAQ;EAAK,aAAa;CAAM;CACtE,sBAAsB;EAAE,OAAO;EAAO,QAAQ;EAAK,aAAa;CAAO;CACvE,gCAAgC;EAAE,OAAO;EAAO,QAAQ;EAAK,aAAa;CAAO;CACjF,oBAAoB;EAAE,OAAO;EAAK,QAAQ;CAAE;AAC9C"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["OpenAISDK"],"sources":["../../../../../../../packages/ai-groq/src/known-context-windows.ts","../../../../../../../packages/ai-groq/src/known-models.ts","../../../../../../../packages/ai-groq/src/sdk.ts","../../../../../../../packages/ai-groq/src/known-lifecycle.ts"],"sourcesContent":["/*\n * Context windows of the chat models Groq hosts, from its model catalog:\n * the Llama, gpt-oss, Qwen3 and DeepSeek-R1 distill ids document 131,072\n * tokens, Kimi K2 262,144.\n * The longest matching fragment wins; ids that match nothing resolve to `undefined`, so a\n * window-relative trigger stays inert until the window is set with\n * `groq.model({ name, contextWindow })`.\n */\nconst KNOWN_WINDOWS: ReadonlyArray<readonly [fragment: string, window: number]> = [\n [\"llama-3\", 131_072],\n [\"llama-4\", 131_072],\n [\"gpt-oss\", 131_072],\n [\"qwen3\", 131_072],\n [\"deepseek-r1-distill\", 131_072],\n [\"kimi-k2\", 262_144],\n];\n\n/**\n * The known context window (tokens, input plus output) of a Groq-hosted chat\n * model id, or `undefined` when it is not in the table.\n *\n * @example\n * inferContextWindow(\"llama-3\"); // → 131072\n */\nexport function inferContextWindow(modelId: string): number | undefined {\n const id = modelId.toLowerCase();\n let best: readonly [string, number] | undefined;\n\n for (const entry of KNOWN_WINDOWS) {\n const fragment = entry[0];\n\n if (id.includes(fragment) && (!best || fragment.length > best[0].length)) {\n best = entry;\n }\n }\n\n return best?.[1];\n}\n","/**\n * Default base URL for Groq's OpenAI-compatible Chat Completions\n * endpoint. Groq exposes the same wire protocol as OpenAI under this\n * prefix, which is exactly why `GroqSDK` can delegate to the\n * battle-tested `OpenAISDK` instead of reimplementing the transport.\n *\n * Verified against Groq's \"OpenAI Compatibility\" docs (mid-2026).\n * Override via `new GroqSDK({ baseURL })` if Groq ever relocates it.\n */\nexport const GROQ_BASE_URL = \"https://api.groq.com/openai/v1\";\n\n/**\n * The provider label every model produced by `GroqSDK` self-identifies\n * with. Flows through to `ModelContract.provider`, `AgentReport.model`,\n * logs, and any provider-aware middleware. Kept as a constant so the\n * wrapper and the inner `OpenAISDK` agree on one spelling.\n */\nexport const GROQ_PROVIDER = \"groq\";\n\n/**\n * Substrings identifying Groq-hosted model ids whose family accepts\n * image input (vision).\n *\n * Groq hosts *open* models on its LPU hardware, so the ids are the\n * upstream open-weight names rather than OpenAI's — which is why the\n * OpenAI adapter's `gpt-4o*` prefix inference would never fire here and\n * this provider must carry its OWN list. Verified against Groq's\n * supported-models catalog (mid-2026):\n *\n * - `openai/gpt-oss-*` — natively multimodal OpenAI open-weight family\n * (the current production vision + reasoning models on Groq).\n * - `llama-4` / `llama-3.2-*-vision` — Meta's multimodal Llama families.\n * Kept as substrings so any still-hosted or re-introduced variant is\n * covered even though some `llama-4` ids were deprecated in 2026.\n *\n * Matched as a substring (not a prefix) because Groq prefixes several\n * ids with an org segment (`openai/`, `meta-llama/`) and appends size /\n * date suffixes. Override per-model via\n * `groq.model({ name, vision: true | false })`.\n */\nconst VISION_CAPABLE_SUBSTRINGS = [\n \"gpt-oss\",\n \"llama-4\",\n \"llama-3.2-11b-vision\",\n \"llama-3.2-90b-vision\",\n \"vision\",\n];\n\n/**\n * Substrings identifying Groq-hosted model ids that expose an internal\n * reasoning / thinking channel and accept the `reasoning_effort`\n * request parameter on the OpenAI-compatible Chat Completions endpoint.\n *\n * Verified against Groq's catalog (mid-2026):\n * - `gpt-oss` — the OpenAI open-weight family reasons by default.\n * - `deepseek-r1-distill` — DeepSeek-R1-style reasoning at Groq speed.\n * - `qwq` / `qwen3` — Qwen reasoning families (when hosted).\n *\n * Matched as a substring for the same org-prefix / suffix reason as the\n * vision list. Override per-model via\n * `groq.model({ name, reasoning: true | false })`.\n */\nconst REASONING_CAPABLE_SUBSTRINGS = [\n \"gpt-oss\",\n \"deepseek-r1\",\n \"deepseek-r1-distill\",\n \"qwq\",\n \"qwen3\",\n];\n\n/**\n * Infer whether a Groq-hosted model id supports vision based on the\n * known multimodal-family substrings. Unknown ids default to `false`\n * so passing an image attachment to a text-only model (e.g.\n * `llama-3.3-70b-versatile`) surfaces a clear, agent-side capability\n * error instead of an opaque upstream 400.\n *\n * @example\n * inferVisionCapability(\"openai/gpt-oss-120b\"); // → true\n * inferVisionCapability(\"meta-llama/llama-4-scout\"); // → true\n * inferVisionCapability(\"llama-3.3-70b-versatile\"); // → false\n * inferVisionCapability(\"llama-3.1-8b-instant\"); // → false\n */\nexport function inferVisionCapability(modelId: string): boolean {\n const normalized = modelId.toLowerCase();\n\n return VISION_CAPABLE_SUBSTRINGS.some((fragment) => normalized.includes(fragment));\n}\n\n/**\n * Infer whether a Groq-hosted model id is a reasoning model based on\n * the known reasoning-family substrings. Unknown ids default to `false`\n * so the adapter never forwards an unsupported `reasoning_effort` param\n * to a non-reasoning model (which would 400).\n *\n * @example\n * inferReasoningCapability(\"openai/gpt-oss-20b\"); // → true\n * inferReasoningCapability(\"deepseek-r1-distill-llama-70b\"); // → true\n * inferReasoningCapability(\"llama-3.3-70b-versatile\"); // → false\n */\nexport function inferReasoningCapability(modelId: string): boolean {\n const normalized = modelId.toLowerCase();\n\n return REASONING_CAPABLE_SUBSTRINGS.some((fragment) => normalized.includes(fragment));\n}\n\n/**\n * Curated list of current Groq chat model ids, for autocomplete, docs, and\n * default selection. NOT exhaustive and NOT a runtime allow-list —\n * `groq.model({ name })` accepts any string, so a newly launched id works\n * the moment Groq ships it without a package bump. Ids Groq has shut down\n * are left out here and recorded as `retired` in\n * {@link GROQ_MODEL_LIFECYCLE}.\n *\n * - `openai/gpt-oss-120b` / `openai/gpt-oss-20b` — OpenAI open-weight\n * family; vision + reasoning capable.\n * - `qwen/qwen3.8-27b` — Qwen 3.8 (a preview model on Groq).\n */\nexport const GROQ_KNOWN_MODELS = [\n \"openai/gpt-oss-120b\",\n \"openai/gpt-oss-20b\",\n \"qwen/qwen3.8-27b\",\n] as const;\n","import type {\n ListModelsOptions,\n ModelInfo,\n EmbedderContract,\n ModelContract,\n ModelPricing,\n SDKAdapterContract,\n} from \"@warlock.js/ai\";\nimport { OpenAISDK } from \"@warlock.js/ai-openai\";\nimport type { GroqEmbedderConfig, GroqModelConfig, GroqSDKConfig } from \"./config.type\";\nimport { inferContextWindow } from \"./known-context-windows\";\nimport {\n GROQ_BASE_URL,\n GROQ_PROVIDER,\n inferReasoningCapability,\n inferVisionCapability,\n} from \"./known-models\";\n\n/**\n * Groq-backed implementation of `SDKAdapterContract`.\n *\n * **Role.** The package entry point for Groq-hosted open models\n * (`llama-3.3-70b-versatile`, `llama-3.1-8b-instant`,\n * `openai/gpt-oss-*`, `deepseek-r1-distill-*`, …) served on Groq's fast\n * LPU hardware. Because Groq exposes the OpenAI Chat Completions wire\n * protocol verbatim, `GroqSDK` is a **thin wrapper over the already\n * battle-tested {@link OpenAISDK}** rather than a fresh transport\n * implementation — it owns one internal `OpenAISDK` pointed at Groq's\n * `baseURL` with the `\"groq\"` provider label, and delegates `model()` /\n * `embedder()` / `count()` to it.\n *\n * **Why a wrapper and not `OpenAISDK` directly?** Groq hosts *open*\n * models whose ids are the upstream open-weight names (`llama-…`,\n * `openai/gpt-oss-…`), not OpenAI's (`gpt-4o`, `o3`). The OpenAI\n * adapter's capability inference keys on OpenAI prefixes and would never\n * fire here, so every Groq model would come back with `vision`/\n * `reasoning` silently `false`. `GroqSDK` fixes that by computing\n * **this provider's own** vision/reasoning inference (see\n * `known-models.ts`) and injecting the result as explicit capability\n * config — which wins over the inner adapter's inference — plus a set of\n * default per-model pricing rates. Everything else (transport, retries,\n * streaming, structured output, error wrapping, usage accounting) is\n * inherited unchanged from `OpenAISDK`.\n *\n * **Responsibility.**\n * - Owns: one long-lived internal `OpenAISDK` (auth + Groq base URL) and\n * this provider's capability + default-pricing inference.\n * - Does NOT own: the wire protocol, streaming loop, structured-output\n * mapping, or error wrapping — all inherited from `OpenAISDK`.\n *\n * Modeled as a class (see §4.2 of code-style.md — \"long-lived state\n * across many calls\"), fronted by FP usage like the other adapters.\n *\n * @example\n * const groq = new GroqSDK({ apiKey: process.env.GROQ_API_KEY! });\n * const model = groq.model({ name: \"llama-3.3-70b-versatile\", temperature: 0.7 });\n * const reasoner = groq.model({ name: \"openai/gpt-oss-120b\" }); // vision + reasoning auto-true\n *\n * @example\n * // Compose into an `ai.groq` namespace for ergonomic agent wiring\n * const ai = { agent, tool, systemPrompt, groq: new GroqSDK({ apiKey }) };\n * const myAgent = ai.agent({ model: ai.groq.model({ name: \"llama-3.1-8b-instant\" }) });\n */\nexport class GroqSDK implements SDKAdapterContract {\n /**\n * The wrapped OpenAI-compatible adapter, pre-pointed at Groq's\n * `baseURL` and labeled with the `\"groq\"` provider. All real wire work\n * happens here; `GroqSDK` only enriches the per-model config before\n * delegating.\n */\n private readonly openai: OpenAISDK;\n private readonly provider: string;\n private readonly pricing?: Record<string, ModelPricing>;\n\n public constructor(config: GroqSDKConfig) {\n const { baseURL, provider, pricing, ...clientOptions } = config;\n\n this.provider = provider ?? GROQ_PROVIDER;\n this.pricing = pricing;\n\n // Build the inner OpenAI-compatible client pointed at Groq. Forward\n // every other upstream ClientOptions (timeout, maxRetries,\n // defaultHeaders, fetch, …) verbatim — they type-check, so dropping\n // them would be a silent footgun. We pass `pricing` through too so\n // the inner registry stays a fallback, while THIS class's `model()`\n // layers Groq default rates on top.\n this.openai = new OpenAISDK({\n ...clientOptions,\n baseURL: baseURL ?? GROQ_BASE_URL,\n provider: this.provider,\n pricing,\n });\n }\n\n /**\n * Build a `ModelContract` bound to the internal Groq-pointed client.\n *\n * The wrapper's whole job lives here: it computes **Groq's** vision /\n * reasoning inference from the model id and forwards the result as\n * *explicit* `vision` / `reasoning` config to the inner\n * `OpenAISDK.model()`. Because explicit capability config wins over the\n * inner adapter's OpenAI-prefix inference, the returned model reports\n * the right capabilities even though the id isn't an OpenAI name. A\n * caller-supplied `vision` / `reasoning` still wins over this\n * inference (we only fill the gap when the field is omitted).\n *\n * Pricing resolution: per-model `config.pricing` wins; otherwise this\n * SDK's `pricing` registry keyed by `config.name`; otherwise the\n * adapter's built-in default rate for the model; otherwise `undefined`\n * (no cost computed).\n */\n public model(config: GroqModelConfig): ModelContract {\n const resolvedPricing =\n config.pricing ?? this.pricing?.[config.name] ?? defaultPricingFor(config.name);\n\n const window = config.contextWindow ?? inferContextWindow(config.name);\n\n return this.openai.model({\n ...config,\n ...(window !== undefined ? { contextWindow: window } : {}),\n // Fill capability inference only when the caller didn't pin it —\n // explicit caller config always wins, then Groq inference, then\n // (inside OpenAISDK) the harmless OpenAI inference that won't match.\n vision: config.vision ?? inferVisionCapability(config.name),\n reasoning: config.reasoning ?? inferReasoningCapability(config.name),\n structuredOutput: config.structuredOutput ?? true,\n pricing: resolvedPricing,\n });\n }\n\n /**\n * Rough offline token-count estimate. Delegated straight to the inner\n * `OpenAISDK`, which uses the core character-heuristic\n * (`approximateTokenCount`). Good for budgeting / quota guards, not for\n * billing.\n */\n public async count(text: string, model?: string): Promise<number> {\n return this.openai.count(text, model);\n }\n\n /**\n * Build an embedder bound to the internal client. Delegated to the\n * inner `OpenAISDK`.\n *\n * IMPORTANT: as of mid-2026 Groq does **not** expose an\n * OpenAI-compatible embeddings endpoint, so a live `.embed()` /\n * `.embedMany()` call will fail at the provider. The method is kept for\n * adapter symmetry; use `@warlock.js/ai-openai` or\n * `@warlock.js/ai-google` for retrieval embeddings.\n */\n public embedder(config: GroqEmbedderConfig): EmbedderContract {\n return this.openai.embedder(config);\n }\n\n // NOTE: `image()` is intentionally NOT implemented. Groq hosts no\n // image-generation API, and `SDKAdapterContract.image` is optional —\n // its structural absence IS the capability guard, so\n // `ai.groq.image(...)` is a compile-time error rather than a runtime\n // surprise (mirrors Anthropic / Bedrock / Ollama).\n /**\n * List the models this Groq account can use, live from the provider's\n * OpenAI-compatible `GET /models`, mapped to the common `ModelInfo`\n * shape. Groq models marked inactive are left out; `contextWindow` comes from `context_window`. Failures are thrown as the adapter's usual provider\n * errors, never an empty list.\n *\n * @example\n * const models = await groq.models();\n * models.map((model) => model.id);\n */\n public async models(options?: ListModelsOptions): Promise<ModelInfo[]> {\n return this.openai.models(options);\n }\n}\n\n/**\n * Built-in default USD-per-1,000,000-token rates for the Groq models with\n * a published price, used as the last fallback in `model()`'s pricing\n * resolution. A per-model or SDK-level `pricing` entry always wins over\n * these. Returns `undefined` for any unlisted id so cost stays an honest\n * absence rather than a false zero.\n */\nfunction defaultPricingFor(name: string): ModelPricing | undefined {\n return GROQ_DEFAULT_PRICING[name];\n}\n\n/** The date the {@link GROQ_DEFAULT_PRICING} token rates were last checked against Groq's model page. */\nexport const GROQ_DEFAULT_PRICING_AS_OF = \"2026-11-06\";\n\n/**\n * Default per-million-token USD rates for Groq models.\n *\n * Source: https://console.groq.com/docs/models (groq.com/pricing now\n * redirects to the home page), as of {@link GROQ_DEFAULT_PRICING_AS_OF}. Cached input is 50%\n * of the input rate for the gpt-oss models, the only ones Groq caches\n * (https://console.groq.com/docs/prompt-caching, checked 2026-10-17; no write charge). The\n * Llama models are listed as \"Enterprise – Contact Sales\" with no public\n * price, so they stay unpriced — pass `pricing` for them.\n */\nexport const GROQ_DEFAULT_PRICING: Readonly<Record<string, ModelPricing>> = {\n \"openai/gpt-oss-120b\": { input: 0.15, output: 0.6, cachedInput: 0.075 },\n \"openai/gpt-oss-20b\": { input: 0.075, output: 0.3, cachedInput: 0.0375 },\n \"openai/gpt-oss-safeguard-20b\": { input: 0.075, output: 0.3, cachedInput: 0.0375 },\n \"qwen/qwen3.8-27b\": { input: 0.8, output: 4 },\n};\n","import type { ModelLifecycle } from \"@warlock.js/ai\";\n\n/**\n * Where Groq's deprecations page and model catalog put the chat models the\n * adapter knows, as of {@link GROQ_MODEL_LIFECYCLE_AS_OF}. `retired` ids\n * are past their shutdown date; Groq applies several of these shutdowns to\n * free and developer-tier usage only, so a committed-spend enterprise\n * contract can still serve them.\n *\n * Sources: https://console.groq.com/docs/deprecations and\n * https://console.groq.com/docs/models. Preview models (`qwen/qwen3.8-27b`,\n * `openai/gpt-oss-safeguard-20b`) are listed as `current` while Groq\n * serves them, but Groq may discontinue previews at short notice.\n */\nexport const GROQ_MODEL_LIFECYCLE: Readonly<Record<string, ModelLifecycle>> = {\n \"openai/gpt-oss-120b\": { status: \"current\" },\n \"openai/gpt-oss-20b\": { status: \"current\" },\n \"openai/gpt-oss-safeguard-20b\": { status: \"current\" },\n \"qwen/qwen3.8-27b\": { status: \"current\" },\n \"llama-3.3-70b-versatile\": {\n status: \"retired\",\n retiresOn: \"2026-08-16\",\n replacement: \"openai/gpt-oss-120b\",\n },\n \"llama-3.1-8b-instant\": {\n status: \"retired\",\n retiresOn: \"2026-08-16\",\n replacement: \"openai/gpt-oss-20b\",\n },\n \"deepseek-r1-distill-llama-70b\": {\n status: \"retired\",\n retiresOn: \"2025-10-02\",\n replacement: \"openai/gpt-oss-120b\",\n },\n \"qwen/qwen3.6-27b\": {\n status: \"retired\",\n retiresOn: \"2026-09-14\",\n replacement: \"qwen/qwen3.8-27b\",\n },\n \"qwen/qwen3-32b\": {\n status: \"retired\",\n retiresOn: \"2026-07-17\",\n replacement: \"openai/gpt-oss-120b\",\n },\n \"meta-llama/llama-4-scout-17b-16e-instruct\": {\n status: \"retired\",\n retiresOn: \"2026-07-17\",\n replacement: \"openai/gpt-oss-120b\",\n },\n \"meta-llama/llama-4-maverick-17b-128e-instruct\": {\n status: \"retired\",\n retiresOn: \"2026-03-09\",\n replacement: \"openai/gpt-oss-120b\",\n },\n \"moonshotai/kimi-k2-instruct-0905\": {\n status: \"retired\",\n retiresOn: \"2026-04-15\",\n replacement: \"openai/gpt-oss-120b\",\n },\n \"moonshotai/kimi-k2-instruct\": {\n status: \"retired\",\n retiresOn: \"2025-10-10\",\n replacement: \"openai/gpt-oss-120b\",\n },\n \"groq/compound\": { status: \"retired\", retiresOn: \"2026-09-21\" },\n \"groq/compound-mini\": { status: \"retired\", retiresOn: \"2026-09-21\" },\n};\n\n/** The date {@link GROQ_MODEL_LIFECYCLE} was last checked against Groq's deprecations page. */\nexport const GROQ_MODEL_LIFECYCLE_AS_OF = \"2026-11-06\";\n\n/**\n * Look up the lifecycle of a Groq model id (exact match), or `undefined`\n * when the table does not cover it.\n *\n * @example\n * groqLifecycleFor(\"llama-3.3-70b-versatile\"); // { status: \"retired\", retiresOn: \"2026-08-16\", … }\n */\nexport function groqLifecycleFor(modelName: string): ModelLifecycle | undefined {\n return Object.hasOwn(GROQ_MODEL_LIFECYCLE, modelName)\n ? GROQ_MODEL_LIFECYCLE[modelName]\n : undefined;\n}\n"],"mappings":";;;;AAQA,MAAM,gBAA4E;CAChF,CAAC,WAAW,MAAO;CACnB,CAAC,WAAW,MAAO;CACnB,CAAC,WAAW,MAAO;CACnB,CAAC,SAAS,MAAO;CACjB,CAAC,uBAAuB,MAAO;CAC/B,CAAC,WAAW,MAAO;AACrB;;;;;;;;AASA,SAAgB,mBAAmB,SAAqC;CACtE,MAAM,KAAK,QAAQ,YAAY;CAC/B,IAAI;CAEJ,KAAK,MAAM,SAAS,eAAe;EACjC,MAAM,WAAW,MAAM;EAEvB,IAAI,GAAG,SAAS,QAAQ,MAAM,CAAC,QAAQ,SAAS,SAAS,KAAK,EAAE,CAAC,SAC/D,OAAO;CAEX;CAEA,OAAO,OAAO;AAChB;;;;;;;;;;;;;AC5BA,MAAa,gBAAgB;;;;;;;AAQ7B,MAAa,gBAAgB;;;;;;;;;;;;;;;;;;;;;;AAuB7B,MAAM,4BAA4B;CAChC;CACA;CACA;CACA;CACA;AACF;;;;;;;;;;;;;;;AAgBA,MAAM,+BAA+B;CACnC;CACA;CACA;CACA;CACA;AACF;;;;;;;;;;;;;;AAeA,SAAgB,sBAAsB,SAA0B;CAC9D,MAAM,aAAa,QAAQ,YAAY;CAEvC,OAAO,0BAA0B,MAAM,aAAa,WAAW,SAAS,QAAQ,CAAC;AACnF;;;;;;;;;;;;AAaA,SAAgB,yBAAyB,SAA0B;CACjE,MAAM,aAAa,QAAQ,YAAY;CAEvC,OAAO,6BAA6B,MAAM,aAAa,WAAW,SAAS,QAAQ,CAAC;AACtF;;;;;;;;;;;;;AAcA,MAAa,oBAAoB;CAC/B;CACA;CACA;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC3DA,IAAa,UAAb,MAAmD;CAWjD,AAAO,YAAY,QAAuB;EACxC,MAAM,EAAE,SAAS,UAAU,SAAS,GAAG,kBAAkB;EAEzD,KAAK,WAAW;EAChB,KAAK,UAAU;EAQf,KAAK,SAAS,IAAIA,gCAAU;GAC1B,GAAG;GACH,SAAS;GACT,UAAU,KAAK;GACf;EACF,CAAC;CACH;;;;;;;;;;;;;;;;;;CAmBA,AAAO,MAAM,QAAwC;EACnD,MAAM,kBACJ,OAAO,WAAW,KAAK,UAAU,OAAO,SAAS,kBAAkB,OAAO,IAAI;EAEhF,MAAM,SAAS,OAAO,iBAAiB,mBAAmB,OAAO,IAAI;EAErE,OAAO,KAAK,OAAO,MAAM;GACvB,GAAG;GACH,GAAI,WAAW,SAAY,EAAE,eAAe,OAAO,IAAI,CAAC;GAIxD,QAAQ,OAAO,UAAU,sBAAsB,OAAO,IAAI;GAC1D,WAAW,OAAO,aAAa,yBAAyB,OAAO,IAAI;GACnE,kBAAkB,OAAO,oBAAoB;GAC7C,SAAS;EACX,CAAC;CACH;;;;;;;CAQA,MAAa,MAAM,MAAc,OAAiC;EAChE,OAAO,KAAK,OAAO,MAAM,MAAM,KAAK;CACtC;;;;;;;;;;;CAYA,AAAO,SAAS,QAA8C;EAC5D,OAAO,KAAK,OAAO,SAAS,MAAM;CACpC;;;;;;;;;;;CAiBA,MAAa,OAAO,SAAmD;EACrE,OAAO,KAAK,OAAO,OAAO,OAAO;CACnC;AACF;;;;;;;;AASA,SAAS,kBAAkB,MAAwC;CACjE,OAAO,qBAAqB;AAC9B;;AAGA,MAAa,6BAA6B;;;;;;;;;;;AAY1C,MAAa,uBAA+D;CAC1E,uBAAuB;EAAE,OAAO;EAAM,QAAQ;EAAK,aAAa;CAAM;CACtE,sBAAsB;EAAE,OAAO;EAAO,QAAQ;EAAK,aAAa;CAAO;CACvE,gCAAgC;EAAE,OAAO;EAAO,QAAQ;EAAK,aAAa;CAAO;CACjF,oBAAoB;EAAE,OAAO;EAAK,QAAQ;CAAE;AAC9C;;;;;;;;;;;;;;;;AC7LA,MAAa,uBAAiE;CAC5E,uBAAuB,EAAE,QAAQ,UAAU;CAC3C,sBAAsB,EAAE,QAAQ,UAAU;CAC1C,gCAAgC,EAAE,QAAQ,UAAU;CACpD,oBAAoB,EAAE,QAAQ,UAAU;CACxC,2BAA2B;EACzB,QAAQ;EACR,WAAW;EACX,aAAa;CACf;CACA,wBAAwB;EACtB,QAAQ;EACR,WAAW;EACX,aAAa;CACf;CACA,iCAAiC;EAC/B,QAAQ;EACR,WAAW;EACX,aAAa;CACf;CACA,oBAAoB;EAClB,QAAQ;EACR,WAAW;EACX,aAAa;CACf;CACA,kBAAkB;EAChB,QAAQ;EACR,WAAW;EACX,aAAa;CACf;CACA,6CAA6C;EAC3C,QAAQ;EACR,WAAW;EACX,aAAa;CACf;CACA,iDAAiD;EAC/C,QAAQ;EACR,WAAW;EACX,aAAa;CACf;CACA,oCAAoC;EAClC,QAAQ;EACR,WAAW;EACX,aAAa;CACf;CACA,+BAA+B;EAC7B,QAAQ;EACR,WAAW;EACX,aAAa;CACf;CACA,iBAAiB;EAAE,QAAQ;EAAW,WAAW;CAAa;CAC9D,sBAAsB;EAAE,QAAQ;EAAW,WAAW;CAAa;AACrE;;AAGA,MAAa,6BAA6B;;;;;;;;AAS1C,SAAgB,iBAAiB,WAA+C;CAC9E,OAAO,OAAO,OAAO,sBAAsB,SAAS,IAChD,qBAAqB,aACrB;AACN"}
|
package/esm/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GroqEmbedderConfig, GroqModelConfig, GroqSDKConfig } from "./config.type.mjs";
|
|
2
|
-
import { GROQ_DEFAULT_PRICING, GroqSDK } from "./sdk.mjs";
|
|
2
|
+
import { GROQ_DEFAULT_PRICING, GROQ_DEFAULT_PRICING_AS_OF, GroqSDK } from "./sdk.mjs";
|
|
3
|
+
import { GROQ_MODEL_LIFECYCLE, GROQ_MODEL_LIFECYCLE_AS_OF, groqLifecycleFor } from "./known-lifecycle.mjs";
|
|
3
4
|
import { GROQ_BASE_URL, GROQ_KNOWN_MODELS, GROQ_PROVIDER, inferReasoningCapability, inferVisionCapability } from "./known-models.mjs";
|
|
4
|
-
export { GROQ_BASE_URL, GROQ_DEFAULT_PRICING, GROQ_KNOWN_MODELS, GROQ_PROVIDER, type GroqEmbedderConfig, type GroqModelConfig, GroqSDK, type GroqSDKConfig, inferReasoningCapability, inferVisionCapability };
|
|
5
|
+
export { GROQ_BASE_URL, GROQ_DEFAULT_PRICING, GROQ_DEFAULT_PRICING_AS_OF, GROQ_KNOWN_MODELS, GROQ_MODEL_LIFECYCLE, GROQ_MODEL_LIFECYCLE_AS_OF, GROQ_PROVIDER, type GroqEmbedderConfig, type GroqModelConfig, GroqSDK, type GroqSDKConfig, groqLifecycleFor, inferReasoningCapability, inferVisionCapability };
|
package/esm/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GROQ_BASE_URL, GROQ_KNOWN_MODELS, GROQ_PROVIDER, inferReasoningCapability, inferVisionCapability } from "./known-models.mjs";
|
|
2
|
-
import { GROQ_DEFAULT_PRICING, GroqSDK } from "./sdk.mjs";
|
|
2
|
+
import { GROQ_DEFAULT_PRICING, GROQ_DEFAULT_PRICING_AS_OF, GroqSDK } from "./sdk.mjs";
|
|
3
|
+
import { GROQ_MODEL_LIFECYCLE, GROQ_MODEL_LIFECYCLE_AS_OF, groqLifecycleFor } from "./known-lifecycle.mjs";
|
|
3
4
|
|
|
4
|
-
export { GROQ_BASE_URL, GROQ_DEFAULT_PRICING, GROQ_KNOWN_MODELS, GROQ_PROVIDER, GroqSDK, inferReasoningCapability, inferVisionCapability };
|
|
5
|
+
export { GROQ_BASE_URL, GROQ_DEFAULT_PRICING, GROQ_DEFAULT_PRICING_AS_OF, GROQ_KNOWN_MODELS, GROQ_MODEL_LIFECYCLE, GROQ_MODEL_LIFECYCLE_AS_OF, GROQ_PROVIDER, GroqSDK, groqLifecycleFor, inferReasoningCapability, inferVisionCapability };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ModelLifecycle } from "@warlock.js/ai";
|
|
2
|
+
//#region ../../packages/ai-groq/src/known-lifecycle.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Where Groq's deprecations page and model catalog put the chat models the
|
|
5
|
+
* adapter knows, as of {@link GROQ_MODEL_LIFECYCLE_AS_OF}. `retired` ids
|
|
6
|
+
* are past their shutdown date; Groq applies several of these shutdowns to
|
|
7
|
+
* free and developer-tier usage only, so a committed-spend enterprise
|
|
8
|
+
* contract can still serve them.
|
|
9
|
+
*
|
|
10
|
+
* Sources: https://console.groq.com/docs/deprecations and
|
|
11
|
+
* https://console.groq.com/docs/models. Preview models (`qwen/qwen3.8-27b`,
|
|
12
|
+
* `openai/gpt-oss-safeguard-20b`) are listed as `current` while Groq
|
|
13
|
+
* serves them, but Groq may discontinue previews at short notice.
|
|
14
|
+
*/
|
|
15
|
+
export declare const GROQ_MODEL_LIFECYCLE: Readonly<Record<string, ModelLifecycle>>;
|
|
16
|
+
/** The date {@link GROQ_MODEL_LIFECYCLE} was last checked against Groq's deprecations page. */
|
|
17
|
+
export declare const GROQ_MODEL_LIFECYCLE_AS_OF = "2026-11-06";
|
|
18
|
+
/**
|
|
19
|
+
* Look up the lifecycle of a Groq model id (exact match), or `undefined`
|
|
20
|
+
* when the table does not cover it.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* groqLifecycleFor("llama-3.3-70b-versatile"); // { status: "retired", retiresOn: "2026-08-16", … }
|
|
24
|
+
*/
|
|
25
|
+
export declare function groqLifecycleFor(modelName: string): ModelLifecycle | undefined;
|
|
26
|
+
//#endregion
|
|
27
|
+
//# sourceMappingURL=known-lifecycle.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"known-lifecycle.d.mts","names":[],"sources":["../../../../../../../packages/ai-groq/src/known-lifecycle.ts"],"mappings":";;;;;;;;;;;;;;qBAca,sBAAsB,SAAS,eAAe;;qBAuD9C;;;;;;;;wBASG,iBAAiB,oBAAoB"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
//#region ../../packages/ai-groq/src/known-lifecycle.ts
|
|
2
|
+
/**
|
|
3
|
+
* Where Groq's deprecations page and model catalog put the chat models the
|
|
4
|
+
* adapter knows, as of {@link GROQ_MODEL_LIFECYCLE_AS_OF}. `retired` ids
|
|
5
|
+
* are past their shutdown date; Groq applies several of these shutdowns to
|
|
6
|
+
* free and developer-tier usage only, so a committed-spend enterprise
|
|
7
|
+
* contract can still serve them.
|
|
8
|
+
*
|
|
9
|
+
* Sources: https://console.groq.com/docs/deprecations and
|
|
10
|
+
* https://console.groq.com/docs/models. Preview models (`qwen/qwen3.8-27b`,
|
|
11
|
+
* `openai/gpt-oss-safeguard-20b`) are listed as `current` while Groq
|
|
12
|
+
* serves them, but Groq may discontinue previews at short notice.
|
|
13
|
+
*/
|
|
14
|
+
const GROQ_MODEL_LIFECYCLE = {
|
|
15
|
+
"openai/gpt-oss-120b": { status: "current" },
|
|
16
|
+
"openai/gpt-oss-20b": { status: "current" },
|
|
17
|
+
"openai/gpt-oss-safeguard-20b": { status: "current" },
|
|
18
|
+
"qwen/qwen3.8-27b": { status: "current" },
|
|
19
|
+
"llama-3.3-70b-versatile": {
|
|
20
|
+
status: "retired",
|
|
21
|
+
retiresOn: "2026-08-16",
|
|
22
|
+
replacement: "openai/gpt-oss-120b"
|
|
23
|
+
},
|
|
24
|
+
"llama-3.1-8b-instant": {
|
|
25
|
+
status: "retired",
|
|
26
|
+
retiresOn: "2026-08-16",
|
|
27
|
+
replacement: "openai/gpt-oss-20b"
|
|
28
|
+
},
|
|
29
|
+
"deepseek-r1-distill-llama-70b": {
|
|
30
|
+
status: "retired",
|
|
31
|
+
retiresOn: "2025-10-02",
|
|
32
|
+
replacement: "openai/gpt-oss-120b"
|
|
33
|
+
},
|
|
34
|
+
"qwen/qwen3.6-27b": {
|
|
35
|
+
status: "retired",
|
|
36
|
+
retiresOn: "2026-09-14",
|
|
37
|
+
replacement: "qwen/qwen3.8-27b"
|
|
38
|
+
},
|
|
39
|
+
"qwen/qwen3-32b": {
|
|
40
|
+
status: "retired",
|
|
41
|
+
retiresOn: "2026-07-17",
|
|
42
|
+
replacement: "openai/gpt-oss-120b"
|
|
43
|
+
},
|
|
44
|
+
"meta-llama/llama-4-scout-17b-16e-instruct": {
|
|
45
|
+
status: "retired",
|
|
46
|
+
retiresOn: "2026-07-17",
|
|
47
|
+
replacement: "openai/gpt-oss-120b"
|
|
48
|
+
},
|
|
49
|
+
"meta-llama/llama-4-maverick-17b-128e-instruct": {
|
|
50
|
+
status: "retired",
|
|
51
|
+
retiresOn: "2026-03-09",
|
|
52
|
+
replacement: "openai/gpt-oss-120b"
|
|
53
|
+
},
|
|
54
|
+
"moonshotai/kimi-k2-instruct-0905": {
|
|
55
|
+
status: "retired",
|
|
56
|
+
retiresOn: "2026-04-15",
|
|
57
|
+
replacement: "openai/gpt-oss-120b"
|
|
58
|
+
},
|
|
59
|
+
"moonshotai/kimi-k2-instruct": {
|
|
60
|
+
status: "retired",
|
|
61
|
+
retiresOn: "2025-10-10",
|
|
62
|
+
replacement: "openai/gpt-oss-120b"
|
|
63
|
+
},
|
|
64
|
+
"groq/compound": {
|
|
65
|
+
status: "retired",
|
|
66
|
+
retiresOn: "2026-09-21"
|
|
67
|
+
},
|
|
68
|
+
"groq/compound-mini": {
|
|
69
|
+
status: "retired",
|
|
70
|
+
retiresOn: "2026-09-21"
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
/** The date {@link GROQ_MODEL_LIFECYCLE} was last checked against Groq's deprecations page. */
|
|
74
|
+
const GROQ_MODEL_LIFECYCLE_AS_OF = "2026-11-06";
|
|
75
|
+
/**
|
|
76
|
+
* Look up the lifecycle of a Groq model id (exact match), or `undefined`
|
|
77
|
+
* when the table does not cover it.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* groqLifecycleFor("llama-3.3-70b-versatile"); // { status: "retired", retiresOn: "2026-08-16", … }
|
|
81
|
+
*/
|
|
82
|
+
function groqLifecycleFor(modelName) {
|
|
83
|
+
return Object.hasOwn(GROQ_MODEL_LIFECYCLE, modelName) ? GROQ_MODEL_LIFECYCLE[modelName] : void 0;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
//#endregion
|
|
87
|
+
export { GROQ_MODEL_LIFECYCLE, GROQ_MODEL_LIFECYCLE_AS_OF, groqLifecycleFor };
|
|
88
|
+
//# sourceMappingURL=known-lifecycle.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"known-lifecycle.mjs","names":[],"sources":["../../../../../../../packages/ai-groq/src/known-lifecycle.ts"],"sourcesContent":["import type { ModelLifecycle } from \"@warlock.js/ai\";\n\n/**\n * Where Groq's deprecations page and model catalog put the chat models the\n * adapter knows, as of {@link GROQ_MODEL_LIFECYCLE_AS_OF}. `retired` ids\n * are past their shutdown date; Groq applies several of these shutdowns to\n * free and developer-tier usage only, so a committed-spend enterprise\n * contract can still serve them.\n *\n * Sources: https://console.groq.com/docs/deprecations and\n * https://console.groq.com/docs/models. Preview models (`qwen/qwen3.8-27b`,\n * `openai/gpt-oss-safeguard-20b`) are listed as `current` while Groq\n * serves them, but Groq may discontinue previews at short notice.\n */\nexport const GROQ_MODEL_LIFECYCLE: Readonly<Record<string, ModelLifecycle>> = {\n \"openai/gpt-oss-120b\": { status: \"current\" },\n \"openai/gpt-oss-20b\": { status: \"current\" },\n \"openai/gpt-oss-safeguard-20b\": { status: \"current\" },\n \"qwen/qwen3.8-27b\": { status: \"current\" },\n \"llama-3.3-70b-versatile\": {\n status: \"retired\",\n retiresOn: \"2026-08-16\",\n replacement: \"openai/gpt-oss-120b\",\n },\n \"llama-3.1-8b-instant\": {\n status: \"retired\",\n retiresOn: \"2026-08-16\",\n replacement: \"openai/gpt-oss-20b\",\n },\n \"deepseek-r1-distill-llama-70b\": {\n status: \"retired\",\n retiresOn: \"2025-10-02\",\n replacement: \"openai/gpt-oss-120b\",\n },\n \"qwen/qwen3.6-27b\": {\n status: \"retired\",\n retiresOn: \"2026-09-14\",\n replacement: \"qwen/qwen3.8-27b\",\n },\n \"qwen/qwen3-32b\": {\n status: \"retired\",\n retiresOn: \"2026-07-17\",\n replacement: \"openai/gpt-oss-120b\",\n },\n \"meta-llama/llama-4-scout-17b-16e-instruct\": {\n status: \"retired\",\n retiresOn: \"2026-07-17\",\n replacement: \"openai/gpt-oss-120b\",\n },\n \"meta-llama/llama-4-maverick-17b-128e-instruct\": {\n status: \"retired\",\n retiresOn: \"2026-03-09\",\n replacement: \"openai/gpt-oss-120b\",\n },\n \"moonshotai/kimi-k2-instruct-0905\": {\n status: \"retired\",\n retiresOn: \"2026-04-15\",\n replacement: \"openai/gpt-oss-120b\",\n },\n \"moonshotai/kimi-k2-instruct\": {\n status: \"retired\",\n retiresOn: \"2025-10-10\",\n replacement: \"openai/gpt-oss-120b\",\n },\n \"groq/compound\": { status: \"retired\", retiresOn: \"2026-09-21\" },\n \"groq/compound-mini\": { status: \"retired\", retiresOn: \"2026-09-21\" },\n};\n\n/** The date {@link GROQ_MODEL_LIFECYCLE} was last checked against Groq's deprecations page. */\nexport const GROQ_MODEL_LIFECYCLE_AS_OF = \"2026-11-06\";\n\n/**\n * Look up the lifecycle of a Groq model id (exact match), or `undefined`\n * when the table does not cover it.\n *\n * @example\n * groqLifecycleFor(\"llama-3.3-70b-versatile\"); // { status: \"retired\", retiresOn: \"2026-08-16\", … }\n */\nexport function groqLifecycleFor(modelName: string): ModelLifecycle | undefined {\n return Object.hasOwn(GROQ_MODEL_LIFECYCLE, modelName)\n ? GROQ_MODEL_LIFECYCLE[modelName]\n : undefined;\n}\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAa,uBAAiE;CAC5E,uBAAuB,EAAE,QAAQ,UAAU;CAC3C,sBAAsB,EAAE,QAAQ,UAAU;CAC1C,gCAAgC,EAAE,QAAQ,UAAU;CACpD,oBAAoB,EAAE,QAAQ,UAAU;CACxC,2BAA2B;EACzB,QAAQ;EACR,WAAW;EACX,aAAa;CACf;CACA,wBAAwB;EACtB,QAAQ;EACR,WAAW;EACX,aAAa;CACf;CACA,iCAAiC;EAC/B,QAAQ;EACR,WAAW;EACX,aAAa;CACf;CACA,oBAAoB;EAClB,QAAQ;EACR,WAAW;EACX,aAAa;CACf;CACA,kBAAkB;EAChB,QAAQ;EACR,WAAW;EACX,aAAa;CACf;CACA,6CAA6C;EAC3C,QAAQ;EACR,WAAW;EACX,aAAa;CACf;CACA,iDAAiD;EAC/C,QAAQ;EACR,WAAW;EACX,aAAa;CACf;CACA,oCAAoC;EAClC,QAAQ;EACR,WAAW;EACX,aAAa;CACf;CACA,+BAA+B;EAC7B,QAAQ;EACR,WAAW;EACX,aAAa;CACf;CACA,iBAAiB;EAAE,QAAQ;EAAW,WAAW;CAAa;CAC9D,sBAAsB;EAAE,QAAQ;EAAW,WAAW;CAAa;AACrE;;AAGA,MAAa,6BAA6B;;;;;;;;AAS1C,SAAgB,iBAAiB,WAA+C;CAC9E,OAAO,OAAO,OAAO,sBAAsB,SAAS,IAChD,qBAAqB,aACrB;AACN"}
|
package/esm/known-models.d.mts
CHANGED
|
@@ -43,19 +43,17 @@ export declare function inferVisionCapability(modelId: string): boolean;
|
|
|
43
43
|
*/
|
|
44
44
|
export declare function inferReasoningCapability(modelId: string): boolean;
|
|
45
45
|
/**
|
|
46
|
-
* Curated list of current Groq
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
46
|
+
* Curated list of current Groq chat model ids, for autocomplete, docs, and
|
|
47
|
+
* default selection. NOT exhaustive and NOT a runtime allow-list —
|
|
48
|
+
* `groq.model({ name })` accepts any string, so a newly launched id works
|
|
49
|
+
* the moment Groq ships it without a package bump. Ids Groq has shut down
|
|
50
|
+
* are left out here and recorded as `retired` in
|
|
51
|
+
* {@link GROQ_MODEL_LIFECYCLE}.
|
|
52
52
|
*
|
|
53
|
-
* - `llama-3.3-70b-versatile` — flagship general-purpose text model.
|
|
54
|
-
* - `llama-3.1-8b-instant` — fastest/cheapest small text model.
|
|
55
53
|
* - `openai/gpt-oss-120b` / `openai/gpt-oss-20b` — OpenAI open-weight
|
|
56
54
|
* family; vision + reasoning capable.
|
|
57
|
-
* - `
|
|
55
|
+
* - `qwen/qwen3.8-27b` — Qwen 3.8 (a preview model on Groq).
|
|
58
56
|
*/
|
|
59
|
-
export declare const GROQ_KNOWN_MODELS: readonly ["
|
|
57
|
+
export declare const GROQ_KNOWN_MODELS: readonly ["openai/gpt-oss-120b", "openai/gpt-oss-20b", "qwen/qwen3.8-27b"];
|
|
60
58
|
//#endregion
|
|
61
59
|
//# sourceMappingURL=known-models.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"known-models.d.mts","names":[],"sources":["../../../../../../../packages/ai-groq/src/known-models.ts"],"mappings":";;;;;;;;;;qBASa;;;;;;;qBAQA;;;;;;;;;;;;;;wBAkEG,sBAAsB;;;;;;;;;;;;wBAiBtB,yBAAyB
|
|
1
|
+
{"version":3,"file":"known-models.d.mts","names":[],"sources":["../../../../../../../packages/ai-groq/src/known-models.ts"],"mappings":";;;;;;;;;;qBASa;;;;;;;qBAQA;;;;;;;;;;;;;;wBAkEG,sBAAsB;;;;;;;;;;;;wBAiBtB,yBAAyB;;;;;;;;;;;;;qBAkB5B"}
|
package/esm/known-models.mjs
CHANGED
|
@@ -98,25 +98,21 @@ function inferReasoningCapability(modelId) {
|
|
|
98
98
|
return REASONING_CAPABLE_SUBSTRINGS.some((fragment) => normalized.includes(fragment));
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
101
|
-
* Curated list of current Groq
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
101
|
+
* Curated list of current Groq chat model ids, for autocomplete, docs, and
|
|
102
|
+
* default selection. NOT exhaustive and NOT a runtime allow-list —
|
|
103
|
+
* `groq.model({ name })` accepts any string, so a newly launched id works
|
|
104
|
+
* the moment Groq ships it without a package bump. Ids Groq has shut down
|
|
105
|
+
* are left out here and recorded as `retired` in
|
|
106
|
+
* {@link GROQ_MODEL_LIFECYCLE}.
|
|
107
107
|
*
|
|
108
|
-
* - `llama-3.3-70b-versatile` — flagship general-purpose text model.
|
|
109
|
-
* - `llama-3.1-8b-instant` — fastest/cheapest small text model.
|
|
110
108
|
* - `openai/gpt-oss-120b` / `openai/gpt-oss-20b` — OpenAI open-weight
|
|
111
109
|
* family; vision + reasoning capable.
|
|
112
|
-
* - `
|
|
110
|
+
* - `qwen/qwen3.8-27b` — Qwen 3.8 (a preview model on Groq).
|
|
113
111
|
*/
|
|
114
112
|
const GROQ_KNOWN_MODELS = [
|
|
115
|
-
"llama-3.3-70b-versatile",
|
|
116
|
-
"llama-3.1-8b-instant",
|
|
117
113
|
"openai/gpt-oss-120b",
|
|
118
114
|
"openai/gpt-oss-20b",
|
|
119
|
-
"
|
|
115
|
+
"qwen/qwen3.8-27b"
|
|
120
116
|
];
|
|
121
117
|
|
|
122
118
|
//#endregion
|
package/esm/known-models.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"known-models.mjs","names":[],"sources":["../../../../../../../packages/ai-groq/src/known-models.ts"],"sourcesContent":["/**\n * Default base URL for Groq's OpenAI-compatible Chat Completions\n * endpoint. Groq exposes the same wire protocol as OpenAI under this\n * prefix, which is exactly why `GroqSDK` can delegate to the\n * battle-tested `OpenAISDK` instead of reimplementing the transport.\n *\n * Verified against Groq's \"OpenAI Compatibility\" docs (mid-2026).\n * Override via `new GroqSDK({ baseURL })` if Groq ever relocates it.\n */\nexport const GROQ_BASE_URL = \"https://api.groq.com/openai/v1\";\n\n/**\n * The provider label every model produced by `GroqSDK` self-identifies\n * with. Flows through to `ModelContract.provider`, `AgentReport.model`,\n * logs, and any provider-aware middleware. Kept as a constant so the\n * wrapper and the inner `OpenAISDK` agree on one spelling.\n */\nexport const GROQ_PROVIDER = \"groq\";\n\n/**\n * Substrings identifying Groq-hosted model ids whose family accepts\n * image input (vision).\n *\n * Groq hosts *open* models on its LPU hardware, so the ids are the\n * upstream open-weight names rather than OpenAI's — which is why the\n * OpenAI adapter's `gpt-4o*` prefix inference would never fire here and\n * this provider must carry its OWN list. Verified against Groq's\n * supported-models catalog (mid-2026):\n *\n * - `openai/gpt-oss-*` — natively multimodal OpenAI open-weight family\n * (the current production vision + reasoning models on Groq).\n * - `llama-4` / `llama-3.2-*-vision` — Meta's multimodal Llama families.\n * Kept as substrings so any still-hosted or re-introduced variant is\n * covered even though some `llama-4` ids were deprecated in 2026.\n *\n * Matched as a substring (not a prefix) because Groq prefixes several\n * ids with an org segment (`openai/`, `meta-llama/`) and appends size /\n * date suffixes. Override per-model via\n * `groq.model({ name, vision: true | false })`.\n */\nconst VISION_CAPABLE_SUBSTRINGS = [\n \"gpt-oss\",\n \"llama-4\",\n \"llama-3.2-11b-vision\",\n \"llama-3.2-90b-vision\",\n \"vision\",\n];\n\n/**\n * Substrings identifying Groq-hosted model ids that expose an internal\n * reasoning / thinking channel and accept the `reasoning_effort`\n * request parameter on the OpenAI-compatible Chat Completions endpoint.\n *\n * Verified against Groq's catalog (mid-2026):\n * - `gpt-oss` — the OpenAI open-weight family reasons by default.\n * - `deepseek-r1-distill` — DeepSeek-R1-style reasoning at Groq speed.\n * - `qwq` / `qwen3` — Qwen reasoning families (when hosted).\n *\n * Matched as a substring for the same org-prefix / suffix reason as the\n * vision list. Override per-model via\n * `groq.model({ name, reasoning: true | false })`.\n */\nconst REASONING_CAPABLE_SUBSTRINGS = [\n \"gpt-oss\",\n \"deepseek-r1\",\n \"deepseek-r1-distill\",\n \"qwq\",\n \"qwen3\",\n];\n\n/**\n * Infer whether a Groq-hosted model id supports vision based on the\n * known multimodal-family substrings. Unknown ids default to `false`\n * so passing an image attachment to a text-only model (e.g.\n * `llama-3.3-70b-versatile`) surfaces a clear, agent-side capability\n * error instead of an opaque upstream 400.\n *\n * @example\n * inferVisionCapability(\"openai/gpt-oss-120b\"); // → true\n * inferVisionCapability(\"meta-llama/llama-4-scout\"); // → true\n * inferVisionCapability(\"llama-3.3-70b-versatile\"); // → false\n * inferVisionCapability(\"llama-3.1-8b-instant\"); // → false\n */\nexport function inferVisionCapability(modelId: string): boolean {\n const normalized = modelId.toLowerCase();\n\n return VISION_CAPABLE_SUBSTRINGS.some((fragment) => normalized.includes(fragment));\n}\n\n/**\n * Infer whether a Groq-hosted model id is a reasoning model based on\n * the known reasoning-family substrings. Unknown ids default to `false`\n * so the adapter never forwards an unsupported `reasoning_effort` param\n * to a non-reasoning model (which would 400).\n *\n * @example\n * inferReasoningCapability(\"openai/gpt-oss-20b\"); // → true\n * inferReasoningCapability(\"deepseek-r1-distill-llama-70b\"); // → true\n * inferReasoningCapability(\"llama-3.3-70b-versatile\"); // → false\n */\nexport function inferReasoningCapability(modelId: string): boolean {\n const normalized = modelId.toLowerCase();\n\n return REASONING_CAPABLE_SUBSTRINGS.some((fragment) => normalized.includes(fragment));\n}\n\n/**\n * Curated list of current Groq
|
|
1
|
+
{"version":3,"file":"known-models.mjs","names":[],"sources":["../../../../../../../packages/ai-groq/src/known-models.ts"],"sourcesContent":["/**\n * Default base URL for Groq's OpenAI-compatible Chat Completions\n * endpoint. Groq exposes the same wire protocol as OpenAI under this\n * prefix, which is exactly why `GroqSDK` can delegate to the\n * battle-tested `OpenAISDK` instead of reimplementing the transport.\n *\n * Verified against Groq's \"OpenAI Compatibility\" docs (mid-2026).\n * Override via `new GroqSDK({ baseURL })` if Groq ever relocates it.\n */\nexport const GROQ_BASE_URL = \"https://api.groq.com/openai/v1\";\n\n/**\n * The provider label every model produced by `GroqSDK` self-identifies\n * with. Flows through to `ModelContract.provider`, `AgentReport.model`,\n * logs, and any provider-aware middleware. Kept as a constant so the\n * wrapper and the inner `OpenAISDK` agree on one spelling.\n */\nexport const GROQ_PROVIDER = \"groq\";\n\n/**\n * Substrings identifying Groq-hosted model ids whose family accepts\n * image input (vision).\n *\n * Groq hosts *open* models on its LPU hardware, so the ids are the\n * upstream open-weight names rather than OpenAI's — which is why the\n * OpenAI adapter's `gpt-4o*` prefix inference would never fire here and\n * this provider must carry its OWN list. Verified against Groq's\n * supported-models catalog (mid-2026):\n *\n * - `openai/gpt-oss-*` — natively multimodal OpenAI open-weight family\n * (the current production vision + reasoning models on Groq).\n * - `llama-4` / `llama-3.2-*-vision` — Meta's multimodal Llama families.\n * Kept as substrings so any still-hosted or re-introduced variant is\n * covered even though some `llama-4` ids were deprecated in 2026.\n *\n * Matched as a substring (not a prefix) because Groq prefixes several\n * ids with an org segment (`openai/`, `meta-llama/`) and appends size /\n * date suffixes. Override per-model via\n * `groq.model({ name, vision: true | false })`.\n */\nconst VISION_CAPABLE_SUBSTRINGS = [\n \"gpt-oss\",\n \"llama-4\",\n \"llama-3.2-11b-vision\",\n \"llama-3.2-90b-vision\",\n \"vision\",\n];\n\n/**\n * Substrings identifying Groq-hosted model ids that expose an internal\n * reasoning / thinking channel and accept the `reasoning_effort`\n * request parameter on the OpenAI-compatible Chat Completions endpoint.\n *\n * Verified against Groq's catalog (mid-2026):\n * - `gpt-oss` — the OpenAI open-weight family reasons by default.\n * - `deepseek-r1-distill` — DeepSeek-R1-style reasoning at Groq speed.\n * - `qwq` / `qwen3` — Qwen reasoning families (when hosted).\n *\n * Matched as a substring for the same org-prefix / suffix reason as the\n * vision list. Override per-model via\n * `groq.model({ name, reasoning: true | false })`.\n */\nconst REASONING_CAPABLE_SUBSTRINGS = [\n \"gpt-oss\",\n \"deepseek-r1\",\n \"deepseek-r1-distill\",\n \"qwq\",\n \"qwen3\",\n];\n\n/**\n * Infer whether a Groq-hosted model id supports vision based on the\n * known multimodal-family substrings. Unknown ids default to `false`\n * so passing an image attachment to a text-only model (e.g.\n * `llama-3.3-70b-versatile`) surfaces a clear, agent-side capability\n * error instead of an opaque upstream 400.\n *\n * @example\n * inferVisionCapability(\"openai/gpt-oss-120b\"); // → true\n * inferVisionCapability(\"meta-llama/llama-4-scout\"); // → true\n * inferVisionCapability(\"llama-3.3-70b-versatile\"); // → false\n * inferVisionCapability(\"llama-3.1-8b-instant\"); // → false\n */\nexport function inferVisionCapability(modelId: string): boolean {\n const normalized = modelId.toLowerCase();\n\n return VISION_CAPABLE_SUBSTRINGS.some((fragment) => normalized.includes(fragment));\n}\n\n/**\n * Infer whether a Groq-hosted model id is a reasoning model based on\n * the known reasoning-family substrings. Unknown ids default to `false`\n * so the adapter never forwards an unsupported `reasoning_effort` param\n * to a non-reasoning model (which would 400).\n *\n * @example\n * inferReasoningCapability(\"openai/gpt-oss-20b\"); // → true\n * inferReasoningCapability(\"deepseek-r1-distill-llama-70b\"); // → true\n * inferReasoningCapability(\"llama-3.3-70b-versatile\"); // → false\n */\nexport function inferReasoningCapability(modelId: string): boolean {\n const normalized = modelId.toLowerCase();\n\n return REASONING_CAPABLE_SUBSTRINGS.some((fragment) => normalized.includes(fragment));\n}\n\n/**\n * Curated list of current Groq chat model ids, for autocomplete, docs, and\n * default selection. NOT exhaustive and NOT a runtime allow-list —\n * `groq.model({ name })` accepts any string, so a newly launched id works\n * the moment Groq ships it without a package bump. Ids Groq has shut down\n * are left out here and recorded as `retired` in\n * {@link GROQ_MODEL_LIFECYCLE}.\n *\n * - `openai/gpt-oss-120b` / `openai/gpt-oss-20b` — OpenAI open-weight\n * family; vision + reasoning capable.\n * - `qwen/qwen3.8-27b` — Qwen 3.8 (a preview model on Groq).\n */\nexport const GROQ_KNOWN_MODELS = [\n \"openai/gpt-oss-120b\",\n \"openai/gpt-oss-20b\",\n \"qwen/qwen3.8-27b\",\n] as const;\n"],"mappings":";;;;;;;;;;AASA,MAAa,gBAAgB;;;;;;;AAQ7B,MAAa,gBAAgB;;;;;;;;;;;;;;;;;;;;;;AAuB7B,MAAM,4BAA4B;CAChC;CACA;CACA;CACA;CACA;AACF;;;;;;;;;;;;;;;AAgBA,MAAM,+BAA+B;CACnC;CACA;CACA;CACA;CACA;AACF;;;;;;;;;;;;;;AAeA,SAAgB,sBAAsB,SAA0B;CAC9D,MAAM,aAAa,QAAQ,YAAY;CAEvC,OAAO,0BAA0B,MAAM,aAAa,WAAW,SAAS,QAAQ,CAAC;AACnF;;;;;;;;;;;;AAaA,SAAgB,yBAAyB,SAA0B;CACjE,MAAM,aAAa,QAAQ,YAAY;CAEvC,OAAO,6BAA6B,MAAM,aAAa,WAAW,SAAS,QAAQ,CAAC;AACtF;;;;;;;;;;;;;AAcA,MAAa,oBAAoB;CAC/B;CACA;CACA;AACF"}
|
package/esm/sdk.d.mts
CHANGED
|
@@ -105,13 +105,15 @@ export declare class GroqSDK implements SDKAdapterContract {
|
|
|
105
105
|
*/
|
|
106
106
|
models(options?: ListModelsOptions): Promise<ModelInfo[]>;
|
|
107
107
|
}
|
|
108
|
+
/** The date the {@link GROQ_DEFAULT_PRICING} token rates were last checked against Groq's model page. */
|
|
109
|
+
export declare const GROQ_DEFAULT_PRICING_AS_OF = "2026-11-06";
|
|
108
110
|
/**
|
|
109
111
|
* Default per-million-token USD rates for Groq models.
|
|
110
112
|
*
|
|
111
113
|
* Source: https://console.groq.com/docs/models (groq.com/pricing now
|
|
112
|
-
* redirects to the home page),
|
|
114
|
+
* redirects to the home page), as of {@link GROQ_DEFAULT_PRICING_AS_OF}. Cached input is 50%
|
|
113
115
|
* of the input rate for the gpt-oss models, the only ones Groq caches
|
|
114
|
-
* (https://console.groq.com/docs/prompt-caching; no write charge). The
|
|
116
|
+
* (https://console.groq.com/docs/prompt-caching, checked 2026-10-17; no write charge). The
|
|
115
117
|
* Llama models are listed as "Enterprise – Contact Sales" with no public
|
|
116
118
|
* price, so they stay unpriced — pass `pricing` for them.
|
|
117
119
|
*/
|
package/esm/sdk.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.mts","names":[],"sources":["../../../../../../../packages/ai-groq/src/sdk.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA+Da,mBAAmB;;;;;;;mBAOb;mBACA;mBACA;EAEjB,YAAmB,QAAQ;;;;;;;;;;;;;;;;;;EAqCpB,MAAM,QAAQ,kBAAkB;;;;;;;EAyB1B,MAAM,cAAc,iBAAiB;;;;;;;;;;;EAc3C,SAAS,QAAQ,qBAAqB;;;;;;;;;;;EAmBhC,OAAO,UAAU,oBAAoB,QAAQ
|
|
1
|
+
{"version":3,"file":"sdk.d.mts","names":[],"sources":["../../../../../../../packages/ai-groq/src/sdk.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA+Da,mBAAmB;;;;;;;mBAOb;mBACA;mBACA;EAEjB,YAAmB,QAAQ;;;;;;;;;;;;;;;;;;EAqCpB,MAAM,QAAQ,kBAAkB;;;;;;;EAyB1B,MAAM,cAAc,iBAAiB;;;;;;;;;;;EAc3C,SAAS,QAAQ,qBAAqB;;;;;;;;;;;EAmBhC,OAAO,UAAU,oBAAoB,QAAQ;;;qBAiB/C;;;;;;;;;;;qBAYA,sBAAsB,SAAS,eAAe"}
|
package/esm/sdk.mjs
CHANGED
|
@@ -135,13 +135,15 @@ var GroqSDK = class {
|
|
|
135
135
|
function defaultPricingFor(name) {
|
|
136
136
|
return GROQ_DEFAULT_PRICING[name];
|
|
137
137
|
}
|
|
138
|
+
/** The date the {@link GROQ_DEFAULT_PRICING} token rates were last checked against Groq's model page. */
|
|
139
|
+
const GROQ_DEFAULT_PRICING_AS_OF = "2026-11-06";
|
|
138
140
|
/**
|
|
139
141
|
* Default per-million-token USD rates for Groq models.
|
|
140
142
|
*
|
|
141
143
|
* Source: https://console.groq.com/docs/models (groq.com/pricing now
|
|
142
|
-
* redirects to the home page),
|
|
144
|
+
* redirects to the home page), as of {@link GROQ_DEFAULT_PRICING_AS_OF}. Cached input is 50%
|
|
143
145
|
* of the input rate for the gpt-oss models, the only ones Groq caches
|
|
144
|
-
* (https://console.groq.com/docs/prompt-caching; no write charge). The
|
|
146
|
+
* (https://console.groq.com/docs/prompt-caching, checked 2026-10-17; no write charge). The
|
|
145
147
|
* Llama models are listed as "Enterprise – Contact Sales" with no public
|
|
146
148
|
* price, so they stay unpriced — pass `pricing` for them.
|
|
147
149
|
*/
|
|
@@ -168,5 +170,5 @@ const GROQ_DEFAULT_PRICING = {
|
|
|
168
170
|
};
|
|
169
171
|
|
|
170
172
|
//#endregion
|
|
171
|
-
export { GROQ_DEFAULT_PRICING, GroqSDK };
|
|
173
|
+
export { GROQ_DEFAULT_PRICING, GROQ_DEFAULT_PRICING_AS_OF, GroqSDK };
|
|
172
174
|
//# sourceMappingURL=sdk.mjs.map
|
package/esm/sdk.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.mjs","names":[],"sources":["../../../../../../../packages/ai-groq/src/sdk.ts"],"sourcesContent":["import type {\n ListModelsOptions,\n ModelInfo,\n EmbedderContract,\n ModelContract,\n ModelPricing,\n SDKAdapterContract,\n} from \"@warlock.js/ai\";\nimport { OpenAISDK } from \"@warlock.js/ai-openai\";\nimport type { GroqEmbedderConfig, GroqModelConfig, GroqSDKConfig } from \"./config.type\";\nimport { inferContextWindow } from \"./known-context-windows\";\nimport {\n GROQ_BASE_URL,\n GROQ_PROVIDER,\n inferReasoningCapability,\n inferVisionCapability,\n} from \"./known-models\";\n\n/**\n * Groq-backed implementation of `SDKAdapterContract`.\n *\n * **Role.** The package entry point for Groq-hosted open models\n * (`llama-3.3-70b-versatile`, `llama-3.1-8b-instant`,\n * `openai/gpt-oss-*`, `deepseek-r1-distill-*`, …) served on Groq's fast\n * LPU hardware. Because Groq exposes the OpenAI Chat Completions wire\n * protocol verbatim, `GroqSDK` is a **thin wrapper over the already\n * battle-tested {@link OpenAISDK}** rather than a fresh transport\n * implementation — it owns one internal `OpenAISDK` pointed at Groq's\n * `baseURL` with the `\"groq\"` provider label, and delegates `model()` /\n * `embedder()` / `count()` to it.\n *\n * **Why a wrapper and not `OpenAISDK` directly?** Groq hosts *open*\n * models whose ids are the upstream open-weight names (`llama-…`,\n * `openai/gpt-oss-…`), not OpenAI's (`gpt-4o`, `o3`). The OpenAI\n * adapter's capability inference keys on OpenAI prefixes and would never\n * fire here, so every Groq model would come back with `vision`/\n * `reasoning` silently `false`. `GroqSDK` fixes that by computing\n * **this provider's own** vision/reasoning inference (see\n * `known-models.ts`) and injecting the result as explicit capability\n * config — which wins over the inner adapter's inference — plus a set of\n * default per-model pricing rates. Everything else (transport, retries,\n * streaming, structured output, error wrapping, usage accounting) is\n * inherited unchanged from `OpenAISDK`.\n *\n * **Responsibility.**\n * - Owns: one long-lived internal `OpenAISDK` (auth + Groq base URL) and\n * this provider's capability + default-pricing inference.\n * - Does NOT own: the wire protocol, streaming loop, structured-output\n * mapping, or error wrapping — all inherited from `OpenAISDK`.\n *\n * Modeled as a class (see §4.2 of code-style.md — \"long-lived state\n * across many calls\"), fronted by FP usage like the other adapters.\n *\n * @example\n * const groq = new GroqSDK({ apiKey: process.env.GROQ_API_KEY! });\n * const model = groq.model({ name: \"llama-3.3-70b-versatile\", temperature: 0.7 });\n * const reasoner = groq.model({ name: \"openai/gpt-oss-120b\" }); // vision + reasoning auto-true\n *\n * @example\n * // Compose into an `ai.groq` namespace for ergonomic agent wiring\n * const ai = { agent, tool, systemPrompt, groq: new GroqSDK({ apiKey }) };\n * const myAgent = ai.agent({ model: ai.groq.model({ name: \"llama-3.1-8b-instant\" }) });\n */\nexport class GroqSDK implements SDKAdapterContract {\n /**\n * The wrapped OpenAI-compatible adapter, pre-pointed at Groq's\n * `baseURL` and labeled with the `\"groq\"` provider. All real wire work\n * happens here; `GroqSDK` only enriches the per-model config before\n * delegating.\n */\n private readonly openai: OpenAISDK;\n private readonly provider: string;\n private readonly pricing?: Record<string, ModelPricing>;\n\n public constructor(config: GroqSDKConfig) {\n const { baseURL, provider, pricing, ...clientOptions } = config;\n\n this.provider = provider ?? GROQ_PROVIDER;\n this.pricing = pricing;\n\n // Build the inner OpenAI-compatible client pointed at Groq. Forward\n // every other upstream ClientOptions (timeout, maxRetries,\n // defaultHeaders, fetch, …) verbatim — they type-check, so dropping\n // them would be a silent footgun. We pass `pricing` through too so\n // the inner registry stays a fallback, while THIS class's `model()`\n // layers Groq default rates on top.\n this.openai = new OpenAISDK({\n ...clientOptions,\n baseURL: baseURL ?? GROQ_BASE_URL,\n provider: this.provider,\n pricing,\n });\n }\n\n /**\n * Build a `ModelContract` bound to the internal Groq-pointed client.\n *\n * The wrapper's whole job lives here: it computes **Groq's** vision /\n * reasoning inference from the model id and forwards the result as\n * *explicit* `vision` / `reasoning` config to the inner\n * `OpenAISDK.model()`. Because explicit capability config wins over the\n * inner adapter's OpenAI-prefix inference, the returned model reports\n * the right capabilities even though the id isn't an OpenAI name. A\n * caller-supplied `vision` / `reasoning` still wins over this\n * inference (we only fill the gap when the field is omitted).\n *\n * Pricing resolution: per-model `config.pricing` wins; otherwise this\n * SDK's `pricing` registry keyed by `config.name`; otherwise the\n * adapter's built-in default rate for the model; otherwise `undefined`\n * (no cost computed).\n */\n public model(config: GroqModelConfig): ModelContract {\n const resolvedPricing =\n config.pricing ?? this.pricing?.[config.name] ?? defaultPricingFor(config.name);\n\n const window = config.contextWindow ?? inferContextWindow(config.name);\n\n return this.openai.model({\n ...config,\n ...(window !== undefined ? { contextWindow: window } : {}),\n // Fill capability inference only when the caller didn't pin it —\n // explicit caller config always wins, then Groq inference, then\n // (inside OpenAISDK) the harmless OpenAI inference that won't match.\n vision: config.vision ?? inferVisionCapability(config.name),\n reasoning: config.reasoning ?? inferReasoningCapability(config.name),\n structuredOutput: config.structuredOutput ?? true,\n pricing: resolvedPricing,\n });\n }\n\n /**\n * Rough offline token-count estimate. Delegated straight to the inner\n * `OpenAISDK`, which uses the core character-heuristic\n * (`approximateTokenCount`). Good for budgeting / quota guards, not for\n * billing.\n */\n public async count(text: string, model?: string): Promise<number> {\n return this.openai.count(text, model);\n }\n\n /**\n * Build an embedder bound to the internal client. Delegated to the\n * inner `OpenAISDK`.\n *\n * IMPORTANT: as of mid-2026 Groq does **not** expose an\n * OpenAI-compatible embeddings endpoint, so a live `.embed()` /\n * `.embedMany()` call will fail at the provider. The method is kept for\n * adapter symmetry; use `@warlock.js/ai-openai` or\n * `@warlock.js/ai-google` for retrieval embeddings.\n */\n public embedder(config: GroqEmbedderConfig): EmbedderContract {\n return this.openai.embedder(config);\n }\n\n // NOTE: `image()` is intentionally NOT implemented. Groq hosts no\n // image-generation API, and `SDKAdapterContract.image` is optional —\n // its structural absence IS the capability guard, so\n // `ai.groq.image(...)` is a compile-time error rather than a runtime\n // surprise (mirrors Anthropic / Bedrock / Ollama).\n /**\n * List the models this Groq account can use, live from the provider's\n * OpenAI-compatible `GET /models`, mapped to the common `ModelInfo`\n * shape. Groq models marked inactive are left out; `contextWindow` comes from `context_window`. Failures are thrown as the adapter's usual provider\n * errors, never an empty list.\n *\n * @example\n * const models = await groq.models();\n * models.map((model) => model.id);\n */\n public async models(options?: ListModelsOptions): Promise<ModelInfo[]> {\n return this.openai.models(options);\n }\n}\n\n/**\n * Built-in default USD-per-1,000,000-token rates for the Groq models with\n * a published price, used as the last fallback in `model()`'s pricing\n * resolution. A per-model or SDK-level `pricing` entry always wins over\n * these. Returns `undefined` for any unlisted id so cost stays an honest\n * absence rather than a false zero.\n */\nfunction defaultPricingFor(name: string): ModelPricing | undefined {\n return GROQ_DEFAULT_PRICING[name];\n}\n\n/**\n * Default per-million-token USD rates for Groq models.\n *\n * Source: https://console.groq.com/docs/models (groq.com/pricing now\n * redirects to the home page), fetched 2026-10-17. Cached input is 50%\n * of the input rate for the gpt-oss models, the only ones Groq caches\n * (https://console.groq.com/docs/prompt-caching; no write charge). The\n * Llama models are listed as \"Enterprise – Contact Sales\" with no public\n * price, so they stay unpriced — pass `pricing` for them.\n */\nexport const GROQ_DEFAULT_PRICING: Readonly<Record<string, ModelPricing>> = {\n \"openai/gpt-oss-120b\": { input: 0.15, output: 0.6, cachedInput: 0.075 },\n \"openai/gpt-oss-20b\": { input: 0.075, output: 0.3, cachedInput: 0.0375 },\n \"openai/gpt-oss-safeguard-20b\": { input: 0.075, output: 0.3, cachedInput: 0.0375 },\n \"qwen/qwen3.8-27b\": { input: 0.8, output: 4 },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DA,IAAa,UAAb,MAAmD;CAWjD,AAAO,YAAY,QAAuB;EACxC,MAAM,EAAE,SAAS,UAAU,SAAS,GAAG,kBAAkB;EAEzD,KAAK,WAAW;EAChB,KAAK,UAAU;EAQf,KAAK,SAAS,IAAI,UAAU;GAC1B,GAAG;GACH,SAAS;GACT,UAAU,KAAK;GACf;EACF,CAAC;CACH;;;;;;;;;;;;;;;;;;CAmBA,AAAO,MAAM,QAAwC;EACnD,MAAM,kBACJ,OAAO,WAAW,KAAK,UAAU,OAAO,SAAS,kBAAkB,OAAO,IAAI;EAEhF,MAAM,SAAS,OAAO,iBAAiB,mBAAmB,OAAO,IAAI;EAErE,OAAO,KAAK,OAAO,MAAM;GACvB,GAAG;GACH,GAAI,WAAW,SAAY,EAAE,eAAe,OAAO,IAAI,CAAC;GAIxD,QAAQ,OAAO,UAAU,sBAAsB,OAAO,IAAI;GAC1D,WAAW,OAAO,aAAa,yBAAyB,OAAO,IAAI;GACnE,kBAAkB,OAAO,oBAAoB;GAC7C,SAAS;EACX,CAAC;CACH;;;;;;;CAQA,MAAa,MAAM,MAAc,OAAiC;EAChE,OAAO,KAAK,OAAO,MAAM,MAAM,KAAK;CACtC;;;;;;;;;;;CAYA,AAAO,SAAS,QAA8C;EAC5D,OAAO,KAAK,OAAO,SAAS,MAAM;CACpC;;;;;;;;;;;CAiBA,MAAa,OAAO,SAAmD;EACrE,OAAO,KAAK,OAAO,OAAO,OAAO;CACnC;AACF;;;;;;;;AASA,SAAS,kBAAkB,MAAwC;CACjE,OAAO,qBAAqB;AAC9B;;;;;;;;;;;AAYA,MAAa,uBAA+D;CAC1E,uBAAuB;EAAE,OAAO;EAAM,QAAQ;EAAK,aAAa;CAAM;CACtE,sBAAsB;EAAE,OAAO;EAAO,QAAQ;EAAK,aAAa;CAAO;CACvE,gCAAgC;EAAE,OAAO;EAAO,QAAQ;EAAK,aAAa;CAAO;CACjF,oBAAoB;EAAE,OAAO;EAAK,QAAQ;CAAE;AAC9C"}
|
|
1
|
+
{"version":3,"file":"sdk.mjs","names":[],"sources":["../../../../../../../packages/ai-groq/src/sdk.ts"],"sourcesContent":["import type {\n ListModelsOptions,\n ModelInfo,\n EmbedderContract,\n ModelContract,\n ModelPricing,\n SDKAdapterContract,\n} from \"@warlock.js/ai\";\nimport { OpenAISDK } from \"@warlock.js/ai-openai\";\nimport type { GroqEmbedderConfig, GroqModelConfig, GroqSDKConfig } from \"./config.type\";\nimport { inferContextWindow } from \"./known-context-windows\";\nimport {\n GROQ_BASE_URL,\n GROQ_PROVIDER,\n inferReasoningCapability,\n inferVisionCapability,\n} from \"./known-models\";\n\n/**\n * Groq-backed implementation of `SDKAdapterContract`.\n *\n * **Role.** The package entry point for Groq-hosted open models\n * (`llama-3.3-70b-versatile`, `llama-3.1-8b-instant`,\n * `openai/gpt-oss-*`, `deepseek-r1-distill-*`, …) served on Groq's fast\n * LPU hardware. Because Groq exposes the OpenAI Chat Completions wire\n * protocol verbatim, `GroqSDK` is a **thin wrapper over the already\n * battle-tested {@link OpenAISDK}** rather than a fresh transport\n * implementation — it owns one internal `OpenAISDK` pointed at Groq's\n * `baseURL` with the `\"groq\"` provider label, and delegates `model()` /\n * `embedder()` / `count()` to it.\n *\n * **Why a wrapper and not `OpenAISDK` directly?** Groq hosts *open*\n * models whose ids are the upstream open-weight names (`llama-…`,\n * `openai/gpt-oss-…`), not OpenAI's (`gpt-4o`, `o3`). The OpenAI\n * adapter's capability inference keys on OpenAI prefixes and would never\n * fire here, so every Groq model would come back with `vision`/\n * `reasoning` silently `false`. `GroqSDK` fixes that by computing\n * **this provider's own** vision/reasoning inference (see\n * `known-models.ts`) and injecting the result as explicit capability\n * config — which wins over the inner adapter's inference — plus a set of\n * default per-model pricing rates. Everything else (transport, retries,\n * streaming, structured output, error wrapping, usage accounting) is\n * inherited unchanged from `OpenAISDK`.\n *\n * **Responsibility.**\n * - Owns: one long-lived internal `OpenAISDK` (auth + Groq base URL) and\n * this provider's capability + default-pricing inference.\n * - Does NOT own: the wire protocol, streaming loop, structured-output\n * mapping, or error wrapping — all inherited from `OpenAISDK`.\n *\n * Modeled as a class (see §4.2 of code-style.md — \"long-lived state\n * across many calls\"), fronted by FP usage like the other adapters.\n *\n * @example\n * const groq = new GroqSDK({ apiKey: process.env.GROQ_API_KEY! });\n * const model = groq.model({ name: \"llama-3.3-70b-versatile\", temperature: 0.7 });\n * const reasoner = groq.model({ name: \"openai/gpt-oss-120b\" }); // vision + reasoning auto-true\n *\n * @example\n * // Compose into an `ai.groq` namespace for ergonomic agent wiring\n * const ai = { agent, tool, systemPrompt, groq: new GroqSDK({ apiKey }) };\n * const myAgent = ai.agent({ model: ai.groq.model({ name: \"llama-3.1-8b-instant\" }) });\n */\nexport class GroqSDK implements SDKAdapterContract {\n /**\n * The wrapped OpenAI-compatible adapter, pre-pointed at Groq's\n * `baseURL` and labeled with the `\"groq\"` provider. All real wire work\n * happens here; `GroqSDK` only enriches the per-model config before\n * delegating.\n */\n private readonly openai: OpenAISDK;\n private readonly provider: string;\n private readonly pricing?: Record<string, ModelPricing>;\n\n public constructor(config: GroqSDKConfig) {\n const { baseURL, provider, pricing, ...clientOptions } = config;\n\n this.provider = provider ?? GROQ_PROVIDER;\n this.pricing = pricing;\n\n // Build the inner OpenAI-compatible client pointed at Groq. Forward\n // every other upstream ClientOptions (timeout, maxRetries,\n // defaultHeaders, fetch, …) verbatim — they type-check, so dropping\n // them would be a silent footgun. We pass `pricing` through too so\n // the inner registry stays a fallback, while THIS class's `model()`\n // layers Groq default rates on top.\n this.openai = new OpenAISDK({\n ...clientOptions,\n baseURL: baseURL ?? GROQ_BASE_URL,\n provider: this.provider,\n pricing,\n });\n }\n\n /**\n * Build a `ModelContract` bound to the internal Groq-pointed client.\n *\n * The wrapper's whole job lives here: it computes **Groq's** vision /\n * reasoning inference from the model id and forwards the result as\n * *explicit* `vision` / `reasoning` config to the inner\n * `OpenAISDK.model()`. Because explicit capability config wins over the\n * inner adapter's OpenAI-prefix inference, the returned model reports\n * the right capabilities even though the id isn't an OpenAI name. A\n * caller-supplied `vision` / `reasoning` still wins over this\n * inference (we only fill the gap when the field is omitted).\n *\n * Pricing resolution: per-model `config.pricing` wins; otherwise this\n * SDK's `pricing` registry keyed by `config.name`; otherwise the\n * adapter's built-in default rate for the model; otherwise `undefined`\n * (no cost computed).\n */\n public model(config: GroqModelConfig): ModelContract {\n const resolvedPricing =\n config.pricing ?? this.pricing?.[config.name] ?? defaultPricingFor(config.name);\n\n const window = config.contextWindow ?? inferContextWindow(config.name);\n\n return this.openai.model({\n ...config,\n ...(window !== undefined ? { contextWindow: window } : {}),\n // Fill capability inference only when the caller didn't pin it —\n // explicit caller config always wins, then Groq inference, then\n // (inside OpenAISDK) the harmless OpenAI inference that won't match.\n vision: config.vision ?? inferVisionCapability(config.name),\n reasoning: config.reasoning ?? inferReasoningCapability(config.name),\n structuredOutput: config.structuredOutput ?? true,\n pricing: resolvedPricing,\n });\n }\n\n /**\n * Rough offline token-count estimate. Delegated straight to the inner\n * `OpenAISDK`, which uses the core character-heuristic\n * (`approximateTokenCount`). Good for budgeting / quota guards, not for\n * billing.\n */\n public async count(text: string, model?: string): Promise<number> {\n return this.openai.count(text, model);\n }\n\n /**\n * Build an embedder bound to the internal client. Delegated to the\n * inner `OpenAISDK`.\n *\n * IMPORTANT: as of mid-2026 Groq does **not** expose an\n * OpenAI-compatible embeddings endpoint, so a live `.embed()` /\n * `.embedMany()` call will fail at the provider. The method is kept for\n * adapter symmetry; use `@warlock.js/ai-openai` or\n * `@warlock.js/ai-google` for retrieval embeddings.\n */\n public embedder(config: GroqEmbedderConfig): EmbedderContract {\n return this.openai.embedder(config);\n }\n\n // NOTE: `image()` is intentionally NOT implemented. Groq hosts no\n // image-generation API, and `SDKAdapterContract.image` is optional —\n // its structural absence IS the capability guard, so\n // `ai.groq.image(...)` is a compile-time error rather than a runtime\n // surprise (mirrors Anthropic / Bedrock / Ollama).\n /**\n * List the models this Groq account can use, live from the provider's\n * OpenAI-compatible `GET /models`, mapped to the common `ModelInfo`\n * shape. Groq models marked inactive are left out; `contextWindow` comes from `context_window`. Failures are thrown as the adapter's usual provider\n * errors, never an empty list.\n *\n * @example\n * const models = await groq.models();\n * models.map((model) => model.id);\n */\n public async models(options?: ListModelsOptions): Promise<ModelInfo[]> {\n return this.openai.models(options);\n }\n}\n\n/**\n * Built-in default USD-per-1,000,000-token rates for the Groq models with\n * a published price, used as the last fallback in `model()`'s pricing\n * resolution. A per-model or SDK-level `pricing` entry always wins over\n * these. Returns `undefined` for any unlisted id so cost stays an honest\n * absence rather than a false zero.\n */\nfunction defaultPricingFor(name: string): ModelPricing | undefined {\n return GROQ_DEFAULT_PRICING[name];\n}\n\n/** The date the {@link GROQ_DEFAULT_PRICING} token rates were last checked against Groq's model page. */\nexport const GROQ_DEFAULT_PRICING_AS_OF = \"2026-11-06\";\n\n/**\n * Default per-million-token USD rates for Groq models.\n *\n * Source: https://console.groq.com/docs/models (groq.com/pricing now\n * redirects to the home page), as of {@link GROQ_DEFAULT_PRICING_AS_OF}. Cached input is 50%\n * of the input rate for the gpt-oss models, the only ones Groq caches\n * (https://console.groq.com/docs/prompt-caching, checked 2026-10-17; no write charge). The\n * Llama models are listed as \"Enterprise – Contact Sales\" with no public\n * price, so they stay unpriced — pass `pricing` for them.\n */\nexport const GROQ_DEFAULT_PRICING: Readonly<Record<string, ModelPricing>> = {\n \"openai/gpt-oss-120b\": { input: 0.15, output: 0.6, cachedInput: 0.075 },\n \"openai/gpt-oss-20b\": { input: 0.075, output: 0.3, cachedInput: 0.0375 },\n \"openai/gpt-oss-safeguard-20b\": { input: 0.075, output: 0.3, cachedInput: 0.0375 },\n \"qwen/qwen3.8-27b\": { input: 0.8, output: 4 },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DA,IAAa,UAAb,MAAmD;CAWjD,AAAO,YAAY,QAAuB;EACxC,MAAM,EAAE,SAAS,UAAU,SAAS,GAAG,kBAAkB;EAEzD,KAAK,WAAW;EAChB,KAAK,UAAU;EAQf,KAAK,SAAS,IAAI,UAAU;GAC1B,GAAG;GACH,SAAS;GACT,UAAU,KAAK;GACf;EACF,CAAC;CACH;;;;;;;;;;;;;;;;;;CAmBA,AAAO,MAAM,QAAwC;EACnD,MAAM,kBACJ,OAAO,WAAW,KAAK,UAAU,OAAO,SAAS,kBAAkB,OAAO,IAAI;EAEhF,MAAM,SAAS,OAAO,iBAAiB,mBAAmB,OAAO,IAAI;EAErE,OAAO,KAAK,OAAO,MAAM;GACvB,GAAG;GACH,GAAI,WAAW,SAAY,EAAE,eAAe,OAAO,IAAI,CAAC;GAIxD,QAAQ,OAAO,UAAU,sBAAsB,OAAO,IAAI;GAC1D,WAAW,OAAO,aAAa,yBAAyB,OAAO,IAAI;GACnE,kBAAkB,OAAO,oBAAoB;GAC7C,SAAS;EACX,CAAC;CACH;;;;;;;CAQA,MAAa,MAAM,MAAc,OAAiC;EAChE,OAAO,KAAK,OAAO,MAAM,MAAM,KAAK;CACtC;;;;;;;;;;;CAYA,AAAO,SAAS,QAA8C;EAC5D,OAAO,KAAK,OAAO,SAAS,MAAM;CACpC;;;;;;;;;;;CAiBA,MAAa,OAAO,SAAmD;EACrE,OAAO,KAAK,OAAO,OAAO,OAAO;CACnC;AACF;;;;;;;;AASA,SAAS,kBAAkB,MAAwC;CACjE,OAAO,qBAAqB;AAC9B;;AAGA,MAAa,6BAA6B;;;;;;;;;;;AAY1C,MAAa,uBAA+D;CAC1E,uBAAuB;EAAE,OAAO;EAAM,QAAQ;EAAK,aAAa;CAAM;CACtE,sBAAsB;EAAE,OAAO;EAAO,QAAQ;EAAK,aAAa;CAAO;CACvE,gCAAgC;EAAE,OAAO;EAAO,QAAQ;EAAK,aAAa;CAAO;CACjF,oBAAoB;EAAE,OAAO;EAAK,QAAQ;CAAE;AAC9C"}
|
package/llms-full.txt
CHANGED
|
@@ -80,6 +80,10 @@ As of mid-2026 Groq exposes **no** OpenAI-compatible embeddings endpoint. `groq.
|
|
|
80
80
|
|
|
81
81
|
There is also no image-generation API on Groq, so `GroqSDK` intentionally does **not** define `image()` — `ai.groq.image(...)` is a compile-time error (structural capability guard, like Anthropic / Bedrock / Ollama).
|
|
82
82
|
|
|
83
|
+
## Model lifecycle
|
|
84
|
+
|
|
85
|
+
`GROQ_KNOWN_MODELS` holds the current ids (`openai/gpt-oss-120b`, `openai/gpt-oss-20b`, `qwen/qwen3.8-27b`). `GROQ_MODEL_LIFECYCLE` / `groqLifecycleFor(name)` (checked `GROQ_MODEL_LIFECYCLE_AS_OF`, source https://console.groq.com/docs/deprecations) gives `{ status: "current" | "retiring" | "retired", retiresOn?, replacement? }`. `llama-3.3-70b-versatile` and `llama-3.1-8b-instant` (2026-08-16), `deepseek-r1-distill-llama-70b` (2025-10-02), `qwen/qwen3.6-27b`, `qwen/qwen3-32b` and the Llama 4 / Kimi K2 ids are `retired`. Some shutdowns apply to free and developer-tier usage only; `groq.model({ name })` still accepts any id. Token rates in `GROQ_DEFAULT_PRICING` are as of `GROQ_DEFAULT_PRICING_AS_OF`.
|
|
86
|
+
|
|
83
87
|
## Pricing — per-model registry + built-in defaults
|
|
84
88
|
|
|
85
89
|
`pricing` is a registry keyed by model name, rates in **USD per 1,000,000 tokens** (`ModelPricing`: `input`, `output`, optional `cachedInput`). The adapter ships **built-in default rates** (`GROQ_DEFAULT_PRICING`) as the final fallback.
|
package/package.json
CHANGED
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
"directory": "packages/ai-groq"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@warlock.js/ai": "5.
|
|
19
|
+
"@warlock.js/ai": "5.47.1"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@warlock.js/ai-openai": "5.
|
|
23
|
-
"@warlock.js/logger": "5.
|
|
22
|
+
"@warlock.js/ai-openai": "5.47.1",
|
|
23
|
+
"@warlock.js/logger": "5.47.1"
|
|
24
24
|
},
|
|
25
|
-
"version": "5.
|
|
25
|
+
"version": "5.47.1",
|
|
26
26
|
"main": "./cjs/index.cjs",
|
|
27
27
|
"module": "./esm/index.mjs",
|
|
28
28
|
"types": "./esm/index.d.mts",
|
package/skills/SKILL.md
CHANGED
|
@@ -72,6 +72,10 @@ As of mid-2026 Groq exposes **no** OpenAI-compatible embeddings endpoint. `groq.
|
|
|
72
72
|
|
|
73
73
|
There is also no image-generation API on Groq, so `GroqSDK` intentionally does **not** define `image()` — `ai.groq.image(...)` is a compile-time error (structural capability guard, like Anthropic / Bedrock / Ollama).
|
|
74
74
|
|
|
75
|
+
## Model lifecycle
|
|
76
|
+
|
|
77
|
+
`GROQ_KNOWN_MODELS` holds the current ids (`openai/gpt-oss-120b`, `openai/gpt-oss-20b`, `qwen/qwen3.8-27b`). `GROQ_MODEL_LIFECYCLE` / `groqLifecycleFor(name)` (checked `GROQ_MODEL_LIFECYCLE_AS_OF`, source https://console.groq.com/docs/deprecations) gives `{ status: "current" | "retiring" | "retired", retiresOn?, replacement? }`. `llama-3.3-70b-versatile` and `llama-3.1-8b-instant` (2026-08-16), `deepseek-r1-distill-llama-70b` (2025-10-02), `qwen/qwen3.6-27b`, `qwen/qwen3-32b` and the Llama 4 / Kimi K2 ids are `retired`. Some shutdowns apply to free and developer-tier usage only; `groq.model({ name })` still accepts any id. Token rates in `GROQ_DEFAULT_PRICING` are as of `GROQ_DEFAULT_PRICING_AS_OF`.
|
|
78
|
+
|
|
75
79
|
## Pricing — per-model registry + built-in defaults
|
|
76
80
|
|
|
77
81
|
`pricing` is a registry keyed by model name, rates in **USD per 1,000,000 tokens** (`ModelPricing`: `input`, `output`, optional `cachedInput`). The adapter ships **built-in default rates** (`GROQ_DEFAULT_PRICING`) as the final fallback.
|