Skip to main content

Environment Setup

1. Store Your API Key Securely

Add to your shell configuration file:
Then reload:
Or use a .env file:

2. Install SDK

3. Configure Your Client

Project Setup

For New Projects

  1. Create project directory:
  2. Initialize project:
  3. Create .env file:
  4. Create first script: See First Request Guide

For Existing Projects

If you’re already using OpenAI or Anthropic:
  1. Update base URL:
  2. 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:
This sets up:
  • Claude Code
  • Codex/Windsurf
  • OpenCode
See CLI Documentation for details.

Verify Setup

Test your configuration:

Troubleshooting

Problem: Environment variable not setSolution:
  • Check variable name: MEGALLM_API_KEY
  • Reload shell: source ~/.bashrc
  • Verify: echo $MEGALLM_API_KEY
Problem: Invalid API keySolution:
  • Verify key starts with sk-mega-
  • Check for extra spaces
  • Generate new key at dashboard
Problem: Network or firewall issuesSolution:
  • Check internet connection
  • Verify firewall settings
  • Try without VPN
Problem: SDK not installedSolution:

Next Steps

First Request

Build your first AI application

Browse Models

Explore 70+ available models

API Reference

Complete API documentation

Best Practices

Tips and common questions