Skip to main content

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:

Required Services

Optional Services

New to backend development? Install Homebrew (macOS/Linux) or Chocolatey (Windows) first - they make installing tools much easier.

1. Google Cloud & Firebase Setup

Install Google Cloud SDK

Enable Required APIs

Go to the Google Cloud Console and enable these APIs:

Cloud Resource Manager API

Required for project management

Firebase Management API

Required for Firebase integration

Authenticate with Google Cloud

Run these commands in your terminal, replacing <project-id> with your Google Cloud project ID:
This generates credentials at ~/.config/gcloud/application_default_credentials.json.

Copy Credentials to Backend


2. OAuth Authentication Setup

OAuth is required for user authentication. You need to configure both Google and Apple sign-in.
1

Create OAuth 2.0 Client

  1. Go to Google Cloud Console → Credentials
  2. Click Create CredentialsOAuth 2.0 Client ID
  3. Select Web application as the application type
  4. 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/google
  • https://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

The backend Docker images run Python 3.11, so use Python 3.11 locally as well. If your package manager installs a newer default Python, install or select Python 3.11 before creating the virtual environment.

Set Up Python Virtual Environment

The backend uses uv, .python-version, and pylock.toml for reproducible local and CI installs.
You should see (.venv) at the beginning of your command prompt.

Update Python Dependencies

When intentionally changing backend dependencies, edit the relevant requirements*.txt input, then refresh the locks:
The refresh preserves already-locked package versions by default. Use PYLOCK_UPGRADE=1 ./scripts/update-python-lock.sh only when intentionally upgrading dependency versions.

Create Environment File

Edit .env and fill in your API keys (see Environment Variables below).

4. Optional Services

Skip this if you don’t need webhook functionality.
Edit the .env file and set SERVICE_ACCOUNT_JSON to your Google credentials string.Start the service:
Optionally expose via Ngrok for external access.
Skip this if you don’t need search functionality.
  1. Create an account on Typesense
  2. Create a collection named conversations using the schema in typesense/conversations.schema
  3. Install the Firebase Typesense extension
Configuration for the extension:
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.
  1. Sign up at ngrok.com and install Ngrok
  2. Authenticate with your account
  3. Start the tunnel:
Note the public URL (e.g., https://your-domain.ngrok-free.app).

Start the Backend Server

Connect the Omi App

In your Omi app’s .dev.env file, set:
Don’t forget the trailing / in the URL!
Make sure your OAuth redirect URIs in Google Cloud Console and Apple Developer Console include your Ngrok URL.

When You're Done

Deactivate the virtual environment:
To resume later, just activate the virtual environment again.

Troubleshooting

Add this to utils/stt/vad.py:
  • Double-check all API keys in your .env file
  • Ensure there are no trailing spaces or quotes around values
  • Verify keys are active and not expired
  • 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
Try reinstalling dependencies:
  • On Windows, you may need to enable script execution: Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
  • Make sure you’re using Python 3.11

Environment Variables

Complete reference for all .env variables:
.env.template intentionally leaves ENCRYPTION_SECRET blank. Generate a unique securely managed value of at least 32 bytes for every real environment.

Code Formatting

We use black for code formatting with a line length of 120 characters.
To auto-format on commit, install the pre-commit hook from the repository root:

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

Need Help?

GitHub Issues

Report bugs or request features

Discord Community

Get help from the community