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

# Groq Cloud Integration

> Learn how to connect Groq's high-speed LPU inference engine to ScanDrix for sub-second code reviews.

Groq Cloud provides ultra-fast LLM inference using its custom Language Processing Units (LPUs) with OpenAI-compatible APIs. Combining Groq with ScanDrix's Tree-sitter AST engine gives engineering teams deep semantic code reviews with virtually zero waiting time.

## Recommended models

We recommend high-context coding and reasoning models with strong instruction-following capabilities:

| Model | Context Window | Speed | Best For |
| - | - | - | - |
| **`llama-3.3-70b-versatile`** `recommended` | 128k tokens | 300+ tps | Default code reviews & taint path tracing |
| **`deepseek-r1-distill-llama-70b`** | 128k tokens | 280+ tps | Complex security invariants & architecture verification |
| **`llama-3.1-8b-instant`** | 128k tokens | 750+ tps | Rapid syntax checks & commit message linting |

> [!NOTE]
>
> For the most up-to-date model identifiers and context limits, consult the [Groq Models documentation](https://console.groq.com/docs/models).

***

## Creating an API Key

> [!WARNING]
>
> A verified Groq Cloud account is required to generate API credentials.

1. Navigate to the [Groq Console](https://console.groq.com).
2. Sign in or create an account.
3. Select **API Keys** in the left sidebar navigation.
4. Click **Create API Key**, label it `scandrix-code-review`, and copy the secret key (`gsk_...`).

***

## Configuration options

You can configure Groq either in the cloud dashboard, in repository configuration, or in self-hosted backend environment variables.

### Option 1: Via the ScanDrix Dashboard (Recommended for SaaS)

1. Open the ScanDrix dashboard and navigate to **Settings → AI Providers**.
2. Click **Add Provider** and select **Groq**.
3. Paste your Groq API Key (`gsk_...`).
4. Select `llama-3.3-70b-versatile` as your primary review model.
5. Click **Test Connection** to send a synthetic health ping.

***

### Option 2: Via Repository Config (`.scandrix.yaml`)

To enforce Groq as the review engine for a specific repository:

```yaml theme={null}
# .scandrix.yaml
version: 1

ai:
  provider: groq
  endpoint: "https://api.groq.com/openai/v1"
  model: "llama-3.3-70b-versatile"
  api_key: "env:GROQ_API_KEY"
  temperature: 0.1
  max_tokens: 4096

review:
  severity_threshold: warning
  patch_suggestions: true
```

***

### Option 3: Via Self-Hosted Backend (.env)

If deploying the self-hosted ScanDrix Go backend, configure your environment file:

```env theme={null}
# ScanDrix Core Service Configuration
PORT=8080
SCANDRIX_API_URL=https://api.scandrix.yourdomain.com
SCANDRIX_WEB_URL=https://scandrix.yourdomain.com

# Database Connection (PostgreSQL 16+)
DATABASE_URL=postgres://scandrix:yourpassword@postgres:5432/scandrix?sslmode=require

# Groq LLM Configuration
SCANDRIX_LLM_PROVIDER=groq
OPENAI_BASE_URL=https://api.groq.com/openai/v1
OPENAI_API_KEY=gsk_your_groq_api_key_here
SCANDRIX_DEFAULT_MODEL=llama-3.3-70b-versatile

# Webhook Secret for HMAC verification
GITHUB_WEBHOOK_SECRET=your_github_webhook_secret
```

***

## Production Reverse Proxy Setup

For self-hosted instances with external Git webhooks, configure Nginx to forward requests to the Next.js frontend (port 3000) and the Go backend API (port 8080):

```nginx theme={null}
# ScanDrix Web Dashboard (port 3000)
server {
    listen 443 ssl http2;
    server_name scandrix.yourdomain.com;

    ssl_certificate /etc/letsencrypt/live/scandrix.yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/scandrix.yourdomain.com/privkey.pem;

    location / {
        proxy_pass http://127.0.0.1:3000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

# ScanDrix Go API & Webhooks (port 8080)
server {
    listen 443 ssl http2;
    server_name api.scandrix.yourdomain.com;

    ssl_certificate /etc/letsencrypt/live/api.scandrix.yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/api.scandrix.yourdomain.com/privkey.pem;

    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}
```

***

## Verifying Groq integration

Verify that Groq is responding to pull request analysis requests:

```bash theme={null}
# Test local review via CLI
scandrix review --staged

# Or inspect worker container logs
docker logs scandrix-worker | grep -i "groq"
```

Expected log output:

```
[INFO] provider=groq model=llama-3.3-70b-versatile latency=840ms tokens=1420 status=200
```

***

## Troubleshooting

> [accordion] Invalid API Key (HTTP 401)
>
> * Ensure your key begins with `gsk_`.
> * Verify that the key has not been revoked or expired in [Groq Console](https://console.groq.com/keys).
> * Ensure there are no surrounding whitespace or quote characters in your environment variable.

> [accordion] Model Not Found (HTTP 404)
>
> * Check for spelling mistakes (e.g. `llama-3.3-70b-versatile` vs `llama-3.3-70b`).
> * Verify whether Groq has updated or retired the model slug on their active models page.

> [accordion] Rate Limits & Quota Exhaustion (HTTP 429)
>
> * Groq applies requests-per-minute (RPM) and tokens-per-minute (TPM) limits based on your tier.
> * Check your current usage at [Groq Rate Limits](https://console.groq.com/docs/rate-limits).
> * ScanDrix automatically retries with exponential backoff on HTTP 429, but persistent spikes require upgrading your Groq tier or setting up a secondary fallback provider.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.