Skip to main content

Overview

Splat uses environment variables for configuration, loaded from .env files using python-dotenv. This page documents all available environment variables.

Required Variables

These variables must be set for Splat to function:
API
string
required
Your Groq API key for accessing AI models. Used by the main error processing pipeline.
.env
API=gsk_your_api_key_here
Keep this key secure. Never commit it to version control or share it publicly.
Where to get it: Groq Console → API Keys
API_KEY
string
required
Alternative API key variable used by the agent system. Should typically be set to the same value as API.
.env
API_KEY=gsk_your_api_key_here
Both API and API_KEY are required as different components of Splat reference different variable names.

Optional Variables

MODEL
string
default:"llama3-70b-8192"
The Groq model to use for error analysis. Used by the agent system.
.env
MODEL=llama3-70b-8192
Available models:
  • llama3-70b-8192 - Best for complex error analysis (recommended)
  • llama3-8b-8192 - Faster, suitable for simpler errors
  • mixtral-8x7b-32768 - Alternative with larger context window
See Groq API Configuration for model details.

Configuration Example

Here’s a complete .env file example:
.env
# Groq API Configuration
API=gsk_your_groq_api_key_here
API_KEY=gsk_your_groq_api_key_here

# Model Selection (optional)
MODEL=llama3-70b-8192

Environment Variable Loading

Splat loads environment variables using python-dotenv in the following order:
  1. System environment variables - Highest priority
  2. Project .env file - In your current working directory
  3. Home .env file - In your home directory
Variables defined in higher priority locations override those in lower priority locations.

Usage in Code

Splat accesses environment variables in two main locations:

Error Processing Pipeline

File: process/process.py:11
from groq import Groq
import os
from dotenv import load_dotenv

load_dotenv()
client = Groq(api_key=os.getenv("API"))
The API variable is used to initialize the Groq client for error analysis.

Agent System

File: agents/agents.py:37-38
bug_zapper = Agent(
    model_name=os.getenv('MODEL'),
    api_key=os.getenv('API_KEY'),
    # ...
)
The MODEL and API_KEY variables configure the AI agent for debugging.

Security Best Practices

Always protect your environment variables, especially API keys.
  1. Never commit .env files Add to .gitignore:
    .gitignore
    .env
    .env.*
    !.env.example
    
  2. Use .env.example for documentation Create a template without sensitive values:
    .env.example
    API=your_groq_api_key_here
    API_KEY=your_groq_api_key_here
    MODEL=llama3-70b-8192
    
  3. Set proper file permissions
    chmod 600 .env
    
  4. Use different keys per environment Maintain separate API keys for development, staging, and production.
  5. Rotate keys regularly Generate new API keys periodically in the Groq Console.

Validation

You can verify your environment variables are loaded correctly:
import os
from dotenv import load_dotenv

load_dotenv()

print(f"API configured: {bool(os.getenv('API'))}")
print(f"API_KEY configured: {bool(os.getenv('API_KEY'))}")
print(f"MODEL: {os.getenv('MODEL', 'llama3-70b-8192')}")
This will show whether variables are set without exposing the actual values.

Troubleshooting

Variables Not Loading

Problem: Environment variables are not being recognized. Solutions:
  • Verify .env file is in the correct directory
  • Check for typos in variable names
  • Ensure no spaces around the = sign
  • Try using absolute paths: load_dotenv('/absolute/path/to/.env')

API Key Invalid

Problem: Getting authentication errors from Groq API. Solutions:
  • Verify the API key is correct in .env
  • Check that the key hasn’t expired
  • Ensure you’re using the correct key (Groq keys start with gsk_)
  • Generate a new key in the Groq Console

Model Not Found

Problem: Error about model not being available. Solutions:

Environment-Specific Configuration

For different environments, you can use multiple .env files:
.env                 # Default configuration
.env.development     # Development overrides
.env.production      # Production settings
.env.local          # Local machine overrides (gitignored)
Load specific environments:
from dotenv import load_dotenv
import os

env = os.getenv('ENVIRONMENT', 'development')
load_dotenv(f'.env.{env}')
load_dotenv('.env')  # Fallback to default

Initial Setup

Step-by-step setup guide

Groq API

Learn about Groq API configuration

Troubleshooting

Common issues and solutions

Security

Security best practices

Build docs developers (and LLMs) love