diff --git a/app/src/main/res/layout-night/widget_opencode_go.xml b/app/src/main/res/layout-night/widget_opencode_go.xml index ded7774..43df9ea 100644 --- a/app/src/main/res/layout-night/widget_opencode_go.xml +++ b/app/src/main/res/layout-night/widget_opencode_go.xml @@ -64,6 +64,8 @@ android:id="@+id/widget_updated" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:maxLines="1" + android:ellipsize="end" android:text="--" android:textColor="#D4C4CC" android:textSize="10sp" /> @@ -96,7 +98,7 @@ android:id="@+id/widget_service_title" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="OpenCode Go · 用量" + android:text="@string/widget_title_opencode" android:textColor="#C4A0AB" android:textSize="11sp" /> @@ -109,7 +111,8 @@ android:gravity="center_vertical" android:layout_marginBottom="3dp"> + android:layout_width="60dp" android:layout_height="wrap_content" + android:maxLines="1" android:ellipsize="end" + android:text="@string/window_weekly" android:textColor="#C4A0AB" android:textSize="11sp" /> + android:layout_width="60dp" android:layout_height="wrap_content" + android:maxLines="1" android:ellipsize="end" + android:text="@string/window_monthly" android:textColor="#C4A0AB" android:textSize="11sp" /> diff --git a/app/src/main/res/layout/widget_opencode_go.xml b/app/src/main/res/layout/widget_opencode_go.xml index 4853a95..40f68f3 100644 --- a/app/src/main/res/layout/widget_opencode_go.xml +++ b/app/src/main/res/layout/widget_opencode_go.xml @@ -66,6 +66,8 @@ android:id="@+id/widget_updated" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:maxLines="1" + android:ellipsize="end" android:text="--" android:textColor="#C4A0AB" android:textSize="10sp" /> @@ -116,7 +118,8 @@ android:layout_marginBottom="3dp"> + + + AI Usage Panel + OpenCode Go usage + DeepSeek balance, auto-refresh + + + Back + Cancel + Add Widget + Got it + Refresh + Settings + Delete + Clear + Save + Go + ◀ Prev + Next ▶ + Add widget to home screen + View details + View usage details + Raw data + Sync usage data + I\'m logged in, save + Keep waiting + + + Loading… + Unknown error + All models + + + 👈 Select a service to view details + Tap a card on the left + Settings + Credentials + About RainyToken + Tips + Debug log + Usage details + Overview + Raw data + Charts + + + Not set up + Configured + Expired + Re-login + Refresh failed + No data + Pending + OK + Not set up · Tap to add + Configured · Valid + Expired · Tap to reconfigure + Needs re-verification + Manual entry mode + Credential set + No credential + Loading + Latest + Cached + Failed + Awaiting input + + + AI Balance Overview + Never fetched + Updated just now + Updated %1$d min ago + Updated %1$d h ago + Updated %1$s + 💡 Long-press a card to reorder + Stored locally & encrypted, nothing is uploaded + Add home screen widget? + This will ask the launcher to add the RainyToken widget. Some systems may still show their own confirmation dialog. + Shortcut permission denied. Please allow it in system settings and try again. + The launcher rejected the request. Please check launcher permissions. + This launcher does not support in-app adding. Long-press home → Widgets → find RainyToken. + + + Tap to configure credentials + Pull to refresh + Service currently unavailable + %1$s%2$s used this month + Remaining + · %1$s used / %2$s total + %1$s used + 5h used + · %1$s + Resets in %1$s + REST API · ¥ + WebView fetch · 5h quota + JSON API · $ + ChatGPT Plus · Codex quota + Cookie fetch · Cloud quota + + + d + h + m + + + 5 hours + 5h + 5h usage + 5-hour rolling + This week + This month + Monthly + Usage + Usage window%1$s + Usage window + + + OpenCode Usage + CommandCode Usage + %1$d records + Tap to sync + Input tokens + Output tokens + Reasoning tokens + Total cost + Cache read %1$s + Cache write %1$s + No data yet · tap 🔄 to sync + ✓ %1$d new records + tap to switch + All times in UTC+0 + Switched to UTC+8, charts shown in Beijing time + Switched to UTC+0, charts shown in UTC + $%1$s spent / $%2$s total + $%1$s remaining + Extra credits + By model + By day (UTC+0) + %1$d models + %1$d + Start time + End time + + + Spending (USD) + API requests + Token usage + Output + Input (miss) + Cache hit + + + Time + Model + Input(cache) + Output + Cost + + + All + Last 5 hours + Last 12 hours + Last 24 hours + Today + Yesterday + Last 7 days + Last 30 days + This month + Custom + Custom day + Custom month + Custom range + + + A tiny tool to check AI balances.\nCredentials are encrypted locally — nothing is uploaded. + View all %1$d hidden tips + Inspect token refresh, network requests and other debug records + + + ✓ Login state configured (%1$d cookies) + How to get the Cookie? + 1. Open the login page below in desktop Chrome + 2. Sign in with GitHub / Google (won\'t be blocked) + 3. After login, press F12 → Application → Cookies + 4. Copy all cookies of the site and paste them above + Format: name1=value1; name2=value2 + How to get OpenCode Go credentials? + 1. Open opencode.ai/auth in desktop Chrome + 2. Sign in with GitHub / Google (Google won\'t block Chrome) + 3. You\'ll land on the dashboard, URL looks like: + https://opencode.ai/workspace/{id}/go + 4. Copy the {id} segment → workspaceId + 5. F12 → Application → Cookies + 6. Find the cookie named auth under opencode.ai + 7. Copy its Value field → auth cookie + Note: only the auth cookie is needed, not the whole cookie string + How to get CommandCode Go credentials? + 1. Open https://commandcode.ai and sign in with GitHub + ▸ Get API Key (required): + Avatar (top right) → Settings → API Keys → Create a Key + ▸ Get all cookies (for usage records): + F12 → Application → Cookies → commandcode.ai + Select all cookies and copy the whole string + Paste it below — no need to pick them one by one + Tip: balance works without cookies, usage records will just be empty. + How to get Codex auth.json? + 1. Run codex-oauth-proxy or + codex-proxy in a terminal to sign in to ChatGPT + 2. The credential file is saved at: + + + Saved + Credentials saved + Connected! Balance: %1$s %2$s + Connected, credentials saved + API Key cannot be empty + Service rejected this credential (401/403) + Credentials changed during test + Too many requests (429) + Server error (%1$d) + Network error: %1$s + , previous credential restored + , credential changed, rollback skipped + Test failed. %1$s%2$s + Testing is not supported for this service + Both auth cookie and workspaceId are required + Cookie cannot be empty + Credential not configured + Credential missing or expired + Credential invalid, please reconfigure in Settings + Credential invalid, please log in again + Credentials changed, reloading + Credentials changed, please retry + Network error, please check your connection + Network error + Server error (HTTP %1$d) + Too many requests%1$s + , retry in %1$d seconds + Usage activation is not supported + Please select a model first + No cookie captured, please make sure you\'re logged in + No login URL configured + URL should start with %1$s + Authorization failed: %1$s + State mismatch, please retry + Callback missing authorization code + Token exchange failed, check the debug log + + + ✓ Usage activated + Request result + Error: %1$s + Response body:\n%1$s + + + Sign in to %1$s + Done logging in? + If you finished signing in but the page didn\'t redirect, tap the button below to grab the cookie and save your session. + + + No log entries yet\nRefresh Codex usage and debug info will show up here + + + OpenCode Go · Usage + DeepSeek balance + Auto refresh + %1$s · Quota + %1$s · %2$s + Updated %1$s + No data + Refreshing… + + + Reorder cards by long-press + Long-press a card to reorder it + Long-press any service card on the home screen and drag it wherever you like. The order is saved automatically. + Widget top-left opens the app + Tap the widget\'s top-left mark to open the app + The RainyToken › mark at the top-left of the widget opens the app. Tapping elsewhere switches services. + Tap charts for details + Tap a chart bar to see that time slot + Tap or slide on the usage charts to inspect the exact values of a time slot. + Chart titles are clickable + Tap a chart title for a per-model breakdown + Tapping a chart card title (e.g. "Spending") shows a per-model breakdown dialog. + Switch chart timezone + Usage details can toggle UTC+0 / UTC+8 + The usage details page can toggle between UTC+0 and UTC+8; chart labels follow along. + CCGO clear & resync + CCGO details can clear cache and resync + The "Clear" button on the CCGO usage details page deletes local cache and re-fetches everything. + View usage details + Service cards link to usage charts + Configured service cards show a "View usage details" entry at the bottom that opens the charts. + Browse raw data + Top-right of usage details opens raw records + "Raw data" at the top-right of usage details lists every record with pagination. + Pull-to-refresh syncs usage + Pull to refresh syncs balances and usage + Pull-to-refresh on the home screen refreshes balances and also syncs OCGO / CCGO usage records. + Credential guides + Credential pages include step-by-step guides + The "How to get" button at the bottom of credential pages walks through every service step by step. + Clipboard auto-import + Codex supports one-tap import from clipboard + The Codex credential page supports "Auto-import from clipboard": paste auth.json and it fills in with one tap. + Jump to a page number + Raw data page accepts a page number + The raw data page lets you enter a page number to jump directly — no need to flip through pages. + Widget auto-refresh + Swipe to the widget and it auto-refreshes + The widget refreshes balances when you swipe to it, or tap the ↻ button manually. + + + %1$d + Pick a date + Pick a month (any day) + Start date + End date + Spending breakdown + Request breakdown + Token breakdown + Clear data + This clears all cached CommandCode usage and re-syncs. It takes a few seconds. + Continue? + Confirm (%1$ds) + Yes, clear + Close + From %1$s + To %1$s + Apply custom range + OK + End date cannot be earlier than start date %1$s + Time %1$s:%2$s + No data + Total: %1$s + Total + Records + Cache read + Cache write + Cache token breakdown + ※ Cache reads are included in "Input tokens" + %1$d calls + MMM d, EEEE + %1$d calls · $%2$s + Raw data + Cache write (5m) + Cache write (1h) + Cost (USD) + Cost (raw) + + + ~/.config/codex-oauth-proxy/auth.json + 3. Open it with a text editor, + copy everything and paste it above + JSON example: + {"tokens": { + "access_token": "...", + "refresh_token": "...", + "expiresAt": 1783727108252 + }} + Tip: the app auto-refreshes the token after import, + no manual updates needed. + Ollama Pro credentials + Copy the full cookie from your browser. After logging into ollama.com/settings, find the Cookie header in DevTools → Network and copy it. + Update credentials + Save credentials + Test & save + Open Ollama Settings in browser + Copy login URL to clipboard + One-tap usage API Key (optional) + With an Ollama Cloud API Key, the details page can send one request to activate usage stats. Get it at ollama.com/settings → API Keys. + ollama-xxx or sk-xxx + Save API Key + OpenCode Go credentials + Needs both auth cookie and workspaceId. The app fetches the dashboard via OkHttp and parses 5h/week/month usage. + Auto-import from clipboard + The {id} segment of the dashboard URL + auth Cookie value + F12 → Cookies → opencode.ai → Value of auth + How to get these two? + Open login page in browser + With an OpenCode Zen API Key, the details page can send one request to activate usage stats. Get it at opencode.ai/settings → API Keys. + CommandCode Go credentials + Needs an API Key (for balance). Session Cookie (optional) for usage records, copied from browser DevTools. Balance works without it. + Generate at Settings → API Keys + Session Cookie (optional) + F12 → Cookies → commandcode.ai → select all & paste + How to get API Key and Cookie? + Enter API Key + Credentials are encrypted with Android Keystore (AES-256 GCM) and stored in local DataStore. + Update + Codex / ChatGPT Plus credentials + OAuth login fetches credentials automatically. You can also paste auth.json manually. + 🔐 OAuth login (recommended) + ── or import manually ── + Full auth.json content + Paste the full {"tokens": {...}} JSON + Import & save + How to get auth.json? + Paste session + Google OAuth blocks the in-app WebView, so log in with a browser and paste the cookie here. + Cookie string + Save cookie + + + Failed to parse data: %1$s + Weekly + Model call count + Cached data · %1$s + Showing the last successfully fetched balance + %1$s%2$s spent this month + Balance breakdown + Granted balance + Top-ups + Loading model list... + Select model + Refresh model list + Activating... + Retry usage activation + ⚡ One-tap usage activation + Refresh balance + Log in again + Configure credential + Current balance + 5h live usage + Monthly balance + Session usage + Please select a model + Error details: + API response: + Copy + *** (length %1$d) *** + %1$s***%2$s (length %3$d) + Bad cookie format, expected name1=value1; name2=value2 + %1$d cookies saved + Please paste the auth.json content + auth.json is missing access_token or refresh_token + Codex credential saved; token auto-refreshes when expiring + Parse failed: %1$s + Connected! Balance: $%1$s + API Key saved + Connected! Session: %1$s%% · %2$s + Credential deleted + Clipboard is empty + Recognized workspaceId and auth cookie + Recognized workspaceId, please paste the auth cookie too + Recognized auth cookie, please paste the workspaceId too + No valid credential recognized + + + Codex OAuth Login + Exchanging token... + Retry + Headless login + 1. Tap "Open in browser" or copy the link below to a browser\n2. Complete login & authorization on the OpenAI page\n3. The browser redirects to a localhost address (page not loading is normal)\n4. Copy the full URL from the address bar and paste it below\n5. Tap "Submit callback URL" + Authorization link + Open in browser + Copy link + ── paste the callback URL after login ── + Callback URL + http://localhost:1455/auth/callback?code=... + Submit callback URL + Regenerate auth link + Preparing authorization... + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6730448..e27be88 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -2,8 +2,8 @@ 雨晴Token - AI用量面板 - OpenCode Go 用量 + DeepSeek 余额,自动刷新 + AI用量面板 + OpenCode Go 用量 + DeepSeek 余额,自动刷新 雨晴喵 RainyToken