You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. Anthropic API key leaked via /api-keys endpoint
Endpoint: GET /v1/config/api-keys in desktop/Backend-Rust/src/routes/config.rs (line 36)
Response: Returns anthropic_api_key, firebase_api_key, google_calendar_api_key as JSON
Source env var: ANTHROPIC_API_KEY loaded from env in Backend-Rust/src/config.rs (line 134)
Flow: Rust backend reads ANTHROPIC_API_KEY → returns via HTTP → APIKeyService.swift stores it → sets in process env via setenv("ANTHROPIC_API_KEY", key, 1) (line 156) → ACP bridge subprocess inherits it
The same ANTHROPIC_API_KEY env var is also used by the Rust backend's own /v2/chat/completions proxy (Backend-Rust/src/routes/chat_completions.rs, line 462)
Pi-mono adapter correctly scrubs ANTHROPIC_API_KEY from its subprocess env (acp-bridge/src/adapters/pi-mono.ts, line 243), but the key still transits through the Swift app process and ACP bridge
2. Harness switching requires app restart
Settings UI picker in SettingsPage.swift (lines 2310-2372, 3130-3195): Picker with "Omi AI".tag("piMono") and "Your Claude Account".tag("claudeCode")
switchBridgeMode() in ChatProvider.swift (lines 818-843) stops and restarts the bridge subprocess
Despite the programmatic restart, the switch does not take effect without a full app restart in practice
"Omi AI" (default) routes ALL LLM calls through api.omi.me for server-side cost control
"Claude Account" uses ACP with user's own OAuth — no Omi key involved
The Omi API key should never leave the server; the client authenticates via Firebase token only
Current state diverges:
ANTHROPIC_API_KEY is returned to the client via /api-keys and injected into subprocess env
ACP "Mode A" passes the Omi Anthropic key directly to the ACP subprocess (bypasses api.omi.me proxy)
No separation between "legacy key for ACP passthrough" and "backend-only key for completion proxy"
What needs to change
Stop returning ANTHROPIC_API_KEY from /v1/config/api-keys to clients. Rename the current env var as a legacy identifier. Create a separate backend-only key for /v2/chat/completions.
Fix harness hot-reload so switching between Omi AI and Claude Account takes effect without restarting the app.
Add pi-mono / Omi attribution (logo) when "Omi AI" is active. Ensure Omi credit tracking is preserved.
Current State (Facts)
1. Anthropic API key leaked via
/api-keysendpointGET /v1/config/api-keysindesktop/Backend-Rust/src/routes/config.rs(line 36)anthropic_api_key,firebase_api_key,google_calendar_api_keyas JSONANTHROPIC_API_KEYloaded from env inBackend-Rust/src/config.rs(line 134)ANTHROPIC_API_KEY→ returns via HTTP →APIKeyService.swiftstores it → sets in process env viasetenv("ANTHROPIC_API_KEY", key, 1)(line 156) → ACP bridge subprocess inherits itANTHROPIC_API_KEYenv var is also used by the Rust backend's own/v2/chat/completionsproxy (Backend-Rust/src/routes/chat_completions.rs, line 462)ANTHROPIC_API_KEYfrom its subprocess env (acp-bridge/src/adapters/pi-mono.ts, line 243), but the key still transits through the Swift app process and ACP bridge2. Harness switching requires app restart
SettingsPage.swift(lines 2310-2372, 3130-3195):Pickerwith"Omi AI".tag("piMono")and"Your Claude Account".tag("claudeCode")switchBridgeMode()inChatProvider.swift(lines 818-843) stops and restarts the bridge subprocessBridgeModeenum values:.omiAI = "agentSDK"(legacy, auto-migrated),.userClaude = "claudeCode",.piMono = "piMono"(default)3. No provider attribution/branding in UI
4. Omi credit handling exists but is client-side only
@AppStorage("omiAICumulativeCostUsd")inChatProvider.swift(line 536) tracks cumulative costChatPage.swift, lines 207-219)queryResult.costUsdreturned by pi-mono adapter viaPiUsage.cost5. Current env var naming
ANTHROPIC_API_KEYOMI_API_KEYOMI_API_KEYin subprocess)OMI_AUTH_TOKENOMI_API_BASE_URL/v2/chat/completions6. Architecture gap vs #6594
Issue #6594 defines the target architecture:
api.omi.mefor server-side cost controlCurrent state diverges:
ANTHROPIC_API_KEYis returned to the client via/api-keysand injected into subprocess envWhat needs to change
ANTHROPIC_API_KEYfrom/v1/config/api-keysto clients. Rename the current env var as a legacy identifier. Create a separate backend-only key for/v2/chat/completions.Ref: #6594