globe-pointerEnvironment Variables

Overview

LLM Provider API Keys

Crowe uses environment variables to store API keys for various LLM providers, ensuring secure credential management and easy configuration across environments.

# OpenAI
OPENAI_API_KEY="your-openai-key"

# Anthropic
ANTHROPIC_API_KEY="your-anthropic-key"

# Google
GEMINI_API_KEY="your-gemini-key"

# Hugging Face
HUGGINGFACE_TOKEN="your-huggingface-token"

# Perplexity AI
PPLX_API_KEY="your-perplexity-key"

Security Best Practices

1. Managing Environment Files

  • Place a .env file in the root directory of your project.

  • Always exclude .env from version control to prevent accidental exposure of secrets.

  • Update .gitignore to include the .env file:


2. Protecting API Keys

To keep your credentials safe:

  • Rotate keys periodically to reduce the risk of misuse.

  • Use separate keys for development and production environments.

  • Avoid embedding API keys directly in your source code.

  • Assign the minimal set of permissions required.

  • Actively monitor API usage for unexpected activity.


3. Configuration Template

Provide a .env.example file to help others set up their environment without exposing your real keys:


4. Loading Environment Variables in Python

Environment Setup Guide

Environment-Specific Configuration

Troubleshootingarrow-up-right

Common Issuesarrow-up-right

chevron-rightEnvironment Variables Not Loadinghashtag
  • Verify .env file exists in project root

  • Confirm load_dotenv() is called before accessing variables

  • Check file permissions

chevron-rightAPI Key Issueshashtag
  • Verify key format is correct

  • Ensure key has not expired

  • Check for leading/trailing whitespace

chevron-rightWorkspace Directory Problemshashtag
  • Confirm directory exists

  • Verify write permissions

  • Check path is absolute when required

Last updated