Open
Conversation
Add token caching and 401 retry logic to fix issue where users are logged out when adding/editing API keys. Cache api_key in ensureApiKey() and retry once with forceRefresh on 401 errors before logout. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Pegasus02
pushed a commit
to Pegasus02/grok2api
that referenced
this pull request
Mar 22, 2026
…rok-superimage-1.0-pg7sej Add grok-superimage model with server-side image config, improve SSE error handling and transient retry logic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
Issue #38
添加 API Key 后,管理后台会自动退出登录,无法保持登录状态。
原因
每次 API 操作都会重新请求登录接口获取 token,遇到 401 错误时直接清除登录状态并跳转到登录页。
修复
ensureApiKey()中添加缓存机制,避免重复请求测试