@warlock.js/ai-groq 5.24.0 → 5.26.0

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 CHANGED
@@ -4,6 +4,18 @@ 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.26.0 - 2026-09-30
8
+
9
+ ### Changed
10
+
11
+ - Lockstep release; package APIs are unchanged.
12
+
13
+ ## 5.25.0 - 2026-09-28
14
+
15
+ ### Changed
16
+
17
+ - Lockstep release; package APIs are unchanged.
18
+
7
19
  ## 5.24.0 - 2026-09-27
8
20
 
9
21
  ### Changed
package/llms-full.txt CHANGED
@@ -6,117 +6,117 @@
6
6
 
7
7
  ## setup-groq `@warlock.js/ai-groq/setup-groq/SKILL.md`
8
8
 
9
- ---
10
- name: setup-groq
11
- description: 'Wire @warlock.js/ai-groq — new GroqSDK({apiKey, baseURL?, provider?, pricing?}) for Groq-hosted open models on LPU hardware (llama-3.3-70b-versatile, llama-3.1-8b-instant, openai/gpt-oss-120b/20b, deepseek-r1-distill-llama-70b). Thin wrapper over @warlock.js/ai-openai — uses the OpenAI-compatible endpoint https://api.groq.com/openai/v1, delegating transport/streaming/structured-output/errors to OpenAISDK while injecting Groqs OWN vision/reasoning inference + default pricing. .model({name, vision?, reasoning?, structuredOutput?}) for ModelContract. Triggers: `GroqSDK`, `groq.model`, `groq.count`, `llama-3.3-70b-versatile`, `llama-3.1-8b-instant`, `gpt-oss`, `deepseek-r1-distill`, `groq vision`, `groq reasoning`, `reasoning_effort`, `https://api.groq.com/openai/v1`, OpenAI-compatible Groq, LPU, fast inference; "wire groq into a warlock agent", "use llama 3.3 on groq", "run gpt-oss / deepseek reasoning on groq", "point warlock at the groq endpoint"; import `import { GroqSDK } from "@warlock.js/ai-groq"`. Skip: agent wiring — `@warlock.js/ai/run-ai-agent/SKILL.md`; adapter comparison — `@warlock.js/ai/pick-ai-provider/SKILL.md`; the wrapped adapter `@warlock.js/ai-openai` (`setup-openai`); embeddings (Groq has none — use openai/google); siblings `@warlock.js/ai-anthropic`, `@warlock.js/ai-bedrock`, `@warlock.js/ai-google`, `@warlock.js/ai-ollama`; raw `groq-sdk` / `openai` SDK.'
12
- ---
13
-
14
- # `@warlock.js/ai-groq`
15
-
16
- Provider adapter for **Groq** — open models (Llama, GPT-OSS, DeepSeek-R1 distill) served fast on Groq's LPU hardware. Groq speaks the OpenAI Chat Completions protocol, so this package is a **thin wrapper over `@warlock.js/ai-openai`**: it owns an internal `OpenAISDK` pointed at Groq's endpoint and delegates the wire work, while injecting Groq's own capability inference and default pricing. Pair with `@warlock.js/ai` for the agent / tool / system-prompt surface.
17
-
18
- ## Construction
19
-
20
- ```ts
21
- import { GroqSDK } from "@warlock.js/ai-groq";
22
-
23
- // Common path — apiKey only. baseURL + provider default to Groq.
24
- const groq = new GroqSDK({ apiKey: process.env.GROQ_API_KEY! });
25
- ```
26
-
27
- `baseURL` defaults to `https://api.groq.com/openai/v1` (Groq's **OpenAI-compatible endpoint**) — override only to route through a proxy/gateway. `provider` defaults to `"groq"` and flows through to `ModelContract.provider`, `AgentReport.model.provider`, and logs.
28
-
29
- `GroqSDK` is a class (not a factory) — it holds a long-lived internal `OpenAISDK` and aligns with the other adapter entry points. Every upstream `openai` `ClientOptions` field (`timeout`, `maxRetries`, `defaultHeaders`, `fetch`, …) is forwarded verbatim to that inner client.
30
-
31
- ## Producing a model
32
-
33
- ```ts
34
- groq.model({ name: "llama-3.3-70b-versatile" }) // flagship general-purpose text
35
- groq.model({ name: "llama-3.1-8b-instant" }) // fastest / cheapest small text
36
- groq.model({ name: "openai/gpt-oss-120b" }) // vision + reasoning auto-true
37
- groq.model({ name: "deepseek-r1-distill-llama-70b" }) // reasoning auto-true
38
- ```
39
-
40
- Returns a `ModelContract` you pass straight into `ai.agent({ model })`. `name` is the Groq-hosted **open-weight** id (the upstream name, e.g. `openai/gpt-oss-120b`), NOT an OpenAI id. Any current Groq model id works — the list above is curated, not an allow-list.
41
-
42
- ## Capabilities — what's auto-set
43
-
44
- The whole reason this wrapper exists: Groq's ids aren't OpenAI's, so the OpenAI adapter's prefix inference would never fire. `GroqSDK` carries its **own** name lists.
45
-
46
- | Flag | Default |
47
- | --- | --- |
48
- | `vision` | Inferred from the Groq model id. `true` for `gpt-oss`, `llama-4`, `llama-3.2-*-vision`; `false` otherwise (e.g. `llama-3.3-70b-versatile`, `llama-3.1-8b-instant`). |
49
- | `reasoning` | Inferred from the Groq model id. `true` for `gpt-oss`, `deepseek-r1` / `deepseek-r1-distill`, `qwq`, `qwen3`; `false` otherwise. Drives whether `reasoning_effort` is forwarded. |
50
- | `structuredOutput` | `true` — Groq accepts OpenAI-style `response_format`. |
51
- | `promptCaching` | Inherited from the inner OpenAI adapter (`true`; read-side `cachedTokens` accounting). |
52
-
53
- **Override `vision`, `reasoning`, or `structuredOutput` explicitly** via `.model({ name, vision?, reasoning?, structuredOutput? })` — an explicit value always wins over inference.
54
-
55
- ```ts
56
- groq.model({ name: "some-custom-llama", vision: true }) // force on for an unlisted multimodal id
57
- groq.model({ name: "openai/gpt-oss-120b", reasoning: false }) // pin off
58
- ```
59
-
60
- ## Reasoning (gpt-oss / deepseek-r1 distill)
61
-
62
- Reasoning models accept a discrete effort knob, forwarded by the inner adapter as OpenAI's `reasoning_effort`:
63
-
64
- ```ts
65
- const model = groq.model({ name: "deepseek-r1-distill-llama-70b" }); // reasoning auto-true
66
- await model.complete(messages, { reasoning: { effort: "high" } }); // → reasoning_effort: "high"
67
- ```
68
-
69
- - `reasoning.effort` (`"low" | "medium" | "high"`) maps verbatim.
70
- - `reasoning.maxTokens` has no Chat Completions equivalent and is ignored (same as the OpenAI adapter).
71
- - When `capabilities.reasoning` is `false` (e.g. `llama-3.3-70b-versatile`), the option is dropped — never sent as an unsupported param.
72
-
73
- ## Structured output & streaming
74
-
75
- Inherited unchanged from `@warlock.js/ai-openai`: a `responseSchema` maps to `response_format: json_schema` (strict) when the schema is a proper root object, else loose `json_object`; `model.stream()` drains the streaming Chat Completions response and yields `delta` / `tool-call` / `done` chunks with `include_usage` on. See [`setup-openai`](@warlock.js/ai-openai/skills/setup-openai/SKILL.md) for the full wire behavior.
76
-
77
- ## Embeddings — not available on Groq
78
-
79
- As of mid-2026 Groq exposes **no** OpenAI-compatible embeddings endpoint. `groq.embedder({ name })` constructs (delegated to the inner adapter) but a live `.embed()` call fails at the provider. Use `@warlock.js/ai-openai` or `@warlock.js/ai-google` for retrieval embeddings.
80
-
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
-
83
- ## Pricing — per-model registry + built-in defaults
84
-
85
- `pricing` is a registry keyed by model name, rates in **USD per 1,000,000 tokens** (`ModelPricing`: `input`, `output`, optional `cachedInput` / `cachedOutput`). The adapter ships **built-in default rates** for the known Groq models as the final fallback.
86
-
87
- ```ts
88
- const groq = new GroqSDK({
89
- apiKey,
90
- pricing: {
91
- "llama-3.3-70b-versatile": { input: 0.59, output: 0.79 }, // USD per 1M tokens
92
- },
93
- });
94
- ```
95
-
96
- Resolution at `model()` time: per-model `pricing` (`groq.model({ name, pricing })`) > SDK `pricing[name]` > adapter built-in default for the id > `undefined` (no cost computed). Built-in defaults exist for `llama-3.3-70b-versatile`, `llama-3.1-8b-instant`, `openai/gpt-oss-120b`, `openai/gpt-oss-20b`, and `deepseek-r1-distill-llama-70b`; supply your own for anything else.
97
-
98
- ## Token counting
99
-
100
- ```ts
101
- await groq.count("some text") // approximate heuristic (delegated), not a real tokenizer
102
- ```
103
-
104
- Good for budgeting; not for billing.
105
-
106
- ## Errors
107
-
108
- Raw errors are wrapped into the typed `@warlock.js/ai` `AIError` hierarchy by the inner OpenAI adapter's error wrapper (dispatch keys on `status + code`). See [`@warlock.js/ai/handle-ai-errors/SKILL.md`](@warlock.js/ai/handle-ai-errors/SKILL.md). Note Groq's documented OpenAI-compat gaps — `n` must be `1`, and `logprobs` / `logit_bias` / `top_logprobs` / `messages[].name` are unsupported.
109
-
110
- ## When NOT to use this skill
111
-
112
- - Embeddings or image generation — Groq has neither; use `@warlock.js/ai-openai` / `@warlock.js/ai-google`.
113
- - OpenAI / Azure / OpenRouter — use `@warlock.js/ai-openai` (`setup-openai`); this wraps it but for Groq specifically.
114
- - Anthropic — `@warlock.js/ai-anthropic`. Bedrock — `@warlock.js/ai-bedrock`. Gemini — `@warlock.js/ai-google`. Local Ollama — `@warlock.js/ai-ollama`.
115
-
116
- ## See also
117
-
118
- - [`@warlock.js/ai-openai/skills/setup-openai/SKILL.md`](@warlock.js/ai-openai/skills/setup-openai/SKILL.md) — the wrapped adapter; full wire / streaming / structured-output detail
119
- - [`@warlock.js/ai/run-ai-agent/SKILL.md`](@warlock.js/ai/run-ai-agent/SKILL.md) — passing the model into `ai.agent({...})`
120
- - [`@warlock.js/ai/pick-ai-provider/SKILL.md`](@warlock.js/ai/pick-ai-provider/SKILL.md) — adapter comparison
9
+ ---
10
+ name: setup-groq
11
+ description: 'Wire @warlock.js/ai-groq — new GroqSDK({apiKey, baseURL?, provider?, pricing?}) for Groq-hosted open models on LPU hardware (llama-3.3-70b-versatile, llama-3.1-8b-instant, openai/gpt-oss-120b/20b, deepseek-r1-distill-llama-70b). Thin wrapper over @warlock.js/ai-openai — uses the OpenAI-compatible endpoint https://api.groq.com/openai/v1, delegating transport/streaming/structured-output/errors to OpenAISDK while injecting Groqs OWN vision/reasoning inference + default pricing. .model({name, vision?, reasoning?, structuredOutput?}) for ModelContract. Triggers: `GroqSDK`, `groq.model`, `groq.count`, `llama-3.3-70b-versatile`, `llama-3.1-8b-instant`, `gpt-oss`, `deepseek-r1-distill`, `groq vision`, `groq reasoning`, `reasoning_effort`, `https://api.groq.com/openai/v1`, OpenAI-compatible Groq, LPU, fast inference; "wire groq into a warlock agent", "use llama 3.3 on groq", "run gpt-oss / deepseek reasoning on groq", "point warlock at the groq endpoint"; import `import { GroqSDK } from "@warlock.js/ai-groq"`. Skip: agent wiring — `@warlock.js/ai/run-ai-agent/SKILL.md`; adapter comparison — `@warlock.js/ai/pick-ai-provider/SKILL.md`; the wrapped adapter `@warlock.js/ai-openai` (`setup-openai`); embeddings (Groq has none — use openai/google); siblings `@warlock.js/ai-anthropic`, `@warlock.js/ai-bedrock`, `@warlock.js/ai-google`, `@warlock.js/ai-ollama`; raw `groq-sdk` / `openai` SDK.'
12
+ ---
13
+
14
+ # `@warlock.js/ai-groq`
15
+
16
+ Provider adapter for **Groq** — open models (Llama, GPT-OSS, DeepSeek-R1 distill) served fast on Groq's LPU hardware. Groq speaks the OpenAI Chat Completions protocol, so this package is a **thin wrapper over `@warlock.js/ai-openai`**: it owns an internal `OpenAISDK` pointed at Groq's endpoint and delegates the wire work, while injecting Groq's own capability inference and default pricing. Pair with `@warlock.js/ai` for the agent / tool / system-prompt surface.
17
+
18
+ ## Construction
19
+
20
+ ```ts
21
+ import { GroqSDK } from "@warlock.js/ai-groq";
22
+
23
+ // Common path — apiKey only. baseURL + provider default to Groq.
24
+ const groq = new GroqSDK({ apiKey: process.env.GROQ_API_KEY! });
25
+ ```
26
+
27
+ `baseURL` defaults to `https://api.groq.com/openai/v1` (Groq's **OpenAI-compatible endpoint**) — override only to route through a proxy/gateway. `provider` defaults to `"groq"` and flows through to `ModelContract.provider`, `AgentReport.model.provider`, and logs.
28
+
29
+ `GroqSDK` is a class (not a factory) — it holds a long-lived internal `OpenAISDK` and aligns with the other adapter entry points. Every upstream `openai` `ClientOptions` field (`timeout`, `maxRetries`, `defaultHeaders`, `fetch`, …) is forwarded verbatim to that inner client.
30
+
31
+ ## Producing a model
32
+
33
+ ```ts
34
+ groq.model({ name: "llama-3.3-70b-versatile" }) // flagship general-purpose text
35
+ groq.model({ name: "llama-3.1-8b-instant" }) // fastest / cheapest small text
36
+ groq.model({ name: "openai/gpt-oss-120b" }) // vision + reasoning auto-true
37
+ groq.model({ name: "deepseek-r1-distill-llama-70b" }) // reasoning auto-true
38
+ ```
39
+
40
+ Returns a `ModelContract` you pass straight into `ai.agent({ model })`. `name` is the Groq-hosted **open-weight** id (the upstream name, e.g. `openai/gpt-oss-120b`), NOT an OpenAI id. Any current Groq model id works — the list above is curated, not an allow-list.
41
+
42
+ ## Capabilities — what's auto-set
43
+
44
+ The whole reason this wrapper exists: Groq's ids aren't OpenAI's, so the OpenAI adapter's prefix inference would never fire. `GroqSDK` carries its **own** name lists.
45
+
46
+ | Flag | Default |
47
+ | --- | --- |
48
+ | `vision` | Inferred from the Groq model id. `true` for `gpt-oss`, `llama-4`, `llama-3.2-*-vision`; `false` otherwise (e.g. `llama-3.3-70b-versatile`, `llama-3.1-8b-instant`). |
49
+ | `reasoning` | Inferred from the Groq model id. `true` for `gpt-oss`, `deepseek-r1` / `deepseek-r1-distill`, `qwq`, `qwen3`; `false` otherwise. Drives whether `reasoning_effort` is forwarded. |
50
+ | `structuredOutput` | `true` — Groq accepts OpenAI-style `response_format`. |
51
+ | `promptCaching` | Inherited from the inner OpenAI adapter (`true`; read-side `cachedTokens` accounting). |
52
+
53
+ **Override `vision`, `reasoning`, or `structuredOutput` explicitly** via `.model({ name, vision?, reasoning?, structuredOutput? })` — an explicit value always wins over inference.
54
+
55
+ ```ts
56
+ groq.model({ name: "some-custom-llama", vision: true }) // force on for an unlisted multimodal id
57
+ groq.model({ name: "openai/gpt-oss-120b", reasoning: false }) // pin off
58
+ ```
59
+
60
+ ## Reasoning (gpt-oss / deepseek-r1 distill)
61
+
62
+ Reasoning models accept a discrete effort knob, forwarded by the inner adapter as OpenAI's `reasoning_effort`:
63
+
64
+ ```ts
65
+ const model = groq.model({ name: "deepseek-r1-distill-llama-70b" }); // reasoning auto-true
66
+ await model.complete(messages, { reasoning: { effort: "high" } }); // → reasoning_effort: "high"
67
+ ```
68
+
69
+ - `reasoning.effort` (`"low" | "medium" | "high"`) maps verbatim.
70
+ - `reasoning.maxTokens` has no Chat Completions equivalent and is ignored (same as the OpenAI adapter).
71
+ - When `capabilities.reasoning` is `false` (e.g. `llama-3.3-70b-versatile`), the option is dropped — never sent as an unsupported param.
72
+
73
+ ## Structured output & streaming
74
+
75
+ Inherited unchanged from `@warlock.js/ai-openai`: a `responseSchema` maps to `response_format: json_schema` (strict) when the schema is a proper root object, else loose `json_object`; `model.stream()` drains the streaming Chat Completions response and yields `delta` / `tool-call` / `done` chunks with `include_usage` on. See [`setup-openai`](@warlock.js/ai-openai/skills/setup-openai/SKILL.md) for the full wire behavior.
76
+
77
+ ## Embeddings — not available on Groq
78
+
79
+ As of mid-2026 Groq exposes **no** OpenAI-compatible embeddings endpoint. `groq.embedder({ name })` constructs (delegated to the inner adapter) but a live `.embed()` call fails at the provider. Use `@warlock.js/ai-openai` or `@warlock.js/ai-google` for retrieval embeddings.
80
+
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
+
83
+ ## Pricing — per-model registry + built-in defaults
84
+
85
+ `pricing` is a registry keyed by model name, rates in **USD per 1,000,000 tokens** (`ModelPricing`: `input`, `output`, optional `cachedInput` / `cachedOutput`). The adapter ships **built-in default rates** for the known Groq models as the final fallback.
86
+
87
+ ```ts
88
+ const groq = new GroqSDK({
89
+ apiKey,
90
+ pricing: {
91
+ "llama-3.3-70b-versatile": { input: 0.59, output: 0.79 }, // USD per 1M tokens
92
+ },
93
+ });
94
+ ```
95
+
96
+ Resolution at `model()` time: per-model `pricing` (`groq.model({ name, pricing })`) > SDK `pricing[name]` > adapter built-in default for the id > `undefined` (no cost computed). Built-in defaults exist for `llama-3.3-70b-versatile`, `llama-3.1-8b-instant`, `openai/gpt-oss-120b`, `openai/gpt-oss-20b`, and `deepseek-r1-distill-llama-70b`; supply your own for anything else.
97
+
98
+ ## Token counting
99
+
100
+ ```ts
101
+ await groq.count("some text") // approximate heuristic (delegated), not a real tokenizer
102
+ ```
103
+
104
+ Good for budgeting; not for billing.
105
+
106
+ ## Errors
107
+
108
+ Raw errors are wrapped into the typed `@warlock.js/ai` `AIError` hierarchy by the inner OpenAI adapter's error wrapper (dispatch keys on `status + code`). See [`@warlock.js/ai/handle-ai-errors/SKILL.md`](@warlock.js/ai/handle-ai-errors/SKILL.md). Note Groq's documented OpenAI-compat gaps — `n` must be `1`, and `logprobs` / `logit_bias` / `top_logprobs` / `messages[].name` are unsupported.
109
+
110
+ ## When NOT to use this skill
111
+
112
+ - Embeddings or image generation — Groq has neither; use `@warlock.js/ai-openai` / `@warlock.js/ai-google`.
113
+ - OpenAI / Azure / OpenRouter — use `@warlock.js/ai-openai` (`setup-openai`); this wraps it but for Groq specifically.
114
+ - Anthropic — `@warlock.js/ai-anthropic`. Bedrock — `@warlock.js/ai-bedrock`. Gemini — `@warlock.js/ai-google`. Local Ollama — `@warlock.js/ai-ollama`.
115
+
116
+ ## See also
117
+
118
+ - [`@warlock.js/ai-openai/skills/setup-openai/SKILL.md`](@warlock.js/ai-openai/skills/setup-openai/SKILL.md) — the wrapped adapter; full wire / streaming / structured-output detail
119
+ - [`@warlock.js/ai/run-ai-agent/SKILL.md`](@warlock.js/ai/run-ai-agent/SKILL.md) — passing the model into `ai.agent({...})`
120
+ - [`@warlock.js/ai/pick-ai-provider/SKILL.md`](@warlock.js/ai/pick-ai-provider/SKILL.md) — adapter comparison
121
121
 
122
122
 
package/package.json CHANGED
@@ -15,13 +15,13 @@
15
15
  "url": "https://github.com/warlockjs/ai-groq"
16
16
  },
17
17
  "peerDependencies": {
18
- "@warlock.js/ai": "5.24.0"
18
+ "@warlock.js/ai": "5.26.0"
19
19
  },
20
20
  "dependencies": {
21
- "@warlock.js/ai-openai": "5.24.0",
22
- "@warlock.js/logger": "5.24.0"
21
+ "@warlock.js/ai-openai": "5.26.0",
22
+ "@warlock.js/logger": "5.26.0"
23
23
  },
24
- "version": "5.24.0",
24
+ "version": "5.26.0",
25
25
  "main": "./cjs/index.cjs",
26
26
  "module": "./esm/index.mjs",
27
27
  "types": "./esm/index.d.mts",
@@ -1,112 +1,112 @@
1
- ---
2
- name: setup-groq
3
- description: 'Wire @warlock.js/ai-groq — new GroqSDK({apiKey, baseURL?, provider?, pricing?}) for Groq-hosted open models on LPU hardware (llama-3.3-70b-versatile, llama-3.1-8b-instant, openai/gpt-oss-120b/20b, deepseek-r1-distill-llama-70b). Thin wrapper over @warlock.js/ai-openai — uses the OpenAI-compatible endpoint https://api.groq.com/openai/v1, delegating transport/streaming/structured-output/errors to OpenAISDK while injecting Groqs OWN vision/reasoning inference + default pricing. .model({name, vision?, reasoning?, structuredOutput?}) for ModelContract. Triggers: `GroqSDK`, `groq.model`, `groq.count`, `llama-3.3-70b-versatile`, `llama-3.1-8b-instant`, `gpt-oss`, `deepseek-r1-distill`, `groq vision`, `groq reasoning`, `reasoning_effort`, `https://api.groq.com/openai/v1`, OpenAI-compatible Groq, LPU, fast inference; "wire groq into a warlock agent", "use llama 3.3 on groq", "run gpt-oss / deepseek reasoning on groq", "point warlock at the groq endpoint"; import `import { GroqSDK } from "@warlock.js/ai-groq"`. Skip: agent wiring — `@warlock.js/ai/run-ai-agent/SKILL.md`; adapter comparison — `@warlock.js/ai/pick-ai-provider/SKILL.md`; the wrapped adapter `@warlock.js/ai-openai` (`setup-openai`); embeddings (Groq has none — use openai/google); siblings `@warlock.js/ai-anthropic`, `@warlock.js/ai-bedrock`, `@warlock.js/ai-google`, `@warlock.js/ai-ollama`; raw `groq-sdk` / `openai` SDK.'
4
- ---
5
-
6
- # `@warlock.js/ai-groq`
7
-
8
- Provider adapter for **Groq** — open models (Llama, GPT-OSS, DeepSeek-R1 distill) served fast on Groq's LPU hardware. Groq speaks the OpenAI Chat Completions protocol, so this package is a **thin wrapper over `@warlock.js/ai-openai`**: it owns an internal `OpenAISDK` pointed at Groq's endpoint and delegates the wire work, while injecting Groq's own capability inference and default pricing. Pair with `@warlock.js/ai` for the agent / tool / system-prompt surface.
9
-
10
- ## Construction
11
-
12
- ```ts
13
- import { GroqSDK } from "@warlock.js/ai-groq";
14
-
15
- // Common path — apiKey only. baseURL + provider default to Groq.
16
- const groq = new GroqSDK({ apiKey: process.env.GROQ_API_KEY! });
17
- ```
18
-
19
- `baseURL` defaults to `https://api.groq.com/openai/v1` (Groq's **OpenAI-compatible endpoint**) — override only to route through a proxy/gateway. `provider` defaults to `"groq"` and flows through to `ModelContract.provider`, `AgentReport.model.provider`, and logs.
20
-
21
- `GroqSDK` is a class (not a factory) — it holds a long-lived internal `OpenAISDK` and aligns with the other adapter entry points. Every upstream `openai` `ClientOptions` field (`timeout`, `maxRetries`, `defaultHeaders`, `fetch`, …) is forwarded verbatim to that inner client.
22
-
23
- ## Producing a model
24
-
25
- ```ts
26
- groq.model({ name: "llama-3.3-70b-versatile" }) // flagship general-purpose text
27
- groq.model({ name: "llama-3.1-8b-instant" }) // fastest / cheapest small text
28
- groq.model({ name: "openai/gpt-oss-120b" }) // vision + reasoning auto-true
29
- groq.model({ name: "deepseek-r1-distill-llama-70b" }) // reasoning auto-true
30
- ```
31
-
32
- Returns a `ModelContract` you pass straight into `ai.agent({ model })`. `name` is the Groq-hosted **open-weight** id (the upstream name, e.g. `openai/gpt-oss-120b`), NOT an OpenAI id. Any current Groq model id works — the list above is curated, not an allow-list.
33
-
34
- ## Capabilities — what's auto-set
35
-
36
- The whole reason this wrapper exists: Groq's ids aren't OpenAI's, so the OpenAI adapter's prefix inference would never fire. `GroqSDK` carries its **own** name lists.
37
-
38
- | Flag | Default |
39
- | --- | --- |
40
- | `vision` | Inferred from the Groq model id. `true` for `gpt-oss`, `llama-4`, `llama-3.2-*-vision`; `false` otherwise (e.g. `llama-3.3-70b-versatile`, `llama-3.1-8b-instant`). |
41
- | `reasoning` | Inferred from the Groq model id. `true` for `gpt-oss`, `deepseek-r1` / `deepseek-r1-distill`, `qwq`, `qwen3`; `false` otherwise. Drives whether `reasoning_effort` is forwarded. |
42
- | `structuredOutput` | `true` — Groq accepts OpenAI-style `response_format`. |
43
- | `promptCaching` | Inherited from the inner OpenAI adapter (`true`; read-side `cachedTokens` accounting). |
44
-
45
- **Override `vision`, `reasoning`, or `structuredOutput` explicitly** via `.model({ name, vision?, reasoning?, structuredOutput? })` — an explicit value always wins over inference.
46
-
47
- ```ts
48
- groq.model({ name: "some-custom-llama", vision: true }) // force on for an unlisted multimodal id
49
- groq.model({ name: "openai/gpt-oss-120b", reasoning: false }) // pin off
50
- ```
51
-
52
- ## Reasoning (gpt-oss / deepseek-r1 distill)
53
-
54
- Reasoning models accept a discrete effort knob, forwarded by the inner adapter as OpenAI's `reasoning_effort`:
55
-
56
- ```ts
57
- const model = groq.model({ name: "deepseek-r1-distill-llama-70b" }); // reasoning auto-true
58
- await model.complete(messages, { reasoning: { effort: "high" } }); // → reasoning_effort: "high"
59
- ```
60
-
61
- - `reasoning.effort` (`"low" | "medium" | "high"`) maps verbatim.
62
- - `reasoning.maxTokens` has no Chat Completions equivalent and is ignored (same as the OpenAI adapter).
63
- - When `capabilities.reasoning` is `false` (e.g. `llama-3.3-70b-versatile`), the option is dropped — never sent as an unsupported param.
64
-
65
- ## Structured output & streaming
66
-
67
- Inherited unchanged from `@warlock.js/ai-openai`: a `responseSchema` maps to `response_format: json_schema` (strict) when the schema is a proper root object, else loose `json_object`; `model.stream()` drains the streaming Chat Completions response and yields `delta` / `tool-call` / `done` chunks with `include_usage` on. See [`setup-openai`](@warlock.js/ai-openai/skills/setup-openai/SKILL.md) for the full wire behavior.
68
-
69
- ## Embeddings — not available on Groq
70
-
71
- As of mid-2026 Groq exposes **no** OpenAI-compatible embeddings endpoint. `groq.embedder({ name })` constructs (delegated to the inner adapter) but a live `.embed()` call fails at the provider. Use `@warlock.js/ai-openai` or `@warlock.js/ai-google` for retrieval embeddings.
72
-
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
-
75
- ## Pricing — per-model registry + built-in defaults
76
-
77
- `pricing` is a registry keyed by model name, rates in **USD per 1,000,000 tokens** (`ModelPricing`: `input`, `output`, optional `cachedInput` / `cachedOutput`). The adapter ships **built-in default rates** for the known Groq models as the final fallback.
78
-
79
- ```ts
80
- const groq = new GroqSDK({
81
- apiKey,
82
- pricing: {
83
- "llama-3.3-70b-versatile": { input: 0.59, output: 0.79 }, // USD per 1M tokens
84
- },
85
- });
86
- ```
87
-
88
- Resolution at `model()` time: per-model `pricing` (`groq.model({ name, pricing })`) > SDK `pricing[name]` > adapter built-in default for the id > `undefined` (no cost computed). Built-in defaults exist for `llama-3.3-70b-versatile`, `llama-3.1-8b-instant`, `openai/gpt-oss-120b`, `openai/gpt-oss-20b`, and `deepseek-r1-distill-llama-70b`; supply your own for anything else.
89
-
90
- ## Token counting
91
-
92
- ```ts
93
- await groq.count("some text") // approximate heuristic (delegated), not a real tokenizer
94
- ```
95
-
96
- Good for budgeting; not for billing.
97
-
98
- ## Errors
99
-
100
- Raw errors are wrapped into the typed `@warlock.js/ai` `AIError` hierarchy by the inner OpenAI adapter's error wrapper (dispatch keys on `status + code`). See [`@warlock.js/ai/handle-ai-errors/SKILL.md`](@warlock.js/ai/handle-ai-errors/SKILL.md). Note Groq's documented OpenAI-compat gaps — `n` must be `1`, and `logprobs` / `logit_bias` / `top_logprobs` / `messages[].name` are unsupported.
101
-
102
- ## When NOT to use this skill
103
-
104
- - Embeddings or image generation — Groq has neither; use `@warlock.js/ai-openai` / `@warlock.js/ai-google`.
105
- - OpenAI / Azure / OpenRouter — use `@warlock.js/ai-openai` (`setup-openai`); this wraps it but for Groq specifically.
106
- - Anthropic — `@warlock.js/ai-anthropic`. Bedrock — `@warlock.js/ai-bedrock`. Gemini — `@warlock.js/ai-google`. Local Ollama — `@warlock.js/ai-ollama`.
107
-
108
- ## See also
109
-
110
- - [`@warlock.js/ai-openai/skills/setup-openai/SKILL.md`](@warlock.js/ai-openai/skills/setup-openai/SKILL.md) — the wrapped adapter; full wire / streaming / structured-output detail
111
- - [`@warlock.js/ai/run-ai-agent/SKILL.md`](@warlock.js/ai/run-ai-agent/SKILL.md) — passing the model into `ai.agent({...})`
112
- - [`@warlock.js/ai/pick-ai-provider/SKILL.md`](@warlock.js/ai/pick-ai-provider/SKILL.md) — adapter comparison
1
+ ---
2
+ name: setup-groq
3
+ description: 'Wire @warlock.js/ai-groq — new GroqSDK({apiKey, baseURL?, provider?, pricing?}) for Groq-hosted open models on LPU hardware (llama-3.3-70b-versatile, llama-3.1-8b-instant, openai/gpt-oss-120b/20b, deepseek-r1-distill-llama-70b). Thin wrapper over @warlock.js/ai-openai — uses the OpenAI-compatible endpoint https://api.groq.com/openai/v1, delegating transport/streaming/structured-output/errors to OpenAISDK while injecting Groqs OWN vision/reasoning inference + default pricing. .model({name, vision?, reasoning?, structuredOutput?}) for ModelContract. Triggers: `GroqSDK`, `groq.model`, `groq.count`, `llama-3.3-70b-versatile`, `llama-3.1-8b-instant`, `gpt-oss`, `deepseek-r1-distill`, `groq vision`, `groq reasoning`, `reasoning_effort`, `https://api.groq.com/openai/v1`, OpenAI-compatible Groq, LPU, fast inference; "wire groq into a warlock agent", "use llama 3.3 on groq", "run gpt-oss / deepseek reasoning on groq", "point warlock at the groq endpoint"; import `import { GroqSDK } from "@warlock.js/ai-groq"`. Skip: agent wiring — `@warlock.js/ai/run-ai-agent/SKILL.md`; adapter comparison — `@warlock.js/ai/pick-ai-provider/SKILL.md`; the wrapped adapter `@warlock.js/ai-openai` (`setup-openai`); embeddings (Groq has none — use openai/google); siblings `@warlock.js/ai-anthropic`, `@warlock.js/ai-bedrock`, `@warlock.js/ai-google`, `@warlock.js/ai-ollama`; raw `groq-sdk` / `openai` SDK.'
4
+ ---
5
+
6
+ # `@warlock.js/ai-groq`
7
+
8
+ Provider adapter for **Groq** — open models (Llama, GPT-OSS, DeepSeek-R1 distill) served fast on Groq's LPU hardware. Groq speaks the OpenAI Chat Completions protocol, so this package is a **thin wrapper over `@warlock.js/ai-openai`**: it owns an internal `OpenAISDK` pointed at Groq's endpoint and delegates the wire work, while injecting Groq's own capability inference and default pricing. Pair with `@warlock.js/ai` for the agent / tool / system-prompt surface.
9
+
10
+ ## Construction
11
+
12
+ ```ts
13
+ import { GroqSDK } from "@warlock.js/ai-groq";
14
+
15
+ // Common path — apiKey only. baseURL + provider default to Groq.
16
+ const groq = new GroqSDK({ apiKey: process.env.GROQ_API_KEY! });
17
+ ```
18
+
19
+ `baseURL` defaults to `https://api.groq.com/openai/v1` (Groq's **OpenAI-compatible endpoint**) — override only to route through a proxy/gateway. `provider` defaults to `"groq"` and flows through to `ModelContract.provider`, `AgentReport.model.provider`, and logs.
20
+
21
+ `GroqSDK` is a class (not a factory) — it holds a long-lived internal `OpenAISDK` and aligns with the other adapter entry points. Every upstream `openai` `ClientOptions` field (`timeout`, `maxRetries`, `defaultHeaders`, `fetch`, …) is forwarded verbatim to that inner client.
22
+
23
+ ## Producing a model
24
+
25
+ ```ts
26
+ groq.model({ name: "llama-3.3-70b-versatile" }) // flagship general-purpose text
27
+ groq.model({ name: "llama-3.1-8b-instant" }) // fastest / cheapest small text
28
+ groq.model({ name: "openai/gpt-oss-120b" }) // vision + reasoning auto-true
29
+ groq.model({ name: "deepseek-r1-distill-llama-70b" }) // reasoning auto-true
30
+ ```
31
+
32
+ Returns a `ModelContract` you pass straight into `ai.agent({ model })`. `name` is the Groq-hosted **open-weight** id (the upstream name, e.g. `openai/gpt-oss-120b`), NOT an OpenAI id. Any current Groq model id works — the list above is curated, not an allow-list.
33
+
34
+ ## Capabilities — what's auto-set
35
+
36
+ The whole reason this wrapper exists: Groq's ids aren't OpenAI's, so the OpenAI adapter's prefix inference would never fire. `GroqSDK` carries its **own** name lists.
37
+
38
+ | Flag | Default |
39
+ | --- | --- |
40
+ | `vision` | Inferred from the Groq model id. `true` for `gpt-oss`, `llama-4`, `llama-3.2-*-vision`; `false` otherwise (e.g. `llama-3.3-70b-versatile`, `llama-3.1-8b-instant`). |
41
+ | `reasoning` | Inferred from the Groq model id. `true` for `gpt-oss`, `deepseek-r1` / `deepseek-r1-distill`, `qwq`, `qwen3`; `false` otherwise. Drives whether `reasoning_effort` is forwarded. |
42
+ | `structuredOutput` | `true` — Groq accepts OpenAI-style `response_format`. |
43
+ | `promptCaching` | Inherited from the inner OpenAI adapter (`true`; read-side `cachedTokens` accounting). |
44
+
45
+ **Override `vision`, `reasoning`, or `structuredOutput` explicitly** via `.model({ name, vision?, reasoning?, structuredOutput? })` — an explicit value always wins over inference.
46
+
47
+ ```ts
48
+ groq.model({ name: "some-custom-llama", vision: true }) // force on for an unlisted multimodal id
49
+ groq.model({ name: "openai/gpt-oss-120b", reasoning: false }) // pin off
50
+ ```
51
+
52
+ ## Reasoning (gpt-oss / deepseek-r1 distill)
53
+
54
+ Reasoning models accept a discrete effort knob, forwarded by the inner adapter as OpenAI's `reasoning_effort`:
55
+
56
+ ```ts
57
+ const model = groq.model({ name: "deepseek-r1-distill-llama-70b" }); // reasoning auto-true
58
+ await model.complete(messages, { reasoning: { effort: "high" } }); // → reasoning_effort: "high"
59
+ ```
60
+
61
+ - `reasoning.effort` (`"low" | "medium" | "high"`) maps verbatim.
62
+ - `reasoning.maxTokens` has no Chat Completions equivalent and is ignored (same as the OpenAI adapter).
63
+ - When `capabilities.reasoning` is `false` (e.g. `llama-3.3-70b-versatile`), the option is dropped — never sent as an unsupported param.
64
+
65
+ ## Structured output & streaming
66
+
67
+ Inherited unchanged from `@warlock.js/ai-openai`: a `responseSchema` maps to `response_format: json_schema` (strict) when the schema is a proper root object, else loose `json_object`; `model.stream()` drains the streaming Chat Completions response and yields `delta` / `tool-call` / `done` chunks with `include_usage` on. See [`setup-openai`](@warlock.js/ai-openai/skills/setup-openai/SKILL.md) for the full wire behavior.
68
+
69
+ ## Embeddings — not available on Groq
70
+
71
+ As of mid-2026 Groq exposes **no** OpenAI-compatible embeddings endpoint. `groq.embedder({ name })` constructs (delegated to the inner adapter) but a live `.embed()` call fails at the provider. Use `@warlock.js/ai-openai` or `@warlock.js/ai-google` for retrieval embeddings.
72
+
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
+
75
+ ## Pricing — per-model registry + built-in defaults
76
+
77
+ `pricing` is a registry keyed by model name, rates in **USD per 1,000,000 tokens** (`ModelPricing`: `input`, `output`, optional `cachedInput` / `cachedOutput`). The adapter ships **built-in default rates** for the known Groq models as the final fallback.
78
+
79
+ ```ts
80
+ const groq = new GroqSDK({
81
+ apiKey,
82
+ pricing: {
83
+ "llama-3.3-70b-versatile": { input: 0.59, output: 0.79 }, // USD per 1M tokens
84
+ },
85
+ });
86
+ ```
87
+
88
+ Resolution at `model()` time: per-model `pricing` (`groq.model({ name, pricing })`) > SDK `pricing[name]` > adapter built-in default for the id > `undefined` (no cost computed). Built-in defaults exist for `llama-3.3-70b-versatile`, `llama-3.1-8b-instant`, `openai/gpt-oss-120b`, `openai/gpt-oss-20b`, and `deepseek-r1-distill-llama-70b`; supply your own for anything else.
89
+
90
+ ## Token counting
91
+
92
+ ```ts
93
+ await groq.count("some text") // approximate heuristic (delegated), not a real tokenizer
94
+ ```
95
+
96
+ Good for budgeting; not for billing.
97
+
98
+ ## Errors
99
+
100
+ Raw errors are wrapped into the typed `@warlock.js/ai` `AIError` hierarchy by the inner OpenAI adapter's error wrapper (dispatch keys on `status + code`). See [`@warlock.js/ai/handle-ai-errors/SKILL.md`](@warlock.js/ai/handle-ai-errors/SKILL.md). Note Groq's documented OpenAI-compat gaps — `n` must be `1`, and `logprobs` / `logit_bias` / `top_logprobs` / `messages[].name` are unsupported.
101
+
102
+ ## When NOT to use this skill
103
+
104
+ - Embeddings or image generation — Groq has neither; use `@warlock.js/ai-openai` / `@warlock.js/ai-google`.
105
+ - OpenAI / Azure / OpenRouter — use `@warlock.js/ai-openai` (`setup-openai`); this wraps it but for Groq specifically.
106
+ - Anthropic — `@warlock.js/ai-anthropic`. Bedrock — `@warlock.js/ai-bedrock`. Gemini — `@warlock.js/ai-google`. Local Ollama — `@warlock.js/ai-ollama`.
107
+
108
+ ## See also
109
+
110
+ - [`@warlock.js/ai-openai/skills/setup-openai/SKILL.md`](@warlock.js/ai-openai/skills/setup-openai/SKILL.md) — the wrapped adapter; full wire / streaming / structured-output detail
111
+ - [`@warlock.js/ai/run-ai-agent/SKILL.md`](@warlock.js/ai/run-ai-agent/SKILL.md) — passing the model into `ai.agent({...})`
112
+ - [`@warlock.js/ai/pick-ai-provider/SKILL.md`](@warlock.js/ai/pick-ai-provider/SKILL.md) — adapter comparison