Android LocalAI is an Android application that allows you to use generative AI models locally or remotely via APIs. This project is designed to be flexible, secure, and easy to configure.
- Use generative AI models locally (Edge AI) or via remote services (Google Generative AI API) This project uses the following libraries:
- Google Generative AI (
com.google.ai.client.generativeai) - Google AI Core (Edge AI) (
com.google.ai.edge.aicore)
- Modern user interface based on Jetpack Compose and Material 3
- Dependency injection with Koin
- Modular and testable architecture
- Jetpack Compose (Modern UI)
- Material 3 (Material Design)
- Koin (Dependency Injection)
- AndroidX (core-ktx, lifecycle, activity-compose, etc.)
- JUnit & Espresso (Testing)
- Android Studio (Giraffe or newer recommended)
- JDK 17+
- Internet connection on the device, for remote usage
To use Gemini Nano locally (Edge AI):
- Make sure your device supports Google AI Core. More information can be found in the Google AI Core documentation.
- No API key is required for local execution.
- Install the app on a compatible device.
- Go to Google AI Studio (here or here) to obtain an API key.
- Add the API key in build config field in
build.gradle.kts:buildConfigField( "String", "GEMINI_API_KEY", "\"<YOUR_KEY_HERE>\"" ) - The project will automatically read this key at runtime.
Note: Ensure that your API key is kept secure and not hard-coded in the source code. This method isn't secured.
- Never share your API key publicly or an APK with the remote Key to anyone.
- Use environment variables or
local.propertiesfor secrets.
This project is licensed under the MIT License. See the LICENSE file for more information.
