Hey everyone
,
I’m Abishake, and in this post, I’ll walk you through how to get started with Alith.
Alright, before we jump into building something cool, let’s first get the basics right.
We’re going to cover a few simple but important steps — all hands-on!
Here’s what we’ll do together ![]()
- Get your free Groq API key
- Set up your Python environment
- Install Alith
- Configure your API key securely
- Write a sample Python code using Alith
- And finally… run it live!
Step 1: Get Your Free Groq API Key
To make Alith talk with AI models, we need an API key — and Groq gives one for free
Here’s how to get it in less than a minute:
- Go to Groq
- Sign up or log in
- Head over to API Keys → Generate New Key
- Copy it safely — we’ll use it soon!
Tip: Don’t share your API key publicly — it’s like your personal password for AI access.
Step 2: Set Up Your Python Environment
Let’s set up a clean space to code, so things don’t get messy.
First, create a new folder for your project:
mkdir alith-demo && cd alith-demo
Now, create and activate a virtual environment:
#To double-check Python is ready:
python --version #If you see Python 3.8+, you’re good to go
#Windows
python -m venv venv
venv\Scripts\activate
#Mac/Linux
python3 -m venv venv
source venv/bin/activate
Step 3: Install Alith SDK
Now the fun part — let’s bring Alith into our project.
Run this command:
pip install alith -U
That’s it! You’ve just installed the Alith framework in Python.
Step 4: Configure Your API Key
Time to tell Alith which API key to use.
You can set it as an environment variable to keep it safe.
#Mac/Linux:
export GROQ_API_KEY='your-api-key-here'
#Windows:
set GROQ_API_KEY "your-api-key-here"
Or even better — use a .env file for simplicity.
Inside .env, just add:
GROQ_API_KEY=your-api-key-here
Step 5: Write a Simple Alith Example
Let’s make Alith do something — like tell us a joke
Create a new file called alith_joke.py and paste this code:
from alith import Agent
import os
from dotenv import load_dotenv
load_dotenv()
api_key = os.getenv("GROQ_API_KEY")
agent = Agent(
model="llama3-70b-8192",
api_key=api_key,
base_url="https://api.groq.com/openai/v1",
preamble="You are a funny comedian who entertains the user."
)
response = agent.prompt("Tell me a joke about coding.")
print(response)
This little script connects to Groq through Alith and gets a fun AI-generated response!
Step 6: Run the Code
Now, you can run the Python file using this command :
#Windows
python alith_joke.py
#Mac/Linux:
python3 alith_joke.py
If everything’s set up right, Alith will reply with a joke like:
“Why do Python developers prefer dark mode? Because light attracts bugs!
”
Yeah, you successfully ran the Alith agent using a free api key