MCPcopy Create free account

hub / github.com/TQZHR/grok2api / functions

Functions1,181 in github.com/TQZHR/grok2api

↓ 254 callersMethodget
获取配置值 Args: key: 配置键,格式 "section.key" default: 默认值
app/core/config.py:290
↓ 158 callersMethodget
获取 Token
app/services/token/pool.py:27
↓ 103 callersMethodget
获取速率限制信息 Args: token: 认证 Token model_name: 模型名称 Returns: 响应数据
app/services/grok/usage.py:87
↓ 103 callersFunctionshowToast
(message, type = 'success')
app/static/common/toast.js:1
↓ 78 callersFunctionq
(id)
app/static/chat/chat.js:22
↓ 72 callersFunctionget_config
获取配置
app/core/config.py:324
↓ 71 callersMethodadd
添加 Token
app/services/token/pool.py:16
↓ 50 callersFunctionq
(id)
app/static/keys/keys.js:15
↓ 45 callersMethodremove
删除 Token
app/services/token/pool.py:20
↓ 44 callersFunctionopenAiError
(message: string, code: string)
src/routes/openai.ts:45
↓ 40 callersFunctionjsonError
(message: string, code: string)
src/routes/admin.ts:52
↓ 36 callersMethodclose
(self)
app/core/storage.py:687
↓ 31 callersFunctiondbRun
( db: Env["DB"], sql: string, params: unknown[] = [], )
src/db.ts:23
↓ 29 callersMethodclose
关闭 Session
app/services/grok/assets.py:219
↓ 28 callersFunctionnowMs
()
src/utils/time.ts:1
↓ 24 callersFunctionbuildAuthHeaders
(apiKey)
app/static/common/admin-auth.js:189
↓ 24 callersFunctionget_token_manager
获取 TokenManager 单例
app/services/token/manager.py:649
↓ 21 callersFunctionsse
(event: string, data: Record<string, unknown>)
src/grok/compat.ts:125
↓ 19 callersFunctiongetSettings
(env: Env)
src/settings.ts:156
↓ 19 callersFunctionsafeNum
(v)
app/static/datacenter/datacenter.js:19
↓ 18 callersMethod_sse
构建 SSE 响应 (StreamProcessor 通用)
app/services/grok/processor.py:85
↓ 18 callersFunctionaddRequestLog
( db: Env["DB"], entry: Omit<RequestLogRow, "id" | "time" | "timestamp"> & { id?: string }, )
src/repo/logs.ts:18
↓ 18 callersFunctionlegacyErr
(message: string)
src/routes/admin.ts:178
↓ 15 callersFunction$
(id)
app/static/datacenter/datacenter.js:9
↓ 15 callersFunctionmakeId
(prefix: string)
src/grok/compat.ts:1
↓ 15 callersMethodrecord_request
记录一次请求
app/services/request_stats.py:99
↓ 14 callersFunction_record_request
(model_id: str, success: bool)
app/api/v1/image.py:506
↓ 14 callersFunctionapplyCooldown
(db: Env["DB"], token: string, status: number)
src/repo/tokens.ts:197
↓ 14 callersMethodclear
清空缓存
app/services/grok/assets.py:774
↓ 14 callersMethoddelete
删除单个文件 Raises: UpstreamException: 删除失败
app/services/grok/assets.py:450
↓ 14 callersFunctionrecordTokenFailure
( db: Env["DB"], token: string, status: number, message: string, )
src/repo/tokens.ts:176
↓ 14 callersFunctionsetText
(id, text)
app/static/token/token.js:277
↓ 13 callersFunctiongetBuildSha
(env: Env)
src/index.ts:16
↓ 13 callersFunctionlogout
()
app/static/common/admin-auth.js:193
↓ 13 callersFunctionsetImageStatusText
(text)
app/static/chat/chat.js:411
↓ 13 callersMethodsync_usage
同步 Token 用量 优先从 API 获取最新配额,失败则降级到本地预估 Args: token_str: Token 字符串(可带 sso= 前缀) model_
app/services/token/manager.py:259
↓ 12 callersMethod_normalize_limit
Normalize a daily limit value. -1 means unlimited.
app/services/api_keys.py:101
↓ 12 callersFunctionrecordImageLog
(args: { env: Env; ip: string; model: string; start: number; keyName: string; status: number; to
src/routes/openai.ts:1085
↓ 11 callersFunction_send
(payload: dict)
app/api/v1/admin.py:141
↓ 11 callersFunctionbuildImageSse
(event: string, data: Record<string, unknown>)
src/routes/openai.ts:368
↓ 11 callersFunctiongetTokenKey
(token)
app/static/token/token.js:111
↓ 11 callersMethodinit
初始化加载数据
app/services/api_keys.py:43
↓ 11 callersFunctionmakeChunk
( id: string, created: number, model: string, content: string, finish_reason?: StreamFinishReason, )
src/grok/processor.ts:23
↓ 11 callersFunctionsend
(payload: Record<string, unknown>)
src/routes/admin.ts:417
↓ 11 callersFunctionsetText
(id, v)
app/static/datacenter/datacenter.js:13
↓ 10 callersMethod_save
保存变更
app/services/token/manager.py:110
↓ 10 callersFunctionestimate_tokens
(value: Any)
app/services/compat/usage.py:28
↓ 10 callersFunctionnormalizeCfCookie
(value: string)
src/settings.ts:138
↓ 10 callersFunctionnormalizeSsoToken
(token)
app/static/token/token.js:24
↓ 10 callersMethodprocess_url
处理资产 URL
app/services/grok/processor.py:62
↓ 10 callersFunctionselectBestToken
(db: Env["DB"], model: string)
src/repo/tokens.ts:150
↓ 10 callersFunctionstopImageContinuous
()
app/static/chat/chat.js:691
↓ 10 callersFunctionstreamHeaders
()
src/routes/openai.ts:1021
↓ 10 callersFunctionupdateBatchProgress
()
app/static/cache/cache.js:648
↓ 10 callersFunctionupdateImageContinuousStats
()
app/static/chat/chat.js:416
↓ 9 callersFunctionbuildApiHeaders
()
app/static/chat/chat.js:34
↓ 9 callersFunctionfetchAsset
(c: any, pathname: string)
src/index.ts:42
↓ 9 callersFunctiongetTokenSuffix
(token: string)
src/routes/openai.ts:510
↓ 9 callersFunctionget_storage
()
app/core/storage.py:719
↓ 9 callersFunctionsetActionButtonsState
()
app/static/cache/cache.js:627
↓ 8 callersFunction_as_str
(v: Any)
app/core/config.py:19
↓ 8 callersFunction_chunk_payload
(response_id: str, model: str, delta: dict[str, Any], finish_reason: str | None = None)
app/services/compat/openai_chat.py:100
↓ 8 callersMethod_save_data
保存 API Keys
app/services/api_keys.py:85
↓ 8 callersFunctionapplyFilters
()
app/static/token/token.js:132
↓ 8 callersFunctiondbAll
( db: Env["DB"], sql: string, params: unknown[] = [], )
src/db.ts:13
↓ 8 callersFunctiongetImageRunMode
()
app/static/chat/chat.js:390
↓ 8 callersFunctionimageCallPrompt
(kind: "generation" | "edit", prompt: string)
src/routes/openai.ts:1146
↓ 8 callersFunctionmake_response_id
(prefix: str = "resp")
app/services/compat/responses_api.py:17
↓ 8 callersFunctionnormalizeLimit
(v: unknown)
src/repo/apiKeys.ts:31
↓ 8 callersFunctionrender_template
渲染指定模板
app/api/v1/admin.py:43
↓ 8 callersFunctionsetOnlineStatus
(text, className)
app/static/cache/cache.js:681
↓ 8 callersMethodupdate
更新配置
app/core/config.py:307
↓ 8 callersFunctionupdateBatchActionsVisibility
()
app/static/cache/cache.js:596
↓ 7 callersFunction_anthropic_sse
(event: str, data: dict[str, Any])
app/services/compat/anthropic_api.py:248
↓ 7 callersFunction_recv_until
(ws, predicate, max_messages: int = 80)
tests/test_imagine_ws_api.py:28
↓ 7 callersFunction_sse
(event: str, data: dict[str, Any])
app/services/compat/responses_api.py:271
↓ 7 callersFunctionensureApiKey
()
app/static/common/admin-auth.js:174
↓ 7 callersFunctiongetDynamicHeaders
(settings: GrokSettings, pathname: string)
src/grok/headers.ts:42
↓ 7 callersFunctionisValidModel
(model: string)
src/grok/models.ts:186
↓ 7 callersFunctionlegacyOk
(data: Record<string, unknown> = {})
src/routes/admin.ts:174
↓ 7 callersFunctionlistTokens
(db: Env["DB"])
src/repo/tokens.ts:92
↓ 7 callersFunctionloadData
()
app/static/token/token.js:293
↓ 7 callersFunctionmakeDone
()
src/grok/processor.ts:62
↓ 7 callersFunctionpoolToType
(pool)
app/static/token/token.js:29
↓ 7 callersMethodprocess
处理流式响应
app/services/grok/processor.py:127
↓ 7 callersFunctionrefreshLogsOnce
(silent = false)
app/static/datacenter/datacenter.js:202
↓ 7 callersMethodset_birth_date
( self, sso: str, sso_rw: str, impersonate: str, user_agent: Optional[
app/services/account/birth_date_service.py:30
↓ 7 callersFunctionupdateSelectedCount
()
app/static/cache/cache.js:588
↓ 6 callersMethod__init__
(self, model: str, token: str = "")
app/services/grok/processor.py:43
↓ 6 callersFunction_build_client
(monkeypatch: pytest.MonkeyPatch, api_key: str = "test-key")
tests/test_imagine_ws_api.py:12
↓ 6 callersMethodchat
发送聊天请求 Args: token: 认证 Token message: 消息文本 model: Grok 模型名称 mode: 模型模式
app/services/grok/chat.py:268
↓ 6 callersFunctioncheckRateLimits
( cookie: string, settings: GrokSettings, model: string, )
src/grok/rateLimits.ts:7
↓ 6 callersMethodclose
释放下载服务资源
app/services/grok/processor.py:56
↓ 6 callersFunctionconvertRawUrlByFormat
( rawUrl: string, responseFormat: ImageResponseFormat, args: { baseUrl: string; cookie: string;
src/routes/openai.ts:333
↓ 6 callersFunctiondedupeImages
(images: string[])
src/routes/openai.ts:262
↓ 6 callersFunctionencodeAssetPath
(raw: string)
src/grok/processor.ts:135
↓ 6 callersFunctionensureUI
()
app/static/cache/cache.js:134
↓ 6 callersFunctionescapeHtml
(s)
app/static/keys/keys.js:19
↓ 6 callersFunctionfinalize_chat_request
(prepared: PreparedChatRequest, *, success: bool)
app/services/compat/common.py:190
↓ 6 callersFunctionfinish
(err?: Error)
src/grok/imagineExperimental.ts:257
next →1–100 of 1,181, ranked by callers