Environment Setup
1. Store Your API Key Securely
- Linux/macOS
- Windows
- .env File
Add to your shell configuration file:Then reload:Or use a
.env file:2. Install SDK
- Python
- JavaScript/TypeScript
- Go
- Other Languages
3. Configure Your Client
- Python - OpenAI Format
- Python - Anthropic Format
- JavaScript - OpenAI Format
- JavaScript - Anthropic Format
Project Setup
For New Projects
-
Create project directory:
-
Initialize project:
-
Create .env file:
- Create first script: See First Request Guide
For Existing Projects
If you’re already using OpenAI or Anthropic:-
Update base URL:
- That’s it! All your existing code works.
IDE Setup
VS Code
Install recommended extensions:- Python extension (for Python)
- ESLint (for JavaScript)
- REST Client (for testing APIs)
PyCharm / IntelliJ
Configure environment variables in Run Configurations.AI Coding Assistants
MegaLLM provides a CLI to configure AI coding tools:- Claude Code
- Codex/Windsurf
- OpenCode
Verify Setup
Test your configuration:- Python
- JavaScript
- cURL
Troubleshooting
API key not found
API key not found
Problem: Environment variable not setSolution:
- Check variable name:
MEGALLM_API_KEY - Reload shell:
source ~/.bashrc - Verify:
echo $MEGALLM_API_KEY
Authentication failed (401)
Authentication failed (401)
Problem: Invalid API keySolution:
- Verify key starts with
sk-mega- - Check for extra spaces
- Generate new key at dashboard
Connection timeout
Connection timeout
Problem: Network or firewall issuesSolution:
- Check internet connection
- Verify firewall settings
- Try without VPN
Module not found
Module not found
Problem: SDK not installedSolution:

