Skip to main content

Overview

RepoMaster uses environment variables for configuration management. All configuration is stored in the configs/.env file, which is loaded automatically on startup.

Quick Setup

1. Copy Example Configuration

cd RepoMaster
cp configs/env.example configs/.env

2. Edit Configuration

Open configs/.env in your preferred editor:
nano configs/.env
# or
vim configs/.env
# or
code configs/.env

3. Add Your API Keys

Replace placeholder values with your actual API keys (see sections below).

4. Verify Setup

Run RepoMaster to verify configuration:
python launcher.py --mode backend --backend-mode unified

Complete Environment File

The complete configs/env.example template (as of source):
# ==============================================================================
# RepoMaster Environment Configuration Example
# ==============================================================================
# Copy this file to .env and fill in your actual API keys and configurations

# ==============================================================================
# Default API Provider Configuration
# ==============================================================================
# Set the default API provider (openai, claude, deepseek, azure_openai)
# If not set, will use the first available provider in priority order
DEFAULT_API_PROVIDER=openai

# ==============================================================================
# Search Engine APIs
# Get your API key at: https://serper.dev/login
SERPER_API_KEY=${SERPER_API_KEY}

# Jina AI (for document processing)
# Get your API key at: https://jina.ai/
JINA_API_KEY=${JINA_API_KEY}


# ==============================================================================
# LLM Provider API Keys
# ==============================================================================

# OpenAI Configuration
OPENAI_API_KEY=${OPENAI_API_KEY}
OPENAI_MODEL=gpt-5
OPENAI_BASE_URL=https://api.openai.com/v1

# Anthropic Claude Configuration
ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
ANTHROPIC_MODEL=claude-4-sonnet

# DeepSeek Configuration
DEEPSEEK_API_KEY=${DEEPSEEK_API_KEY}
DEEPSEEK_MODEL=deepseek-v3
DEEPSEEK_BASE_URL=https://api.deepseek.com/v1

# Google Gemini Configuration
GEMINI_API_KEY=${GEMINI_API_KEY}
GEMINI_MODEL=gemini-2.5-pro

Required Variables

Core API Providers

At least one LLM provider must be configured (OpenAI, Claude, DeepSeek, or Gemini).
Choose and configure at least one:
OPENAI_API_KEY=sk-proj-...
OPENAI_MODEL=gpt-5                        # Default: gpt-4o
OPENAI_BASE_URL=https://api.openai.com/v1 # Optional
Where to get:
ANTHROPIC_API_KEY=sk-ant-...
ANTHROPIC_MODEL=claude-4-sonnet              # Default: claude-3-5-sonnet-20241022
ANTHROPIC_BASE_URL=https://api.anthropic.com # Optional
Where to get:
DEEPSEEK_API_KEY=sk-...
DEEPSEEK_MODEL=deepseek-v3                # Default: deepseek-v3
DEEPSEEK_BASE_URL=https://api.deepseek.com/v1
Where to get:
GEMINI_API_KEY=AIza...
GEMINI_MODEL=gemini-2.5-pro
Where to get:

Search & Document Processing

These APIs are required for the Deep Search Agent to function properly.
# Serper API - Google search results
SERPER_API_KEY=your_serper_api_key
Get API Key: serper.dev/login
  • Free tier: 2,500 searches/month
  • Paid plans available for higher usage
# Jina AI - Document processing and web content extraction
JINA_API_KEY=your_jina_api_key
Get API Key: jina.ai
  • Free tier available
  • Used for extracting and processing web content

Optional Variables

Azure OpenAI

For enterprise deployments using Azure:
AZURE_OPENAI_API_KEY=your_azure_key
AZURE_OPENAI_MODEL=gpt-4o
AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com/
AZURE_OPENAI_API_VERSION=2024-02-15-preview
Azure OpenAI requires an Azure subscription and deployed model instance. See portal.azure.com to set up.

Custom Base URLs

Override default API endpoints:
# OpenAI-compatible endpoint
OPENAI_BASE_URL=https://your-custom-endpoint.com/v1

