Merge pull request #256 from chenyme/fix

chore: bump version to 1.5.4 and update API key description in configuration files
This commit is contained in:
Chenyme authored and GitHub committed 2026-03-01 16:55:43 +08:00
commit d76b5e49cc
22 files changed
+215 -77

No files matched your search

+25 -3
View File
@@ -3,7 +3,7 @@ API 认证模块
"""
import hashlib
from typing import Optional
from typing import Optional, Iterable
from fastapi import HTTPException, status, Security
from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials
@@ -31,6 +31,27 @@ def get_admin_api_key() -> str:
api_key = get_config("app.api_key", DEFAULT_API_KEY)
return api_key or ""
def _normalize_api_keys(value: Optional[object]) -> list[str]:
if not value:
return []
if isinstance(value, str):
raw = value.strip()
if not raw:
return []
return [part.strip() for part in raw.split(",") if part.strip()]
if isinstance(value, Iterable):
keys: list[str] = []
for item in value:
if not item:
continue
if isinstance(item, str):
stripped = item.strip()
if stripped:
keys.append(stripped)
return keys
return []
def get_app_key() -> str:
"""
获取 App Key(后台管理密码)。
@@ -84,7 +105,8 @@ async def verify_api_key(
如果 config.toml 中未配置 api_key,则不启用认证。
"""
api_key = get_admin_api_key()
if not api_key:
api_keys = _normalize_api_keys(api_key)
if not api_keys:
return None
if not auth:
@@ -95,7 +117,7 @@ async def verify_api_key(
)
# 标准 api_key 验证
if auth.credentials == api_key:
if auth.credentials in api_keys:
return auth.credentials
raise HTTPException(
+12 -2
View File
@@ -529,6 +529,16 @@ class StreamProcessor(proc_base.BaseProcessor):
self._tool_buffer = ""
self._tool_partial = ""
self._tool_calls_seen = False
self._tool_call_index = 0
def _with_tool_index(self, tool_call: Any) -> Any:
if not isinstance(tool_call, dict):
return tool_call
if tool_call.get("index") is None:
tool_call = dict(tool_call)
tool_call["index"] = self._tool_call_index
self._tool_call_index += 1
return tool_call
def _filter_tool_card(self, token: str) -> str:
if not token or not self.tool_usage_enabled:
@@ -653,7 +663,7 @@ class StreamProcessor(proc_base.BaseProcessor):
data = data[end_idx + len(end_tag) :]
tool_call = parse_tool_call_block(self._tool_buffer, self.tools)
if tool_call:
events.append(("tool", tool_call))
events.append(("tool", self._with_tool_index(tool_call)))
self._tool_calls_seen = True
self._tool_buffer = ""
self._tool_state = "text"
@@ -671,7 +681,7 @@ class StreamProcessor(proc_base.BaseProcessor):
raw = f"{self._tool_buffer}{self._tool_partial}"
tool_call = parse_tool_call_block(raw, self.tools)
if tool_call:
events.append(("tool", tool_call))
events.append(("tool", self._with_tool_index(tool_call)))
self._tool_calls_seen = True
elif raw:
events.append(("text", f"<tool_call>{raw}"))
+93 -1
View File
@@ -28,6 +28,7 @@ DEFAULT_REFRESH_INTERVAL_HOURS = 8
DEFAULT_RELOAD_INTERVAL_SEC = 30
DEFAULT_SAVE_DELAY_MS = 500
DEFAULT_USAGE_FLUSH_INTERVAL_SEC = 5
SUPER_WINDOW_THRESHOLD_SECONDS = 14400
SUPER_POOL_NAME = "ssoSuper"
BASIC_POOL_NAME = "ssoBasic"
@@ -182,6 +183,48 @@ class TokenManager:
del self._dirty_tokens[token_key]
self._mark_state_change()
def _extract_window_size_seconds(self, result: dict) -> Optional[int]:
if not isinstance(result, dict):
return None
for key in ("windowSizeSeconds", "window_size_seconds"):
if key in result:
try:
return int(result.get(key))
except (TypeError, ValueError):
return None
limits = result.get("limits") or result.get("rateLimits")
if isinstance(limits, dict):
for key in ("windowSizeSeconds", "window_size_seconds"):
if key in limits:
try:
return int(limits.get(key))
except (TypeError, ValueError):
return None
return None
def _move_token_pool(
self,
token: TokenInfo,
from_pool: str,
to_pool: str,
reason: str = "",
) -> str:
if from_pool == to_pool:
return from_pool
if to_pool not in self.pools:
self.pools[to_pool] = TokenPool(to_pool)
logger.info(f"Pool '{to_pool}': created")
if from_pool in self.pools:
self.pools[from_pool].remove(token.token)
self.pools[to_pool].add(token)
self._track_token_change(token, to_pool, "state")
self._schedule_save()
extra = f" ({reason})" if reason else ""
logger.warning(
f"Token {token.token[:10]}... moved pool {from_pool} -> {to_pool}{extra}"
)
return to_pool
async def _save(self, force: bool = False):
"""保存变更"""
async with self._save_lock:
@@ -491,6 +534,30 @@ class TokenManager:
target_token.update_quota(new_quota)
target_token.record_success(is_usage=is_usage)
target_token.mark_synced()
window_size = self._extract_window_size_seconds(result)
if window_size is not None:
if (
target_pool_name == SUPER_POOL_NAME
and window_size >= SUPER_WINDOW_THRESHOLD_SECONDS
):
target_pool_name = self._move_token_pool(
target_token,
SUPER_POOL_NAME,
BASIC_POOL_NAME,
reason=f"windowSizeSeconds={window_size}",
)
elif (
target_pool_name == BASIC_POOL_NAME
and window_size < SUPER_WINDOW_THRESHOLD_SECONDS
):
target_pool_name = self._move_token_pool(
target_token,
BASIC_POOL_NAME,
SUPER_POOL_NAME,
reason=f"windowSizeSeconds={window_size}",
)
consumed = max(0, old_quota - new_quota)
logger.info(
@@ -837,6 +904,30 @@ class TokenManager:
token_info.update_quota(new_quota)
token_info.mark_synced()
window_size = self._extract_window_size_seconds(result)
if window_size is not None:
current_pool = self.get_pool_name_for_token(token_info.token)
if (
current_pool == SUPER_POOL_NAME
and window_size >= SUPER_WINDOW_THRESHOLD_SECONDS
):
self._move_token_pool(
token_info,
SUPER_POOL_NAME,
BASIC_POOL_NAME,
reason=f"windowSizeSeconds={window_size}",
)
elif (
current_pool == BASIC_POOL_NAME
and window_size < SUPER_WINDOW_THRESHOLD_SECONDS
):
self._move_token_pool(
token_info,
BASIC_POOL_NAME,
SUPER_POOL_NAME,
reason=f"windowSizeSeconds={window_size}",
)
logger.info(
f"Token {token_info.token[:10]}...: refreshed "
f"{old_quota} -> {new_quota}, status: {old_status} -> {token_info.status}"
@@ -890,7 +981,8 @@ class TokenManager:
await asyncio.sleep(1)
for pool_name, token_info in to_refresh:
self._track_token_change(token_info, pool_name, "state")
current_pool = self.get_pool_name_for_token(token_info.token) or pool_name
self._track_token_change(token_info, current_pool, "state")
await self._save(force=True)
logger.info(
+1 -1
View File
@@ -38,7 +38,7 @@ const NUMERIC_FIELDS = new Set([
const LOCALE_MAP = {
"app": {
"label": "应用设置",
"api_key": { title: "API 密钥", desc: "调用 Grok2API 服务的 Token(可选)。" },
"api_key": { title: "API 密钥", desc: "调用 Grok2API 服务的 Token(可选,支持多个,逗号分隔或数组)。" },
"app_key": { title: "后台密码", desc: "登录 Grok2API 管理后台的密码(必填)。" },
"public_enabled": { title: "启用功能玩法", desc: "是否启用功能玩法入口(关闭则功能玩法页面不可访问)。" },
"public_key": { title: "Public 密码", desc: "功能玩法页面的访问密码(可选)。" },
+7 -7
View File
@@ -9,8 +9,8 @@
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://cdn.jsdelivr.net/npm/geist@1.0.0/dist/fonts/geist-sans/style.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/geist@1.0.0/dist/fonts/geist-mono/style.css" rel="stylesheet">
<link href="/static/common/css/common.css?v=1.5.3" rel="stylesheet">
<link href="/static/admin/css/cache.css?v=1.5.3" rel="stylesheet">
<link href="/static/common/css/common.css?v=1.5.4" rel="stylesheet">
<link href="/static/admin/css/cache.css?v=1.5.4" rel="stylesheet">
<link href="/static/common/css/toast.css" rel="stylesheet">
</head>
@@ -196,12 +196,12 @@
</div>
</dialog>
<script src="/static/common/js/admin-auth.js?v=1.5.3"></script>
<script src="/static/common/js/batch-sse.js?v=1.5.3"></script>
<script src="/static/common/js/header.js?v=1.5.3"></script>
<script src="/static/common/js/footer.js?v=1.5.3"></script>
<script src="/static/common/js/admin-auth.js?v=1.5.4"></script>
<script src="/static/common/js/batch-sse.js?v=1.5.4"></script>
<script src="/static/common/js/header.js?v=1.5.4"></script>
<script src="/static/common/js/footer.js?v=1.5.4"></script>
<script src="/static/common/js/toast.js"></script>
<script src="/static/admin/js/cache.js?v=1.5.3"></script>
<script src="/static/admin/js/cache.js?v=1.5.4"></script>
<script src="/static/common/js/draggable.js"></script>
</body>
+6 -6
View File
@@ -9,8 +9,8 @@
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://cdn.jsdelivr.net/npm/geist@1.0.0/dist/fonts/geist-sans/style.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/geist@1.0.0/dist/fonts/geist-mono/style.css" rel="stylesheet">
<link href="/static/common/css/common.css?v=1.5.3" rel="stylesheet">
<link href="/static/admin/css/config.css?v=1.5.3" rel="stylesheet">
<link href="/static/common/css/common.css?v=1.5.4" rel="stylesheet">
<link href="/static/admin/css/config.css?v=1.5.4" rel="stylesheet">
<link href="/static/common/css/toast.css" rel="stylesheet">
</head>
@@ -46,11 +46,11 @@
</main>
<div id="app-footer"></div>
<script src="/static/common/js/admin-auth.js?v=1.5.3"></script>
<script src="/static/common/js/header.js?v=1.5.3"></script>
<script src="/static/common/js/footer.js?v=1.5.3"></script>
<script src="/static/common/js/admin-auth.js?v=1.5.4"></script>
<script src="/static/common/js/header.js?v=1.5.4"></script>
<script src="/static/common/js/footer.js?v=1.5.4"></script>
<script src="/static/common/js/toast.js"></script>
<script src="/static/admin/js/config.js?v=1.5.3"></script>
<script src="/static/admin/js/config.js?v=1.5.4"></script>
</body>
</html>
+5 -5
View File
@@ -24,8 +24,8 @@
}
}
</script>
<link href="/static/common/css/common.css?v=1.5.3" rel="stylesheet">
<link href="/static/common/css/login.css?v=1.5.3" rel="stylesheet">
<link href="/static/common/css/common.css?v=1.5.4" rel="stylesheet">
<link href="/static/common/css/login.css?v=1.5.4" rel="stylesheet">
<link href="/static/common/css/toast.css" rel="stylesheet">
</head>
@@ -55,10 +55,10 @@
<div id="app-footer"></div>
<script src="/static/common/js/admin-auth.js?v=1.5.3"></script>
<script src="/static/common/js/admin-auth.js?v=1.5.4"></script>
<script src="/static/common/js/toast.js"></script>
<script src="/static/common/js/footer.js?v=1.5.3"></script>
<script src="/static/admin/js/login.js?v=1.5.3"></script>
<script src="/static/common/js/footer.js?v=1.5.4"></script>
<script src="/static/admin/js/login.js?v=1.5.4"></script>
</body>
</html>
+7 -7
View File
@@ -9,8 +9,8 @@
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://cdn.jsdelivr.net/npm/geist@1.0.0/dist/fonts/geist-sans/style.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/geist@1.0.0/dist/fonts/geist-mono/style.css" rel="stylesheet">
<link href="/static/common/css/common.css?v=1.5.3" rel="stylesheet">
<link href="/static/admin/css/token.css?v=1.5.3" rel="stylesheet">
<link href="/static/common/css/common.css?v=1.5.4" rel="stylesheet">
<link href="/static/admin/css/token.css?v=1.5.4" rel="stylesheet">
<link href="/static/common/css/toast.css" rel="stylesheet">
</head>
@@ -295,12 +295,12 @@
</div>
<script src="/static/common/js/draggable.js"></script>
<script src="/static/common/js/admin-auth.js?v=1.5.3"></script>
<script src="/static/common/js/batch-sse.js?v=1.5.3"></script>
<script src="/static/common/js/header.js?v=1.5.3"></script>
<script src="/static/common/js/footer.js?v=1.5.3"></script>
<script src="/static/common/js/admin-auth.js?v=1.5.4"></script>
<script src="/static/common/js/batch-sse.js?v=1.5.4"></script>
<script src="/static/common/js/header.js?v=1.5.4"></script>
<script src="/static/common/js/footer.js?v=1.5.4"></script>
<script src="/static/common/js/toast.js"></script>
<script src="/static/admin/js/token.js?v=1.5.3"></script>
<script src="/static/admin/js/token.js?v=1.5.4"></script>
</body>
</html>
+1 -1
View File
@@ -2,7 +2,7 @@ async function loadAdminFooter() {
const container = document.getElementById('app-footer');
if (!container) return;
try {
const res = await fetch('/static/common/html/footer.html?v=1.5.3');
const res = await fetch('/static/common/html/footer.html?v=1.5.4');
if (!res.ok) return;
container.innerHTML = await res.text();
} catch (e) {
+1 -1
View File
@@ -2,7 +2,7 @@ async function loadAdminHeader() {
const container = document.getElementById('app-header');
if (!container) return;
try {
const res = await fetch('/static/common/html/header.html?v=1.5.3');
const res = await fetch('/static/common/html/header.html?v=1.5.4');
if (!res.ok) return;
container.innerHTML = await res.text();
const path = window.location.pathname;
+1 -1
View File
@@ -2,7 +2,7 @@ async function loadPublicHeader() {
const container = document.getElementById('app-header');
if (!container) return;
try {
const res = await fetch('/static/common/html/public-header.html?v=1.5.3');
const res = await fetch('/static/common/html/public-header.html?v=1.5.4');
if (!res.ok) return;
container.innerHTML = await res.text();
const logoutBtn = container.querySelector('#public-logout-btn');
+22 -8
View File
@@ -13,6 +13,17 @@ body {
radial-gradient(circle at 85% 0%, rgba(17, 17, 17, 0.03), transparent 50%);
}
/* Hide scrollbars while keeping scroll behavior */
* {
scrollbar-width: none;
-ms-overflow-style: none;
}
*::-webkit-scrollbar {
width: 0;
height: 0;
}
.chat-main {
padding-bottom: 16px;
}
@@ -85,7 +96,7 @@ body {
.message-row {
display: flex;
flex-direction: column;
gap: 8px;
gap: 4px;
}
.message-row.user {
@@ -100,7 +111,7 @@ body {
.message-actions {
display: inline-flex;
align-items: center;
gap: 10px;
gap: 6px;
color: var(--accents-4);
font-size: 12px;
margin-left: 2px;
@@ -141,7 +152,8 @@ body {
.message-row.user .message-bubble {
background: #efeeea;
padding: 12px 16px;
padding: 6px 10px;
line-height: 1.45;
border-radius: 16px;
border: 1px solid var(--chat-border);
}
@@ -821,16 +833,16 @@ body {
/* --- Extensions for multi-session UI --- */
.chat-layout {
display: flex;
gap: 20px;
gap: 6px;
align-items: flex-start;
}
.chat-sidebar {
width: 180px;
flex-shrink: 0;
border: 1px solid var(--chat-border);
border: none;
border-radius: 16px;
background: var(--chat-surface);
background: transparent;
display: flex;
flex-direction: column;
overflow: hidden;
@@ -844,7 +856,7 @@ body {
align-items: center;
justify-content: space-between;
padding: 4px 12px;
border-bottom: 1px solid var(--chat-border);
border-bottom: none;
min-height: 26px;
}
@@ -917,7 +929,7 @@ body {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
line-height: 1.1;
line-height: 1;
}
.session-delete {
@@ -1032,6 +1044,8 @@ body {
.chat-shell {
flex: 1;
min-width: 0;
border-left: 1px solid var(--chat-border);
padding-left: 16px;
}
.model-chip {
+6 -6
View File
@@ -9,8 +9,8 @@
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://cdn.jsdelivr.net/npm/geist@1.0.0/dist/fonts/geist-sans/style.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/geist@1.0.0/dist/fonts/geist-mono/style.css" rel="stylesheet">
<link href="/static/common/css/common.css?v=1.5.3" rel="stylesheet">
<link href="/static/public/css/chat.css?v=1.5.3" rel="stylesheet">
<link href="/static/common/css/common.css?v=1.5.4" rel="stylesheet">
<link href="/static/public/css/chat.css?v=1.5.4" rel="stylesheet">
<link href="/static/common/css/toast.css" rel="stylesheet">
</head>
@@ -147,11 +147,11 @@
<div id="app-footer"></div>
<script src="/static/common/js/admin-auth.js?v=1.5.3"></script>
<script src="/static/common/js/public-header.js?v=1.5.3"></script>
<script src="/static/common/js/footer.js?v=1.5.3"></script>
<script src="/static/common/js/admin-auth.js?v=1.5.4"></script>
<script src="/static/common/js/public-header.js?v=1.5.4"></script>
<script src="/static/common/js/footer.js?v=1.5.4"></script>
<script src="/static/common/js/toast.js"></script>
<script src="/static/public/js/chat.js?v=1.5.3"></script>
<script src="/static/public/js/chat.js?v=1.5.4"></script>
</body>
</html>
+6 -6
View File
@@ -9,8 +9,8 @@
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://cdn.jsdelivr.net/npm/geist@1.0.0/dist/fonts/geist-sans/style.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/geist@1.0.0/dist/fonts/geist-mono/style.css" rel="stylesheet">
<link href="/static/common/css/common.css?v=1.5.3" rel="stylesheet">
<link href="/static/public/css/imagine.css?v=1.5.3" rel="stylesheet">
<link href="/static/common/css/common.css?v=1.5.4" rel="stylesheet">
<link href="/static/public/css/imagine.css?v=1.5.4" rel="stylesheet">
<link href="/static/common/css/toast.css" rel="stylesheet">
</head>
@@ -237,12 +237,12 @@
<div id="app-footer"></div>
<script src="/static/common/js/admin-auth.js?v=1.5.3"></script>
<script src="/static/common/js/public-header.js?v=1.5.3"></script>
<script src="/static/common/js/footer.js?v=1.5.3"></script>
<script src="/static/common/js/admin-auth.js?v=1.5.4"></script>
<script src="/static/common/js/public-header.js?v=1.5.4"></script>
<script src="/static/common/js/footer.js?v=1.5.4"></script>
<script src="/static/common/js/toast.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
<script src="/static/public/js/imagine.js?v=1.5.3"></script>
<script src="/static/public/js/imagine.js?v=1.5.4"></script>
</body>
</html>
+5 -5
View File
@@ -24,8 +24,8 @@
}
}
</script>
<link href="/static/common/css/common.css?v=1.5.3" rel="stylesheet">
<link href="/static/common/css/login.css?v=1.5.3" rel="stylesheet">
<link href="/static/common/css/common.css?v=1.5.4" rel="stylesheet">
<link href="/static/common/css/login.css?v=1.5.4" rel="stylesheet">
<link href="/static/common/css/toast.css" rel="stylesheet">
</head>
@@ -59,10 +59,10 @@
<div id="app-footer"></div>
<script src="/static/common/js/admin-auth.js?v=1.5.3"></script>
<script src="/static/common/js/admin-auth.js?v=1.5.4"></script>
<script src="/static/common/js/toast.js"></script>
<script src="/static/common/js/footer.js?v=1.5.3"></script>
<script src="/static/public/js/login.js?v=1.5.3"></script>
<script src="/static/common/js/footer.js?v=1.5.4"></script>
<script src="/static/public/js/login.js?v=1.5.4"></script>
</body>
</html>
+6 -6
View File
@@ -9,8 +9,8 @@
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://cdn.jsdelivr.net/npm/geist@1.0.0/dist/fonts/geist-sans/style.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/geist@1.0.0/dist/fonts/geist-mono/style.css" rel="stylesheet">
<link href="/static/common/css/common.css?v=1.5.3" rel="stylesheet">
<link href="/static/public/css/video.css?v=1.5.3" rel="stylesheet">
<link href="/static/common/css/common.css?v=1.5.4" rel="stylesheet">
<link href="/static/public/css/video.css?v=1.5.4" rel="stylesheet">
<link href="/static/common/css/toast.css" rel="stylesheet">
</head>
@@ -158,11 +158,11 @@
<div id="app-footer"></div>
<script src="/static/common/js/admin-auth.js?v=1.5.3"></script>
<script src="/static/common/js/public-header.js?v=1.5.3"></script>
<script src="/static/common/js/footer.js?v=1.5.3"></script>
<script src="/static/common/js/admin-auth.js?v=1.5.4"></script>
<script src="/static/common/js/public-header.js?v=1.5.4"></script>
<script src="/static/common/js/footer.js?v=1.5.4"></script>
<script src="/static/common/js/toast.js"></script>
<script src="/static/public/js/video.js?v=1.5.3"></script>
<script src="/static/public/js/video.js?v=1.5.4"></script>
</body>
</html>
+6 -6
View File
@@ -9,8 +9,8 @@
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://cdn.jsdelivr.net/npm/geist@1.0.0/dist/fonts/geist-sans/style.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/geist@1.0.0/dist/fonts/geist-mono/style.css" rel="stylesheet">
<link href="/static/common/css/common.css?v=1.5.3" rel="stylesheet">
<link href="/static/public/css/voice.css?v=1.5.3" rel="stylesheet">
<link href="/static/common/css/common.css?v=1.5.4" rel="stylesheet">
<link href="/static/public/css/voice.css?v=1.5.4" rel="stylesheet">
<link href="/static/common/css/toast.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/livekit-client@2.7.3/dist/livekit-client.umd.min.js"></script>
</head>
@@ -147,11 +147,11 @@
<div id="app-footer"></div>
<script src="/static/common/js/admin-auth.js?v=1.5.3"></script>
<script src="/static/common/js/public-header.js?v=1.5.3"></script>
<script src="/static/common/js/footer.js?v=1.5.3"></script>
<script src="/static/common/js/admin-auth.js?v=1.5.4"></script>
<script src="/static/common/js/public-header.js?v=1.5.4"></script>
<script src="/static/common/js/footer.js?v=1.5.4"></script>
<script src="/static/common/js/toast.js"></script>
<script src="/static/public/js/voice.js?v=1.5.3"></script>
<script src="/static/public/js/voice.js?v=1.5.4"></script>
</body>
</html>
+1 -1
View File
@@ -4,7 +4,7 @@
app_url = ""
# 后台管理密码
app_key = "grok2api"
# API 调用密钥(可选)
# API 调用密钥(可选,支持列表)
api_key = ""
# 是否启用 public 功能玩法
public_enabled = false
+1 -1
View File
@@ -334,7 +334,7 @@ Config file: `data/config.toml`
| :-- | :-- | :-- | :-- | :-- |
| **app** | `app_url` | App URL | External base URL used for file links. | `""` |
| | `app_key` | Admin password | Login password for admin panel. | `grok2api` |
| | `api_key` | API key | Optional API key for access. | `""` |
| | `api_key` | API key | Optional API key for access (comma-separated string or array). | `""` |
| | `public_enabled` | Public mode | Enable public features. | `false` |
| | `public_key` | Public key | Public access key (optional). | `""` |
| | `image_format` | Image format | `url` or `base64`. | `url` |
+1 -1
View File
@@ -1,6 +1,6 @@
[project]
name = "grok2api"
version = "1.5.3"
version = "1.5.4"
description = "Grok2API rebuilt with FastAPI, fully aligned with the latest web call format. Supports streaming and non-streaming chat, image generation/editing, deep thinking, token pool concurrency, and automatic load balancing."
readme = "README.md"
requires-python = ">=3.13"
+1 -1
View File
@@ -335,7 +335,7 @@ curl http://localhost:8000/v1/images/edits \
| :-- | :-- | :-- | :-- | :-- |
| **app** | `app_url` | 应用地址 | 当前 Grok2API 服务的外部访问 URL,用于文件链接访问。 | `""` |
| | `app_key` | 后台密码 | 登录 Grok2API 管理后台的密码(必填)。 | `grok2api` |
| | `api_key` | API 密钥 | 调用 Grok2API 服务的 Token(可选)。 | `""` |
| | `api_key` | API 密钥 | 调用 Grok2API 服务的 Token(可选,支持逗号分隔或数组)。 | `""` |
| | `public_enabled` | Public 开关 | 是否启用 public 功能玩法。 | `false` |
| | `public_key` | Public 密钥 | Public 调用密钥(可选)。 | `""` |
| | `image_format` | 图片格式 | 生成的图片格式(url 或 base64)。 | `url` |
Generated
+1 -1
View File
@@ -471,7 +471,7 @@ wheels = [
[[package]]
name = "grok2api"
version = "1.5.3"
version = "1.5.4"
source = { virtual = "." }
dependencies = [
{ name = "aiofiles" },