Skip to main content

1. Get Your API Key

1

Sign Up

Visit megallm.io/auth/signup and create an account
2

Navigate to Dashboard

3

Generate API Key

Click “Create New API Key” in the API Keys section
4

Copy Key

Copy your key (starts with sk-mega-) and save it securely
Keep your API key secret! Never commit it to version control or share it publicly.

2. Make Your First Request

Choose your preferred method:
  • Python
  • JavaScript
  • cURL
  • CLI
# Install OpenAI SDK
pip install openai
from openai import OpenAI

# Initialize client
client = OpenAI(
    base_url="https://ai.megallm.io/v1",
    api_key="your-megallm-api-key"  # Replace with your key
)

# Make a request
response = client.chat.completions.create(
    model="gpt-4",
    messages=[
        {"role": "user", "content": "Say hello!"}
    ]
)

print(response.choices[0].message.content)

3. Try Different Models

One of MegaLLM’s superpowers is instant model switching. Just change the model parameter:
# Try GPT-4
response = client.chat.completions.create(
    model="gpt-4",
    messages=[{"role": "user", "content": "Explain quantum computing"}]
)

# Switch to Claude
response = client.chat.completions.create(
    model="claude-opus-4-1-20250805",
    messages=[{"role": "user", "content": "Explain quantum computing"}]
)

# Try Gemini
response = client.chat.completions.create(
    model="gemini-2.5-pro",
    messages=[{"role": "user", "content": "Explain quantum computing"}]
)
Browse all available models at Models Catalog

What’s Next?

Common Questions

Start with gpt-4 for general use, claude-3.5-sonnet for long context, or gpt-3.5-turbo for speed and cost efficiency.See Models Catalog for detailed comparisons.
You pay only for what you use. Different models have different pricing. Most testing can be done for under $1.Check current pricing in your Dashboard.
Yes! Just change the base URL. All your existing code works without modification.
MegaLLM has automatic failover. If a model is unavailable, you can quickly switch to an alternative.

Need Help?