# Custom Claude endpoint
ANTHROPIC_BASE_URL=https://your-custom-endpoint.com

# Custom DeepSeek endpoint
DEEPSEEK_BASE_URL=https://your-custom-endpoint.com/v1

Environment Loading Process

RepoMaster’s environment loading follows this process (from launcher.py:50):

1. Setup PYTHONPATH

# Adds RepoMaster directory to Python path
current_dir = Path(__file__).parent.absolute()
os.environ['PYTHONPATH'] = f"{current_dir}:{python_path}"

2. Check for Configuration Files

env_file = current_dir / "configs" / ".env"
env_example_file = current_dir / "configs" / "env.example"

3. Load Environment Variables

Priority order:
  1. configs/.env file (if exists)
  2. System environment variables (fallback)
  3. Error if required keys missing

4. Validate Required Keys

required_keys = ['SERPER_API_KEY', 'JINA_API_KEY']
# At least one LLM provider key also required

Validation Messages

Successful Setup

✅ Using API provider 'openai' with valid configuration

Configuration File Not Found

⚠️  Configuration file not found!
📝 Please copy the example configuration file:
   cp configs/env.example configs/.env
   Then edit configs/.env with your API keys
💡 See README.md or USAGE.md for detailed setup instructions

Missing Required Keys

⚠️  Missing required API keys in .env file: SERPER_API_KEY, JINA_API_KEY
📝 Please edit configs/.env and add the missing keys
💡 See README.md or USAGE.md for API key setup instructions

No Valid Provider

❌ No valid API provider found. Please configure at least one API key.

Environment Variable Access

In Python code, access environment variables through os.environ:
import os

# Get API key
api_key = os.environ.get("OPENAI_API_KEY")

# Get with default value
model = os.environ.get("OPENAI_MODEL", "gpt-4o")

# Get default provider
default_provider = os.environ.get("DEFAULT_API_PROVIDER", "openai")

Configuration Helper Functions

RepoMaster provides helper functions (from oai_config.py):
from configs.oai_config import get_api_config, get_default_provider

# Get default provider
provider = get_default_provider()  # Returns: openai, claude, deepseek, etc.

# Get all API configurations
configs = get_api_config()

Security Best Practices

Protect Your API Keys

Never commit your .env file to version control!
The .gitignore file should include:
# Environment files
configs/.env
.env
*.env

Key Rotation

Regularly rotate API keys:
  1. Generate new key in provider dashboard
  2. Update configs/.env with new key
  3. Test configuration
  4. Revoke old key

Minimal Permissions

Use API keys with minimal required permissions:
  • OpenAI: Restrict to specific models if possible
  • Azure: Use managed identities when available
  • Google Cloud: Set up service accounts with limited scope

Environment Isolation

For multiple deployments:
# Development
cp configs/env.example configs/.env.dev

# Production  
cp configs/env.example configs/.env.prod

# Load specific environment
export ENV_FILE=configs/.env.prod
python launcher.py

Troubleshooting

Variables Not Loading

Issue: Environment variables appear empty Solutions:
# 1. Verify file location
ls -la configs/.env

# 2. Check file format (no spaces around =)
# Wrong:  OPENAI_API_KEY = sk-...
# Correct: OPENAI_API_KEY=sk-...

# 3. Reload environment
source configs/.env  # Not needed, but helps verify syntax

Permission Denied

Issue: Cannot read .env file Solution:
chmod 600 configs/.env  # Owner read/write only

Variable Substitution

Issue: Variables showing ${VARIABLE_NAME} literally Solution: The env.example uses placeholders. Replace them with actual values:
# Wrong (in .env):
OPENAI_API_KEY=${OPENAI_API_KEY}

# Correct (in .env):
OPENAI_API_KEY=sk-proj-abc123...

Next Steps

API Provider Configuration

Detailed provider setup and model options

Advanced Options

CLI flags and runtime configuration

Build docs developers (and LLMs) love