Overview
The Omi backend powers all AI capabilities including transcription, conversation processing, chat, and integrations. This guide will help you set up a local development environment.If you just want to build apps or test features, you can use Omi’s development backend instead. See the App Setup Guide for the automatic setup option.
Video Walkthrough
Prerequisites
Before starting, gather these API keys and credentials:1. Google Cloud & Firebase Setup
Install Google Cloud SDK
- macOS
- Windows
- Linux/Nix
Enable Required APIs
Authenticate with Google Cloud
Run these commands in your terminal, replacing This generates credentials at
<project-id> with your Google Cloud project ID:~/.config/gcloud/application_default_credentials.json.Copy Credentials to Backend
- macOS/Linux
- Windows
2. OAuth Authentication Setup
OAuth is required for user authentication. You need to configure both Google and Apple sign-in.- Google OAuth
- Apple OAuth
1
Create OAuth 2.0 Client
- Go to Google Cloud Console → Credentials
- Click Create Credentials → OAuth 2.0 Client ID
- Select Web application as the application type
- Set a name (e.g., “Omi Backend Auth”)
2
Configure Authorized Origins
Under Authorized JavaScript origins, add:
https://your-domain.com(production)https://your-ngrok-domain.ngrok-free.app(local development)
3
Configure Redirect URIs
Under Authorized redirect URIs, add:
https://your-domain.com/v1/auth/callback/googlehttps://your-ngrok-domain.ngrok-free.app/v1/auth/callback/google
4
Save Credentials
Click Create and save your Client ID and Client Secret for the
.env file.5
Configure Consent Screen
Go to APIs & Services → OAuth consent screen:
- Fill in required app information
- Add your domain to Authorized domains
- Add scopes:
openid,email,profile
3. Backend Installation
Clone the Repository
Install System Dependencies
- macOS
- Windows
- Linux/Nix
Set Up Python Virtual Environment
- macOS/Linux
- Windows
(venv) at the beginning of your command prompt.Install Python Dependencies
Create Environment File
.env and fill in your API keys (see Environment Variables below).4. Optional Services
Pusher Service (for webhooks)
Pusher Service (for webhooks)
Skip this if you don’t need webhook functionality.Edit the Optionally expose via Ngrok for external access.
.env file and set SERVICE_ACCOUNT_JSON to your Google credentials string.Start the service:Typesense (for search)
Typesense (for search)
Skip this if you don’t need search functionality.
- Create an account on Typesense
- Create a collection named
conversationsusing the schema intypesense/conversations.schema - Install the Firebase Typesense extension
| Setting | Value |
|---|---|
| Firestore Collection Path | users/{userId}/conversations |
| Firestore Collection Fields | structured,created_at,discarded,started_at,id,finished_at,geolocation,userId |
If you have existing data, create a
typesense_sync collection and add a document named backfill with {'trigger': true}.5. Running the Backend
Set Up Ngrok Tunnel
Ngrok exposes your local backend to the internet so the Omi app can connect.Note the public URL (e.g.,
- Sign up at ngrok.com and install Ngrok
- Authenticate with your account
- Start the tunnel:
https://your-domain.ngrok-free.app).Start the Backend Server
| Flag | Purpose |
|---|---|
--reload | Auto-restart on code changes |
--env-file .env | Load environment variables |
--host 0.0.0.0 | Listen on all interfaces (optional) |
--port 8000 | Port to listen on |
Connect the Omi App
In your Omi app’s Make sure your OAuth redirect URIs in Google Cloud Console and Apple Developer Console include your Ngrok URL.
.dev.env file, set:When You're Done
Deactivate the virtual environment:To resume later, just activate the virtual environment again.
Troubleshooting
SSL certificate errors during model downloads
SSL certificate errors during model downloads
Add this to
utils/stt/vad.py:API key issues
API key issues
- Double-check all API keys in your
.envfile - Ensure there are no trailing spaces or quotes around values
- Verify keys are active and not expired
Ngrok connection issues
Ngrok connection issues
- Ensure your Ngrok tunnel is running
- Verify the URL is correctly set in the Omi app
- Check that OAuth redirect URIs match your Ngrok URL
Module not found errors
Module not found errors
Try reinstalling dependencies:
Virtual environment not activating
Virtual environment not activating
- On Windows, you may need to enable script execution:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser - Make sure you’re using Python 3.9-3.12
Environment Variables
Complete reference for all.env variables:
- Required
- OAuth
- Storage
- Optional
| Variable | Description |
|---|---|
OPENAI_API_KEY | OpenAI API key for AI models |
DEEPGRAM_API_KEY | Deepgram API key for transcription |
HUGGINGFACE_TOKEN | Hugging Face token for voice detection models |
REDIS_DB_HOST | Redis host address |
REDIS_DB_PORT | Redis port number |
REDIS_DB_PASSWORD | Redis password (blank if none) |
PINECONE_API_KEY | Pinecone API key for vector database |
PINECONE_INDEX_NAME | Name of your Pinecone index |
GOOGLE_APPLICATION_CREDENTIALS | Path to google-credentials.json |
ADMIN_KEY | Temporary key for local dev (e.g., 123) |
ENCRYPTION_SECRET | At least 32 bytes for encrypting user data |
Code Formatting
We useblack for code formatting with a line length of 120 characters.
Related Documentation
App Setup
Set up the Flutter app for development
Backend Deep Dive
Understand the backend architecture
Chat System
Learn how the chat feature works
Storing Conversations
How conversations and memories are stored