> ## 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.

# Fireworks AI Integration

> Learn how to connect Fireworks AI's blazing-fast inference platform to ScanDrix for deep AST code reviews.

Fireworks AI is an ultra-fast inference platform for open-weights generative AI, providing serverless and dedicated access to state-of-the-art models like Llama 3.3, DeepSeek V3/R1, Qwen 2.5, and Mixtral. Built with custom compiler optimizations and high-throughput serving, Fireworks AI paired with ScanDrix delivers instant code reviews and taint-tracking analysis.

## Recommended models

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

| Model | Context Window | Speed | Best For |
| - | - | - | - |
| **`accounts/fireworks/models/llama-v3p3-70b-instruct`** `recommended` | 131k tokens | 140+ tps | Standard PR reviews, syntax analysis & AST linting |
| **`accounts/fireworks/models/deepseek-v3`** | 128k tokens | 120+ tps | Deep semantic security analysis & taint propagation |
| **`accounts/fireworks/models/deepseek-r1`** | 128k tokens | 80+ tps | Mathematical proofs, cryptography & complex concurrency |
| **`accounts/fireworks/models/qwen2p5-coder-32b-instruct`** | 131k tokens | 180+ tps | Specialized multi-language coding & patch generation |

> [!NOTE]
>
> For the most up-to-date model identifiers and context limits, consult the [Fireworks AI Models Catalog](https://fireworks.ai/models).

***

## Creating an API Key

> [!WARNING]
>
> A verified Fireworks AI account is required to generate API credentials.

1. Navigate to the [Fireworks AI Console](https://app.fireworks.ai).
2. Sign in or create an account.
3. Select **API Keys** in your account settings.
4. Click **Create API Key**, label it `scandrix-code-review`, and copy the secret key (`fw_...`).

> [!NOTE]
>
> New Fireworks AI accounts receive \$1 in free credits upon registration.

***

## Configuration options

You can configure Fireworks AI either via the ScanDrix dashboard, in your repository's `.scandrix.yaml`, 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 **Fireworks AI** (or Generic OpenAI-Compatible).
3. Set Base URL to `https://api.fireworks.ai/inference/v1`.
4. Paste your Fireworks API Key (`fw_...`).
5. Select `accounts/fireworks/models/llama-v3p3-70b-instruct` as your default review model.
6. Click **Test Connection** to send a synthetic health verification ping.

***

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

To enforce Fireworks AI as the review engine for a specific repository:

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

ai:
  provider: fireworks
  endpoint: "https://api.fireworks.ai/inference/v1"
  model: "accounts/fireworks/models/llama-v3p3-70b-instruct"
  api_key: "env:FIREWORKS_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

# Fireworks AI LLM Configuration
SCANDRIX_LLM_PROVIDER=fireworks
OPENAI_BASE_URL=https://api.fireworks.ai/inference/v1
OPENAI_API_KEY=fw_your_fireworks_api_key_here
SCANDRIX_DEFAULT_MODEL=accounts/fireworks/models/llama-v3p3-70b-instruct

# 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 Fireworks AI integration

Verify that Fireworks AI is processing review jobs:

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

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

Expected log output:

```
[INFO] provider=fireworks model=accounts/fireworks/models/llama-v3p3-70b-instruct latency=910ms tokens=1840 status=200
```

***

## Troubleshooting

> [accordion] Invalid API Key (HTTP 401)
>
> * Verify your key begins with `fw_`.
> * Check if you have sufficient credits in your [Fireworks Console](https://app.fireworks.ai).
> * Ensure there are no trailing whitespace or extra quotation marks in your `.env` or secret manager.

> [accordion] Model Not Found (HTTP 404)
>
> * Ensure you prefixed the model identifier with `accounts/fireworks/models/` (e.g., `accounts/fireworks/models/llama-v3p3-70b-instruct`).
> * Verify the model is currently active in the Fireworks public model catalog.

> [accordion] Rate Limiting (HTTP 429)
>
> * Fireworks AI provides high throughput on serverless endpoints.
> * Check account rate limits in the Fireworks dashboard.
> * For high-volume CI/CD pipelines, consider provisioning a Fireworks on-demand deployment or deploying a fallback provider in `.scandrix.yaml`.


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