Authentication
Get your API keys for LattifAI SDK
Authentication
LattifAI requires an API key for alignment operations. Optionally, you can use a Gemini API key for transcription.
LattifAI API Key (Required)
The LattifAI API key is required for all alignment operations.
Get Your Free API Key
- Go to lattifai.com/dashboard/api-keys
- Sign in or create an account
- Click "Create API Key"
- Copy your API key (starts with
lf_)
Configure the API Key
Option A: Environment Variable (Recommended)
export LATTIFAI_API_KEY="lf_your_api_key_here"Option B: .env File
Create a .env file in your project root:
LATTIFAI_API_KEY=lf_your_api_key_hereOption C: Pass Directly in Code
from lattifai import LattifAI, ClientConfig
client = LattifAI(
client_config=ClientConfig(api_key="lf_your_api_key_here")
)Gemini API Key (Optional)
The Gemini API key is only required if you want to use Gemini models for transcription (e.g., gemini-2.5-pro).
Get Your Free Gemini API Key
- Go to aistudio.google.com/apikey
- Sign in with your Google account
- Click "Create API Key"
- Select a project (or create a new one)
- Copy your API key (starts with
AIzaSy)
Configure the Gemini API Key
Environment Variable:
export GEMINI_API_KEY="AIzaSyxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"Or in .env file:
GEMINI_API_KEY=AIzaSyxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxOr pass directly:
from lattifai import LattifAI, TranscriptionConfig
client = LattifAI(
transcription_config=TranscriptionConfig(
model_name="gemini-2.5-pro",
gemini_api_key="AIzaSyxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
)
)API Key Security
Never commit API keys to version control. Add .env to your .gitignore file.
# .gitignore
.env
.env.localUsage Limits
| Plan | Alignment Minutes | STT Minutes |
|---|---|---|
| Free | 60 min/month | - |
| Pro | 600 min/month | 600 min/month |
| Team | 2,400 min/month | 2,400 min/month |
| Business | 12,000 min/month | 12,000 min/month |
Check your usage at lattifai.com/dashboard.
Troubleshooting
"Invalid API Key" Error
- Ensure your API key starts with
lf_ - Check for extra spaces or newlines
- Verify the key is active in your dashboard
"Rate Limit Exceeded" Error
- Wait a few seconds and retry
- Upgrade your plan for higher limits
- Implement exponential backoff in your code
Environment Variable Not Found
Make sure you've exported the variable in your current shell:
# Check if set
echo $LATTIFAI_API_KEY
# Set it again if needed
export LATTIFAI_API_KEY="lf_your_api_key_here"For .env files, ensure you're using a library that loads them (like python-dotenv).