LattifAI SDK

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

  1. Go to lattifai.com/dashboard/api-keys
  2. Sign in or create an account
  3. Click "Create API Key"
  4. 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_here

Option 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

  1. Go to aistudio.google.com/apikey
  2. Sign in with your Google account
  3. Click "Create API Key"
  4. Select a project (or create a new one)
  5. 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=AIzaSyxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Or 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.local

Usage Limits

PlanAlignment MinutesSTT Minutes
Free60 min/month-
Pro600 min/month600 min/month
Team2,400 min/month2,400 min/month
Business12,000 min/month12,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).

On this page