Files
litellm-android/README.md
T

67 lines
4.4 KiB
Markdown
Raw Normal View History

2026-11-19 11:23:59 +01:00
# LiteLLM Dashboard for Android
A native Android dashboard for a self-hosted LiteLLM proxy. Built with Kotlin and Jetpack Compose.
See [PROGRESS.md](PROGRESS.md) for completed work, remaining verification, and features not yet started.
## Features
- Connect with a proxy URL and bearer API key; the key is encrypted with Android Keystore and excluded from backups.
2026-11-19 11:43:36 +01:00
- Overview with total spend, request counts, a daily request chart, and recent requests.
2026-11-19 11:23:59 +01:00
- Searchable model, key, and team inventories with detail views. Key search filters the current page; use page navigation for larger installations.
- Recent spend logs with request details and page navigation.
- Create models, virtual keys, and teams when the connected key has permission. Newly generated virtual keys are shown once and are not saved by the app.
- Explicit loading, empty, authentication, permission, and network error states.
The app follows the proxy's permissions. An inference-only key may show models but cannot access admin sections. Use an admin key or a management key with appropriate read/write routes. LiteLLM's database-backed management APIs must be enabled for key and team features. Model creation requires `store_model_in_db` on the proxy.
## Build
Open the root folder in Android Studio, or run on Windows:
```powershell
./gradlew.bat :app:assembleDebug
adb install -r app/build/outputs/apk/debug/app-debug.apk
```
Requires JDK 17+, Android SDK platform 37, and an emulator/device running Android 8.0 or newer. The debug APK is at `app/build/outputs/apk/debug/app-debug.apk`.
2026-11-19 11:43:36 +01:00
### Signed release
On this Windows machine, run:
```powershell
.\tools\build_release.ps1
```
This builds a signed APK at `app/build/outputs/apk/release/app-release.apk` for direct installation and a signed Android App Bundle at `app/build/outputs/bundle/release/app-release.aab` for store upload. The release build uses code and resource shrinking and targets Android API 36. The APK was installed on the emulator and connected to the live LiteLLM server on 19 November 2026.
The script keeps the upload keystore at `%USERPROFILE%\.android\litellm-dashboard-upload.jks` and its Windows DPAPI-encrypted password at `%USERPROFILE%\.android\litellm-dashboard-upload.password.dpapi`, outside the repository. Back up the keystore and password in a secure location. The DPAPI file can be decrypted only by this Windows user account on this machine; to record the password in a password manager, run `.\tools\build_release.ps1 -ShowSigningPassword` locally and clear the terminal afterward. Keep the key and password for all future updates to this package. The first release run creates the key if neither file exists; later runs reuse it.
To install the release APK on a device that has the debug build, uninstall the debug app first because its signing key differs. Uninstalling removes the app's saved connection. The package name is `dev.alvin.litellmdashboard`, with version `1.0.0` (`versionCode` 1).
2026-11-19 11:23:59 +01:00
## Connect
Enter the proxy base URL, for example `https://litellm.example.com`. Public addresses must use HTTPS. HTTP is accepted only for localhost, Android emulator host `10.0.2.2`, and private LAN addresses. Do not append `/ui` or an endpoint path. For a local proxy on the host, use `http://10.0.2.2:4000` from the standard Android emulator.
The app sends the key only in the `Authorization: Bearer` header. Disconnecting removes the stored connection. LiteLLM versions and deployment settings vary, so unsupported or forbidden endpoints appear as section-specific errors.
2026-11-19 11:43:36 +01:00
The overview uses `/global/spend`, `/global/activity`, and `/gateway/daily/activity`. The activity call includes dates because some LiteLLM versions require them. The request chart works without the Enterprise-only `/global/spend/report` endpoint.
2026-11-19 11:23:59 +01:00
## Local emulator fixture
The fixture in `tools/mock_proxy.py` exercises the app without a real LiteLLM deployment:
```powershell
python tools/mock_proxy.py
adb reverse tcp:8765 tcp:8765
```
Connect to `http://127.0.0.1:8765` with `sk-demo`. The fixture includes models, spend, keys, teams, logs, and creation responses. It is for development only.
## Sources
- [LiteLLM proxy API reference](https://docs.litellm.ai/api-reference)
- [LiteLLM spend tracking](https://docs.litellm.ai/docs/proxy/cost_tracking)
- [LiteLLM model management](https://docs.litellm.ai/docs/proxy/model_management)
- [Android Compose BOM](https://developer.android.com/develop/ui/compose/bom)