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

# Novita AI Integration

> Learn how to connect Novita AI's serverless GPU infrastructure to ScanDrix for cost-efficient AI code reviews.

Novita AI provides serverless GPU infrastructure for open-source AI models, offering low latency, aggressive pricing, and an OpenAI-compatible API interface. Novita supports popular open-weights models like DeepSeek V3/R1 and Llama 3.3 without requiring infrastructure provisioning.

## Recommended models

We recommend high-context coding and reasoning models with reliable token throughput:

| Model | Context Window | Speed | Best For |
| - | - | - | - |
| **`deepseek/deepseek_v3`** `recommended` | 128k tokens | 110+ tps | Standard PR diff reviews, security audits & taint tracing |
| **`deepseek/deepseek-r1`** | 128k tokens | 75+ tps | Deep logic verification, concurrency safety & crypto checks |
| **`meta-llama/llama-3.3-70b-instruct`** | 128k tokens | 135+ tps | Fast syntax checks, style conventions & test suggestions |

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

***

## Creating an API Key

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

1. Navigate to the [Novita AI Console](https://novita.ai).
2. Sign in or create an account.
3. Go to **Settings → Key Management**.
4. Click **Add New Key**, name it `scandrix-code-review`, and copy the secret key.

***

## Configuration options

You can configure Novita 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 **Novita AI** (or Generic OpenAI-Compatible).
3. Set Base URL to `https://api.novita.ai/v3/openai`.
4. Paste your Novita API Key.
5. Select `deepseek/deepseek_v3` 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 Novita AI as the review engine for a specific repository:

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

ai:
  provider: novita
  endpoint: "https://api.novita.ai/v3/openai"
  model: "deepseek/deepseek_v3"
  api_key: "env:NOVITA_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

# Novita AI LLM Configuration
SCANDRIX_LLM_PROVIDER=novita
OPENAI_BASE_URL=https://api.novita.ai/v3/openai
OPENAI_API_KEY=your_novita_api_key_here
SCANDRIX_DEFAULT_MODEL=deepseek/deepseek_v3

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

Verify that Novita AI is processing review tasks:

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

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

Expected log output:

```
[INFO] provider=novita model=deepseek/deepseek_v3 latency=1050ms tokens=1980 status=200
```

***

## Troubleshooting

> [accordion] Invalid API Key (HTTP 401)
>
> * Verify your API key in the [Novita Key Management](https://novita.ai/settings/key-management).
> * Ensure your Novita balance has sufficient credits.
> * Confirm there are no hidden linebreaks in the key string.

> [accordion] Model Not Found (HTTP 404)
>
> * Ensure you use the exact model string (e.g. `deepseek/deepseek_v3`).
> * Verify whether the model requires custom deployment or is accessible via serverless.

> [accordion] Connection Timeouts
>
> * Ensure the server has outgoing HTTPS connectivity to `api.novita.ai`.
> * Check if corporate proxy or firewall settings block non-standard cloud API hosts.


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