Skip to main content

Authentication Methods

Bearer Token

The most common authentication method is using a Bearer token in the Authorization header:

API Key Header (Anthropic Format)

For Anthropic-compatible endpoints, you can also use the x-api-key header:

Getting Your API Key

1

Dashboard Method

The recommended method for obtaining an API key is through the MegaLLM dashboard:
  1. Visit megallm.io/dashboard
  2. Navigate to API Keys section
  3. Click “Create New API Key”
  4. Copy the key (starts with sk-mega-) and store it securely
2

CLI Tool

If you have the MegaLLM CLI installed:
Follow the interactive prompts to set up your API key.

Security Best Practices

Never expose your tokens: Always store tokens in environment variables or secure vaults, never in code.

Environment Variables

Using SDKs

OpenAI SDK

Anthropic SDK

LangChain Integration

Troubleshooting

Common Authentication Errors

Debugging Authentication

Enable debug mode to see detailed authentication information:
Need Help? Check our FAQ or contact support if you’re experiencing authentication issues.