> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zeroruntime.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Groq

> JavaScript API reference for the groq llm plugin.

## GroqLLM

Groq LLM provider.

### Constructor

```typescript theme={null}
new GroqLLM(opts: GroqLLMOptions)
```

<ParamField path="apiKey" type="string">
  Groq API key. Defaults to the `GROQ_API_KEY` environment variable.
</ParamField>

<ParamField path="model" type="GroqLLMModel | string">
  Model ID to use. Default: `'llama-3.3-70b-versatile'`.
</ParamField>

<ParamField path="temperature" type="number">
  Sampling temperature; higher values produce more random output. Range 0-2. Default: `0.7`.
</ParamField>

<ParamField path="maxOutputTokens" type="number">
  Maximum number of tokens to generate in the completion. Default: `1024`.
</ParamField>

<ParamField path="topP" type="number | null">
  Nucleus sampling probability mass (0-1). Default: `null` (provider default).
</ParamField>

<ParamField path="frequencyPenalty" type="number | null">
  Penalizes new tokens based on their frequency so far (-2.0 to 2.0). Default: `null`.
</ParamField>

<ParamField path="presencePenalty" type="number | null">
  Penalizes new tokens based on whether they appear so far (-2.0 to 2.0). Default: `null`.
</ParamField>

<ParamField path="seed" type="number | null">
  Seed for deterministic sampling; identical requests with the same seed aim to return the same result. Default: `null`.
</ParamField>

<ParamField path="stop" type="string | null">
  Stop sequence(s) at which generation halts. Default: `null`.
</ParamField>

<ParamField path="user" type="string | null">
  Stable identifier for the end user, used for abuse monitoring. Default: `null`.
</ParamField>

<ParamField path="toolChoice" type="string | null">
  Controls tool selection, e.g. `'none'`, `'auto'`, `'required'`, or a specific tool. Default: `null`.
</ParamField>

<ParamField path="parallelToolCalls" type="boolean | null">
  Whether to allow multiple tool calls to run in parallel. Default: `null`.
</ParamField>

<ParamField path="responseFormat" type="Record<string, any> | null">
  Output format specification, e.g. `{ type: 'json_object' }`. Default: `null`.
</ParamField>

<ParamField path="reasoningEffort" type="string | null">
  Reasoning effort level for reasoning-capable models, e.g. `'low'`, `'medium'`, `'high'`. Default: `null`.
</ParamField>

<ParamField path="reasoningFormat" type="string | null">
  How reasoning content is returned, e.g. `'parsed'`, `'raw'`, `'hidden'`. Default: `null`.
</ParamField>

<ParamField path="serviceTier" type="string | null">
  Service tier for the request, e.g. `'auto'`, `'on_demand'`, `'flex'`. Default: `null`.
</ParamField>

### cancelCurrentGeneration

```typescript theme={null}
cancelCurrentGeneration(): Promise<void>
```

Cancel the in-flight generation for the current session, if any.

### chat

```typescript theme={null}
chat(_messages: any, _opts?: LLMChatOptions): AsyncIterator<LLMResponse>
```

Stream a completion for the given messages, yielding LLMResponse chunks.

<ResponseField name="returns" type="AsyncIterator<LLMResponse>" />

### close

```typescript theme={null}
close(): Promise<void>
```

Release any resources held by the provider.

### closeEmitter

```typescript theme={null}
closeEmitter(): Promise<void>
```

Close the emitter: drop all handlers and stop emitting. Waits up to 2 seconds
for in-flight async handlers to settle before returning.

### emit

```typescript theme={null}
emit(event: string, ...args: any[]): void
```

<ParamField path="event" type="string" required />

### getRuntimeConfig

```typescript theme={null}
getRuntimeConfig(): Record<string, any>
```

<ResponseField name="returns" type="Record<string, any>" />

### listenerCount

```typescript theme={null}
listenerCount(event: string): number
```

<ParamField path="event" type="string" required />

<ResponseField name="returns" type="number" />

### off

```typescript theme={null}
off(event: string, handler: EventHandler): void
```

<ParamField path="event" type="string" required />

<ParamField path="handler" type="EventHandler" required />

### on

```typescript theme={null}
on(event: string, handler: EventHandler): EventHandler
```

<ParamField path="event" type="string" required />

<ParamField path="handler" type="EventHandler" required />

<ResponseField name="returns" type="EventHandler" />

### once

```typescript theme={null}
once(event: string, handler: EventHandler): EventHandler
```

<ParamField path="event" type="string" required />

<ParamField path="handler" type="EventHandler" required />

<ResponseField name="returns" type="EventHandler" />

### removeAllListeners

```typescript theme={null}
removeAllListeners(event?: string): void
```

<ParamField path="event" type="string" />

***

## GroqLLMModel

```typescript theme={null}
type GroqLLMModel = 'openai/gpt-oss-20b' | 'openai/gpt-oss-120b' | 'groq/compound' | 'groq/compound-mini' | 'llama-3.1-8b-instant' | 'llama-3.3-70b-versatile'
```
