SONA uses a hierarchical environment variable system that retrieves settings in this order:
Character-specific secrets (highest priority)
Character-specific settings
Global environment variables
Default values (lowest priority)
This allows you to override global settings for specific characters when needed.
Common Secrets:
# API Keys for Model Providers
OPENAI_API_KEY=sk-* # OpenAI API key
ANTHROPIC_API_KEY=your-key # Anthropic/Claude API key
GOOGLE_GENERATIVE_AI_API_KEY= # Gemini API key
GROQ_API_KEY=gsk-* # Groq API key
# Database Credentials
SUPABASE_URL= # Supabase URL
SUPABASE_ANON_KEY= # Supabase anonymous key
MONGODB_CONNECTION_STRING= # MongoDB connection string
# Blockchain Related
EVM_PRIVATE_KEY= # EVM private key with "0x" prefix
SOLANA_PRIVATE_KEY= # Solana wallet private key
SOLANA_PUBLIC_KEY= # Solana wallet public key
Accessing Secrets in Code:
// In a plugin, action, or service
const apiKey = runtime.getSetting("OPENAI_API_KEY");
if (!apiKey) {
throw new Error("OpenAI API key not configured");
}
// With a fallback value
const temperature = runtime.getSetting("TEMPERATURE") || "0.7";