Ai Engineering Core / LLM Ecosystem & Integrations

Getting Frontier Model Apis

🎯 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?

OpenAI

GPT, o-series

Reasoning, vision

❌

Anthropic

Claude

Long context, coding, writing

❌

Google AI Studio

Gemini

Multimodal

βœ…

DeepSeek

DeepSeek

Coding, low cost

Small top-up

Groq

Open-source models

Ultra-fast inference

βœ…

xAI

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