- Add ensureInitialized() call before count_tokens handler
- Use hybrid approach: local estimation for text, API for images/docs
- This prevents "No accounts available" error on first request
Switch from local estimation (gpt-tokenizer) to API-based counting
via Google Cloud Code API for accurate token counts. Falls back to
local estimation if API call fails.
Add comprehensive test suite for /v1/messages/count_tokens endpoint:
- Simple text messages
- Multi-turn conversations
- System prompts (string and array format)
- Tool definitions and tool use/result blocks
- Thinking blocks
- Content arrays with text blocks
- Error handling for invalid requests
- Long text tokenization
Also adds npm script test:counttokens for running tests individually.
Add Anthropic-compatible token counting endpoint using hybrid approach:
- Local estimation with gpt-tokenizer for text content (~95% accuracy)
- API-based counting for complex content (images, documents)
- Automatic fallback to local estimation on API errors
This resolves warnings in LiteLLM and other clients that rely on
pre-request token counting.
Feat(ui): add Turkish language support and UI enhancements
Introduces Turkish language support and several UI/UX improvements to the web management interface.
- Remove nested x-data from save preset modal to fix scope access
- Add newPresetName to parent component state
- Ensure savingPreset state is correctly accessed from the button
- Clear input field on modal open and after successful save
- Move TEST_MODELS and DEFAULT_PRESETS to src/constants.js as single source of truth
- Update test-models.cjs helper to use dynamic import from constants
- Make getTestModels() and getModels() async functions
- Update all test files to await async model config loading
- Remove duplicate THINKING_MODELS and getThinkingModels() from test helper
- Make thinking tests more lenient for Gemini (doesn't always produce thinking blocks)
Co-Authored-By: Claude <noreply@anthropic.com>
Ask users to provide their settings.json or Settings → Claude CLI
screenshot to help diagnose configuration issues faster.
Addresses discussion #113
Co-Authored-By: Claude <noreply@anthropic.com>
- Cooldown now caps API-provided reset times instead of being a fallback
- Fixed misleading UI descriptions for cooldown settings
- Removed unused cooldownDurationMs from settings object
- Updated default fallback values in frontend to 10s
Co-Authored-By: Claude <noreply@anthropic.com>
- Add separate LOAD_CODE_ASSIST_ENDPOINTS (prod first) and
LOAD_CODE_ASSIST_HEADERS (google-api-nodejs-client User-Agent)
- Add duetProject to metadata for project discovery
- Silent fallback when API returns success but no project
(matches opencode-antigravity-auth behavior)
- Only warn when all endpoints fail with actual errors
Fixes#114, addresses discussion #113
Co-Authored-By: Claude <noreply@anthropic.com>
- Add backend storage logic in `src/utils/claude-config.js` to save/load/delete presets
- Add API endpoints (`GET`, `POST`, `DELETE`) for presets in `src/webui/index.js`
- Update `public/views/settings.html` with new Presets UI card and modals
- Update `public/js/components/claude-config.js` with auto-load logic and unsaved changes protection
- Add translations (EN/ZH) for new UI elements in `public/js/store.js`
- Add integration tests in `tests/frontend/test-frontend-settings.cjs`
- Update compiled CSS
Co-Authored-By: Claude <noreply@anthropic.com>
Add debouncing to chart updates to prevent rapid flickering, implement checks to avoid redundant history processing and double renders, and disable quota chart animations to fix visual glitches.
Improve robustness of chart updates in dashboard components by adding
force destroy checks across canvas properties, component state, and
Chart.js registry to prevent memory leaks and instance conflicts.
Save new chart instances to both canvas and component for better tracking.
Introduce new CSS classes for filter controls and apply them to the time range dropdown in the dashboard view, improving consistency and hover effects.
Add a 24-hour time-to-live check to the data cache restoration logic to prevent using stale cached data. This ensures data freshness by expiring and removing outdated cache entries before restoration. Also corrected a minor typo in the validity check comment.
Extract hardcoded priority logic into a DEAD_THRESHOLD constant and MODEL_TIERS array for better maintainability and readability. This refactoring improves code organization without altering functionality.
Switch from substring includes to regex word boundary tests for model names like opus, sonnet, and gemini variants, improving accuracy in the account manager's prioritization logic.
Improve layout and styling of dashboard filters and charts to better adapt to larger viewports, including updated flex directions, button sizes, and hover effects for lg breakpoints.
Refactor subtitle elements in accounts, dashboard, and models views to use styled badge containers with rounded backgrounds, borders, and improved typography for better visual consistency.
- Implement localStorage-based caching in data-store to restore accounts, models, and usage data on load, improving initial render performance
- Add hash-based routing in global store to sync active tab with URL, enabling browser back/forward navigation and direct linking to tabs
Add sorting functionality to the models table with clickable headers for columns like Stat, Model Identity, Global Quota, Next Reset, and Account Distribution. Includes dynamic sort icons and logic to handle ascending/descending order with appropriate defaults.
Introduce a priority-based system for selecting the main model quota, considering model tiers (e.g., opus, sonnet, pro) and availability status. This enhances accuracy by treating models with less than 1% remaining quota as "dead" for prioritization, ensuring users see the most relevant and active model in the dashboard.