Environment Variables
Configure your Chiro AI instance behavior through environment variables. Achiral supports both predefined system variables and custom application variables.
Setting Environment Variables
Via Dashboard
- Navigate to Configuration → Environment Variables
- Click Add Variable
- Enter the variable name and value
- Click Save
- Restart your Chiro instance to apply changes
Via API
curl -X POST https://api.achiral.ai/v1/organizations/{org_id}/env \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"variables": {
"LOG_LEVEL": "DEBUG",
"MAX_CONCURRENT_REQUESTS": "100"
}
}'
System Variables
Core Configuration
MAX_CONCURRENT_REQUESTS
Maximum number of simultaneous inference requests.
- Default: Varies by plan tier (5/20/100 for Spark/Seed/Scale)
- Type: Integer
- Range: 1-1000
- Example:
MAX_CONCURRENT_REQUESTS=100
REQUEST_TIMEOUT
Maximum time (in seconds) to process a single request.
- Default:
120 - Type: Integer
- Range: 10-600
- Example:
REQUEST_TIMEOUT=60
MODEL_CACHE_DIR
Directory for cached model files and weights.
- Default:
/var/lib/chiro/models - Type: String (path)
- Example:
MODEL_CACHE_DIR=/mnt/storage/models
WORKER_PROCESSES
Number of inference worker processes.
- Default: Auto (based on plan tier)
- Type: Integer
- Range: 1-16
- Example:
WORKER_PROCESSES=4
Logging Configuration
LOG_LEVEL
Logging verbosity level.
- Default:
INFO - Type: String
- Options:
DEBUG,INFO,WARNING,ERROR,CRITICAL - Example:
LOG_LEVEL=DEBUG
LOG_FORMAT
Format for log output.
- Default:
json - Type: String
- Options:
json,text,structured - Example:
LOG_FORMAT=json
LOG_DESTINATION
Where to send logs.
- Default:
stdout - Type: String
- Options:
stdout,file,syslog,cloudwatch - Example:
LOG_DESTINATION=file
LOG_FILE_PATH
Path to log file (when LOG_DESTINATION=file).
- Default:
/var/log/chiro/app.log - Type: String (path)
- Example:
LOG_FILE_PATH=/mnt/logs/chiro.log
Model Configuration
DEFAULT_MODEL
Default model to use when not specified in requests.
- Default: None (must be specified in request)
- Type: String
- Example:
DEFAULT_MODEL=mistral-7b-instruct
MODEL_AUTO_DOWNLOAD
Automatically download models from Hugging Face Hub.
- Default:
true - Type: Boolean
- Example:
MODEL_AUTO_DOWNLOAD=false
MAX_MODEL_SIZE_GB
Maximum allowed model size in gigabytes.
- Default: Varies by plan tier
- Type: Integer
- Example:
MAX_MODEL_SIZE_GB=50
MODEL_QUANTIZATION
Default quantization mode for models.
- Default:
none - Type: String
- Options:
none,int8,int4,gptq,awq - Example:
MODEL_QUANTIZATION=int8
API Configuration
API_PORT
Port number for the API server.
- Default:
8000 - Type: Integer
- Range: 1024-65535
- Example:
API_PORT=9000
API_HOST
Host address to bind the API server.
- Default:
0.0.0.0 - Type: String (IP address)
- Example:
API_HOST=127.0.0.1
API_KEY_REQUIRED
Require API key for all requests.
- Default:
true - Type: Boolean
- Example:
API_KEY_REQUIRED=true
CORS_ORIGINS
Allowed CORS origins (comma-separated).
- Default:
* - Type: String
- Example:
CORS_ORIGINS=https://app.example.com,https://admin.example.com
RATE_LIMIT_REQUESTS
Maximum requests per minute per API key.
- Default:
100 - Type: Integer
- Example:
RATE_LIMIT_REQUESTS=500
Performance Tuning
BATCH_SIZE
Default batch size for inference.
- Default: Auto (optimized per plan tier)
- Type: Integer
- Range: 1-256
- Example:
BATCH_SIZE=32
GPU_MEMORY_FRACTION
Fraction of GPU memory to allocate.
- Default:
0.9 - Type: Float
- Range: 0.1-1.0
- Example:
GPU_MEMORY_FRACTION=0.8
ENABLE_FLASH_ATTENTION
Use Flash Attention for faster inference.
- Default:
true - Type: Boolean
- Example:
ENABLE_FLASH_ATTENTION=true
KV_CACHE_SIZE_GB
Size of key-value cache in gigabytes.
- Default: Auto (based on available VRAM)
- Type: Integer
- Example:
KV_CACHE_SIZE_GB=8
Training Configuration
TRAINING_ENABLED
Enable model training and fine-tuning features.
- Default:
true - Type: Boolean
- Example:
TRAINING_ENABLED=false
CHECKPOINT_INTERVAL
Save training checkpoints every N steps.
- Default:
1000 - Type: Integer
- Example:
CHECKPOINT_INTERVAL=500
GRADIENT_ACCUMULATION_STEPS
Number of steps to accumulate gradients.
- Default:
4 - Type: Integer
- Example:
GRADIENT_ACCUMULATION_STEPS=8
Custom Variables
You can define custom environment variables for your application:
# Application-specific variables
APP_NAME=my-llm-app
CUSTOM_API_ENDPOINT=https://api.example.com
FEATURE_FLAG_STREAMING=true
Access custom variables in your application code:
import os
app_name = os.getenv('APP_NAME', 'default-app')
api_endpoint = os.getenv('CUSTOM_API_ENDPOINT')
Variable Management Best Practices
Security
- Never commit secrets: Use the Achiral secrets management system for sensitive data
- Rotate regularly: Update API keys and tokens on a regular schedule
- Limit access: Restrict who can view and modify environment variables
Organization
- Use prefixes: Group related variables with prefixes (e.g.,
DB_,API_,CACHE_) - Document purpose: Add descriptions for custom variables in your documentation
- Version control: Track changes to environment variables in your deployment pipeline
Performance
- Cache frequently accessed values: Don't read environment variables in hot paths
- Validate on startup: Check required variables exist and have valid values at startup
- Use defaults wisely: Provide sensible defaults for optional configuration
Environment Variable Precedence
Variables are loaded in the following order (later sources override earlier ones):
- System defaults
- Plan-specific defaults
- Organization-level variables
- Chiro instance variables
- Runtime overrides (via API)
Viewing Current Variables
Via Dashboard
Navigate to Configuration → Environment Variables to view all active variables and their values.
Via API
curl https://api.achiral.ai/v1/organizations/{org_id}/env \
-H "Authorization: Bearer YOUR_API_KEY"
Deleting Variables
Via Dashboard
- Navigate to Configuration → Environment Variables
- Find the variable to delete
- Click the trash icon
- Confirm deletion
Via API
curl -X DELETE https://api.achiral.ai/v1/organizations/{org_id}/env/VARIABLE_NAME \
-H "Authorization: Bearer YOUR_API_KEY"
Next Steps
- Network Settings - Configure network access
- Storage Options - Manage persistent storage
- API Reference - Detailed API documentation