Environment variables always take precedence over TUI configuration stored in
~/.pensar/config.json.AI Provider Configuration
Anthropic (Claude)
OpenAI
OpenRouter
AWS Bedrock
Bearer Token Authentication
Bearer token for Bedrock API access.
IAM Credentials Authentication
AWS access key ID for IAM authentication.
AWS secret access key for IAM authentication.
AWS session token for temporary credentials (optional).Required only when using temporary credentials from AWS STS.
AWS region for Bedrock API.Common regions:
us-east-1, us-west-2, eu-west-1.Local Models (vLLM)
vLLM server endpoint URL.Must point to an OpenAI-compatible API endpoint.
Remote Execution Providers
Daytona API key for remote agent execution.
Daytona organization ID.
Runloop API key for remote execution.
Debugging and Development
Enable debug logging.Outputs detailed agent execution logs to console.
Show console output in TUI development mode.Used only for TUI development.
CI/CD Configuration
GitHub Actions
Store API keys as repository secrets:.github/workflows/pentest.yml
GitLab CI
.gitlab-ci.yml
Docker
Pass environment variables to the container:.env file:
.env
Configuration Priority
When multiple configuration sources are present, Pensar Apex uses this priority order (highest to lowest):- Environment variables (highest priority)
- Command-line flags (e.g.,
--model) ~/.pensar/config.json(TUI settings)- Default values (lowest priority)
Example
Security Best Practices
Never commit API keys to version control
Never commit API keys to version control
Use Use secret management in CI/CD instead of hardcoding keys.
.gitignore to exclude environment files:.gitignore
Use separate keys for different environments
Use separate keys for different environments
Rotate API keys regularly
Rotate API keys regularly
Use IAM roles instead of static credentials (AWS)
Use IAM roles instead of static credentials (AWS)
For EC2, ECS, or Lambda deployments:Attach an IAM role with
bedrock:InvokeModel permission.Encrypt environment files
Encrypt environment files
If you must store Better: Use a secrets manager (AWS Secrets Manager, HashiCorp Vault, etc.).
.env files locally:Common Patterns
Per-Project Configuration
Create a.env file per project:
my-project/.env
Multi-Provider Setup
Configure all providers for fallback:Testing with Different Models
Environment Variable Files
Loading with source
Loading with dotenv (Node.js)
For programmatic usage:
Troubleshooting
Environment variable not recognized
Environment variable not recognized
Verify the variable is exported:Variables must be
exported to be visible to child processes.API key works in shell but not in TUI
API key works in shell but not in TUI
Ensure the variable is exported before launching the TUI:
Variables not persisting across sessions
Variables not persisting across sessions
Add exports to your shell profile:Better: Use a secrets manager or environment manager like
direnv.AWS credentials not working
AWS credentials not working
For IAM credentials, verify all required variables:If AWS CLI works but Pensar doesn’t, check that credentials have
bedrock:InvokeModel permission.Quick Reference
| Variable | Required | Description |
|---|---|---|
ANTHROPIC_API_KEY | Yes* | Anthropic API key (recommended) |
OPENAI_API_KEY | Yes* | OpenAI API key |
OPENROUTER_API_KEY | Yes* | OpenRouter API key |
BEDROCK_API_KEY | Yes* | AWS Bedrock bearer token |
AWS_ACCESS_KEY_ID | Yes* | AWS IAM access key |
AWS_SECRET_ACCESS_KEY | Yes* | AWS IAM secret key |
AWS_SESSION_TOKEN | No | AWS temporary session token |
AWS_REGION | No | AWS region (default: us-east-1) |
LOCAL_MODEL_URL | Yes* | vLLM server endpoint |
PENSAR_DEBUG | No | Enable debug logging |
Next Steps
AI Providers
Learn about each supported provider
Model Selection
Choose the right model for your needs
Docker Setup
Use environment variables in containers
Run Pentest
Start testing with your configuration

