π― What We will be doing
We explored Frontier LLMs through their chat interfaces and got our first taste of the OpenAI API. Lets now go further:
β
Connecting to multiple AI providers via APIs
β
Understanding API abstraction layers and routers
β
Building apps that talk to multiple models
β
Eventually, making models talk to each other
π Today's Mission
We're now going to try asking a bunch of models some questions!
This is totally optional. If you have keys to Anthropic, Gemini or others, then you can add them in.
If you'd rather not spend the extra, then Just you your existing OpenAi key
For OpenAI, visit https://openai.com/api/
For Anthropic, visit https://console.anthropic.com/
For Google, visit https://aistudio.google.com/
For DeepSeek, visit https://platform.deepseek.com/
For Groq, visit https://console.groq.com/
For Grok, visit https://console.x.ai/
For most providers, you'll need to do two things: visit their billing page to add a minimum top-up, then head to their API keys page to generate and copy your key.
π‘ Gemini, Groq, and OpenRouter may offer free tiers β so you might not need to add billing at all for those.
π€ Do You Need All These API Keys?
No. Pick whichever option works for you:
Option | What You Need |
|---|---|
π₯ Minimal | Just OpenAI (already set up from Week 1) |
π Local | Ollama β no API costs at all |
πͺ Budget-friendly | OpenRouter β one key for many models |
π Full setup | Individual keys for each provider |
π§ Why Bother with Multiple APIs?
In real-world AI engineering, you'll regularly need to:
π Pick the best model for a task
πΈ Route to the cheapest option
β‘ Prioritize the fastest response
π Switch models dynamically without rewriting code
Different providers genuinely excel at different things β knowing your way around more than one is a valuable skill.
π Provider Quick Reference
Provider | Model Family | Notable For | Free Tier? |
|---|---|---|---|
GPT, o-series | Reasoning, vision | β | |
Claude | Long context, coding, writing | β | |
Gemini | Multimodal | β | |
DeepSeek | Coding, low cost | Small top-up | |
Open-source models | Ultra-fast inference | β | |
Grok | X ecosystem integration | Varies |
β οΈ Groq β Grok β Groq is a fast inference platform. Grok is xAI's model. Easy to mix up!
π OpenRouter β One Key to Rule Them All
openrouter.ai is a unified gateway that sits in front of all major providers:
Your App
β
βΌ
OpenRouter
ββββΆ GPT
ββββΆ Claude
ββββΆ Gemini
ββββΆ DeepSeek
ββββΆ Many more...
Benefits:
π§Ύ Single billing account
π One API key
π Switch models by changing just the model name
π§ͺ Great for rapid prototyping and comparison
π Storing API Keys Safely
β Never do this:
api_key = "sk-my-secret-key"β
Always use a .env file:
OPENAI_API_KEY=xxxx
ANTHROPIC_API_KEY=xxxx
GOOGLE_API_KEY=xxxx
DEEPSEEK_API_KEY=xxxx
GROQ_API_KEY=xxxx
GROK_API_KEY=xxxx
OPENROUTER_API_KEY=xxxx