Setup
Configure your environment and API keys for Aparture.
Environment Variables
Aparture uses a .env.local file to store sensitive configuration like API keys and passwords.
Create .env.local
Create a .env.local file in the project root:
touch .env.local # Linux/Mac
type nul > .env.local # WindowsRequired Variables
Add the following to .env.local:
# Application Password (required)
ACCESS_PASSWORD=your-secure-password-here
# API Keys (at least one required)
CLAUDE_API_KEY=sk-ant-api03-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
GOOGLE_AI_API_KEY=AIzaSyxxxxxxxxxxxxxxxxxxxxxxxxxxxxxSecurity
Never commit .env.local to git! It's already in .gitignore.
API Keys
You need at least one API key to use Aparture. Having multiple providers gives you flexibility in model selection.
Anthropic (Claude)
Get your key:
- Visit console.anthropic.com
- Sign up or log in
- Navigate to "API Keys"
- Click "Create Key"
- Copy the key (starts with
sk-ant-)
Models available: Claude Haiku 4.5, Sonnet 4.5, Opus 4.1
See Model Selection → for detailed pricing and comparisons.
OpenAI (ChatGPT)
Get your key:
- Visit platform.openai.com
- Sign up or log in
- Navigate to "API Keys"
- Click "Create new secret key"
- Copy the key (starts with
sk-)
Models available: GPT-5, Mini, Nano
See Model Selection → for detailed pricing and comparisons.
Rate Limits
OpenAI has tier-based rate limits. Start with Tier 1 and upgrade as needed.
Google (Gemini)
Get your key:
- Visit aistudio.google.com/apikey
- Sign in with Google
- Click "Create API Key"
- Copy the key (starts with
AIzaSy)
Models available: Gemini 2.5 Pro, Flash, Flash-Lite
See Model Selection → for detailed pricing and comparisons.
Free Tier
Google's Gemini models offer a generous free tier, making them great for getting started.
Access Password
The ACCESS_PASSWORD protects your web interface from unauthorized access.
Requirements:
- Minimum 8 characters
- Mix of letters, numbers, and symbols recommended
- Don't reuse passwords from other services
Example:
ACCESS_PASSWORD=MySecureP@ssw0rdThis password is required every time you access the web interface.
Verify Setup
Test that your environment is configured correctly:
1. Check .env.local exists
ls -la .env.local # Linux/Mac
dir .env.local # Windows2. Start the development server
npm run dev3. Access the application
Open http://localhost:3000 in your browser.
4. Test authentication
- Enter your
ACCESS_PASSWORD - You should see the main application interface
- Check the model dropdowns show your available providers
Testing API Keys
The application will show which models are available based on your configured API keys. If a provider's models don't appear, check that API key.
Optional Configuration
Port Configuration
Change the development server port with an environment variable:
PORT=3001 npm run devOr add to .env.local:
PORT=3001Node Environment
Set the environment mode:
NODE_ENV=development # or productionSecurity Best Practices
Protect Your Keys
- Never commit
.env.local- Already in.gitignore - Use environment variables in production - Don't hardcode keys
- Rotate keys periodically - Every 3-6 months
- Use different keys for dev/prod - Separate environments
- Monitor usage dashboards - Watch for unexpected usage
Monitor Spending
Set up billing alerts in each provider:
Anthropic:
- Console → Settings → Usage
- Set monthly budget limits
OpenAI:
- Platform → Usage → Limits
- Set hard and soft limits
Google:
- AI Studio → Quota
- Monitor daily/monthly limits
Rate Limit Best Practices
- Start with small batch sizes
- Increase gradually as needed
- Monitor rate limit errors
- Consider multiple API keys for high volume
Troubleshooting
API Key Not Working
Check:
- Key copied correctly (no extra spaces)
- Key is active in provider dashboard
- Account has available credits
- Correct environment variable name
Test directly:
# Test Claude key (example using Haiku)
curl https://api.anthropic.com/v1/messages \
-H "x-api-key: $CLAUDE_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{"model": "claude-haiku-4-5-20251001", "max_tokens": 10, "messages": [{"role": "user", "content": "Hi"}]}'Environment Variables Not Loading
Next.js requires restart:
# Stop the server (Ctrl+C)
# Start again
npm run devCheck .env.local location:
- Must be in project root (same level as
package.json) - File name is
.env.localnotenv.local
Models Not Appearing in Dropdowns
If certain provider's models don't appear:
- Verify API key is set - Check
.env.localfor the correct variable name - Restart development server - Stop with Ctrl+C, then
npm run dev - Check browser console - Press F12 and look for API authentication errors
- Verify account status - Ensure your API account is active with available credits
Next Steps
Now that your environment is configured: