# @ai-sdk/groq

Latest version **4.0.67** (published 2026-10-21) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @ai-sdk/groq
pnpm add @ai-sdk/groq
yarn add @ai-sdk/groq
bun add @ai-sdk/groq
```

## Health

**Score 80/100 (A)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score; popular repo.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 4.0.67 |
| Published | 2026-10-21 |
| First published | 2024-10-17 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=22 |
| Dependencies | 2 |
| Unpacked size | 265.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 26951 |
| Maintainers | vercel-release-bot, matheuss, matt.straka |
| Keywords | ai |

## Links

- npm: https://www.npmjs.com/package/@ai-sdk/groq
- Repository: https://github.com/vercel/ai
- Homepage: https://ai-sdk.dev/docs
- Issues: https://github.com/vercel/ai/issues
- npm.io page: https://npm.io/package/@ai-sdk/groq

## Dependencies (2)

- [@ai-sdk/provider](https://npm.io/package/@ai-sdk/provider.md) 4.0.31
- [@ai-sdk/provider-utils](https://npm.io/package/@ai-sdk/provider-utils.md) 5.0.65

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 4.0.67 (latest) — 2026-10-21
- 3.0.79 (ai-v6) — 2026-10-21
- 2.0.58 (ai-v5) — 2026-10-12
- 0.0.0-f1630544-20260811180950 (snapshot) — 2026-08-11
- 4.0.0-beta.55 (beta) — 2026-06-23
- 4.0.0-canary.53 (canary) — 2026-06-12
- 2.0.0-alpha.15 (alpha) — 2025-06-18
- 4.0.66 — 2026-10-20
- 3.0.78 — 2026-10-19
- 4.0.65 — 2026-10-19
- 4.0.64 — 2026-10-19
- 4.0.63 — 2026-10-16
- 3.0.77 — 2026-10-16
- 3.0.76 — 2026-10-15
- 4.0.62 — 2026-10-15
- … 416 more at https://npm.io/package/@ai-sdk/groq/versions

## README

# AI SDK - Groq Provider

The **[Groq provider](https://ai-sdk.dev/providers/ai-sdk-providers/groq)** for the [AI SDK](https://ai-sdk.dev/docs)
contains language model support for the Groq chat and completion APIs, transcription support, and browser search tool.

> **Deploying to Vercel?** With Vercel's AI Gateway you can access Groq (and hundreds of models from other providers) — no additional packages, API keys, or extra cost. [Get started with AI Gateway](https://vercel.com/ai-gateway).

## Setup

The Groq provider is available in the `@ai-sdk/groq` module. You can install it with

```bash
npm i @ai-sdk/groq
```

## Skill for Coding Agents

If you use coding agents such as Claude Code or Cursor, we highly recommend adding the AI SDK skill to your repository:

```shell
npx skills add vercel/ai
```

## Provider Instance

You can import the default provider instance `groq` from `@ai-sdk/groq`:

```ts
import { groq } from '@ai-sdk/groq';
```

## Browser Search Tool

The Groq provider includes a browser search tool that provides interactive web browsing capabilities. Unlike traditional web search, browser search navigates websites interactively, providing more detailed and comprehensive results.

### Supported Models

Browser search is only available for these models:

- `openai/gpt-oss-20b`
- `openai/gpt-oss-120b`

⚠️ **Important**: Using browser search with other models will generate a warning and the tool will be ignored.

### Basic Usage

```ts
import { groq } from '@ai-sdk/groq';
import { generateText } from 'ai';

const result = await generateText({
  model: groq('openai/gpt-oss-120b'), // Must use supported model
  prompt:
    'What are the latest developments in AI? Please search for recent news.',
  tools: {
    browser_search: groq.tools.browserSearch({}),
  },
  toolChoice: 'required', // Ensure the tool is used
});

console.log(result.text);
```

### Streaming Example

```ts
import { groq } from '@ai-sdk/groq';
import { streamText } from 'ai';

const result = streamText({
  model: groq('openai/gpt-oss-120b'),
  prompt: 'Search for the latest tech news and summarize it.',
  tools: {
    browser_search: groq.tools.browserSearch({}),
  },
  toolChoice: 'required',
});

for await (const delta of result.stream) {
  if (delta.type === 'text-delta') {
    process.stdout.write(delta.text);
  }
}
```

### Key Features

- **Interactive Browsing**: Navigates websites like a human user
- **Comprehensive Results**: More detailed than traditional search snippets
- **Server-side Execution**: Runs on Groq's infrastructure, no setup required
- **Powered by Exa**: Uses Exa search engine for optimal results
- **Currently Free**: Available at no additional charge during beta

### Best Practices

- Use `toolChoice: 'required'` to ensure the browser search is activated
- Supported models only: `openai/gpt-oss-20b` and `openai/gpt-oss-120b`
- The tool works automatically - no configuration parameters needed
- Server-side execution means no additional API keys or setup required

### Model Validation

The provider automatically validates model compatibility:

```ts
// ✅ Supported - will work
const result = await generateText({
  model: groq('openai/gpt-oss-120b'),
  tools: { browser_search: groq.tools.browserSearch({}) },
});

// ❌ Unsupported - will show warning and ignore tool
const result = await generateText({
  model: groq('gemma2-9b-it'),
  tools: { browser_search: groq.tools.browserSearch({}) },
});
// Warning: "Browser search is only supported on models: openai/gpt-oss-20b, openai/gpt-oss-120b"
```

## Basic Text Generation

```ts
import { groq } from '@ai-sdk/groq';
import { generateText } from 'ai';

const { text } = await generateText({
  model: groq('gemma2-9b-it'),
  prompt: 'Write a vegetarian lasagna recipe for 4 people.',
});
```

## Documentation

Please check out the **[Groq provider documentation](https://ai-sdk.dev/providers/ai-sdk-providers/groq)** for more information.

For browser search details, see the **[Groq Browser Search Documentation](https://console.groq.com/docs/browser-search)**.

---
_Source: https://npm.io/package/@ai-sdk/groq · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
