Introduction
Mistral AI recently launched their Hobbyist tier, offering free access to their powerful language models. In this guide, I'll show you how to get your API key and start building with Mistral AI.
Step-by-Step Guide
-
1. Visit the Mistral Platform
-
2. Create Your Account
Click on "Sign Up" and fill in your details:
- Email address
- Password
- Name
-
3. Verify Your Email
Check your inbox for a verification email from Mistral AI and click the verification link.
-
4. Access the API Section
After logging in, navigate to the "API Keys" section in your dashboard.
-
5. Generate Your API Key
Click "Create New Key" and save your API key securely - you won't be able to see it again!
Free Tier Features
- Access to mistral-tiny model
- 5,000 requests per month
- No credit card required
- Rate limit: 5 requests per minute
Quick Start Example
Here's a simple Python script to test your API key:
import requests
API_KEY = "your_api_key_here"
API_URL = "https://api.mistral.ai/v1/chat/completions"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
data = {
"model": "mistral-tiny",
"messages": [
{"role": "user", "content": "What are the main features of Python?"}
]
}
response = requests.post(API_URL, headers=headers, json=data)
print(response.json()["choices"][0]["message"]["content"])
Best Practices
- Store your API key securely using environment variables
- Implement rate limiting in your application
- Monitor your usage through the Mistral dashboard
- Handle API errors gracefully
Conclusion
With your free Mistral AI API key, you can start building applications powered by state-of-the-art language models. The Hobbyist tier is perfect for learning, prototyping, and small projects.
Note: The free tier limits and features mentioned in this article are current as of March 2024. Check the official Mistral AI documentation for the most up-to-date information.