Environment Variables
llmist uses environment variables for provider authentication and configuration.
Provider API Keys
Section titled “Provider API Keys”Set these environment variables to enable provider auto-discovery:
# OpenAIexport OPENAI_API_KEY="sk-..."
# Anthropicexport ANTHROPIC_API_KEY="sk-ant-..."
# Google Geminiexport GEMINI_API_KEY="..."Auto-Discovery Behavior
Section titled “Auto-Discovery Behavior”When you create an agent without specifying a provider, llmist:
- Checks for API keys in environment variables
- Registers providers with valid keys
- Selects the appropriate provider based on model name
// Auto-discovers providers from environmentconst agent = LLMist.createAgent() .withModel('sonnet'); // Uses Anthropic if ANTHROPIC_API_KEY is setLogging Configuration
Section titled “Logging Configuration”| Variable | Description | Values |
|---|---|---|
LLMIST_LOG_LEVEL | Logging verbosity | silly, trace, debug, info, warn, error, fatal |
LLMIST_LOG_FILE | Path to log file | Any valid file path |
LLMIST_LOG_RESET | Clear log on start | true, false |
Example Logging Setup
Section titled “Example Logging Setup”# Enable debug logging to fileexport LLMIST_LOG_LEVEL="debug"export LLMIST_LOG_FILE="./llmist.log"export LLMIST_LOG_RESET="true"CLI-Specific Flags
Section titled “CLI-Specific Flags”These can also be set via command-line flags:
| Flag | Environment Variable | Description |
|---|---|---|
--log-level | LLMIST_LOG_LEVEL | Set log level |
--log-file | LLMIST_LOG_FILE | Set log file path |
# Via flagbunx @llmist/cli agent "Hello" --log-level debug --log-file ./debug.log
# Via environmentLLMIST_LOG_LEVEL=debug LLMIST_LOG_FILE=./debug.log bunx @llmist/cli agent "Hello"# Via flagnpx @llmist/cli agent "Hello" --log-level debug --log-file ./debug.log
# Via environmentLLMIST_LOG_LEVEL=debug LLMIST_LOG_FILE=./debug.log npx @llmist/cli agent "Hello"Provider-Specific Variables
Section titled “Provider-Specific Variables”OpenAI
Section titled “OpenAI”| Variable | Description |
|---|---|
OPENAI_API_KEY | API key (required) |
OPENAI_ORG_ID | Organization ID (optional) |
OPENAI_BASE_URL | Custom API endpoint (optional) |
Anthropic
Section titled “Anthropic”| Variable | Description |
|---|---|
ANTHROPIC_API_KEY | API key (required) |
ANTHROPIC_BASE_URL | Custom API endpoint (optional) |
Google Gemini
Section titled “Google Gemini”| Variable | Description |
|---|---|
GEMINI_API_KEY | API key (required) |
Best Practices
Section titled “Best Practices”- Never commit API keys - Use
.envfiles or secret managers - Use different keys per environment - Separate dev/staging/production
- Rotate keys regularly - Update keys periodically for security
Using .env Files
Section titled “Using .env Files”# .env (add to .gitignore!)OPENAI_API_KEY=sk-...ANTHROPIC_API_KEY=sk-ant-...Load with your preferred method:
- Node.js:
dotenvpackage - Bun: Built-in
.envsupport - Shell:
source .envorexport $(cat .env | xargs)