MCPcopy Create free account

hub / github.com/TQZHR/grok2api / functions

Functions1,181 in github.com/TQZHR/grok2api

↓ 6 callersMethodget_stats
获取缓存统计
app/services/grok/assets.py:704
↓ 6 callersFunctionisTokenExhausted
(item)
app/static/token/token.js:98
↓ 6 callersMethodlist
获取所有 Token
app/services/token/pool.py:79
↓ 6 callersFunctionloadStats
(options = {})
app/static/cache/cache.js:236
↓ 6 callersFunctionmapLimit
( items: T[], limit: number, fn: (item: T) => Promise<R>, )
src/routes/openai.ts:57
↓ 6 callersFunctionparseJsonSafely
(response)
app/static/token/token.js:59
↓ 6 callersMethodreload_if_stale
在多 worker 场景下保持短周期一致性
app/services/token/manager.py:97
↓ 6 callersFunctionsendConversationRequest
(args: { payload: Record<string, unknown>; cookie: string; settings: GrokSettings; referer?: string; }
src/grok/conversation.ts:179
↓ 6 callersFunctiontoImgProxyUrl
(globalCfg: GlobalSettings, origin: string, path: string)
src/grok/processor.ts:99
↓ 6 callersMethodto_base64
下载文件并转为 base64
app/services/grok/assets.py:669
↓ 6 callersFunctionupdateBatchProgress
()
app/static/token/token.js:1062
↓ 6 callersFunctionupdateImageContinuousButtons
()
app/static/chat/chat.js:434
↓ 5 callersMethod_get_dl
获取下载服务实例(复用)
app/services/grok/processor.py:50
↓ 5 callersFunction_log
(msg: str)
scripts/wait_for_storage.py:15
↓ 5 callersMethod_schedule_save
合并高频保存请求,减少写入开销
app/services/token/manager.py:126
↓ 5 callersFunction_sse_event
(event: str, data: dict)
app/api/v1/image.py:453
↓ 5 callersMethodacquire_lock
(self, name: str, timeout: int = 10)
app/core/storage.py:541
↓ 5 callersFunctionbuildConversationPayload
(args: { requestModel: string; content: string; imgIds: string[]; imgUris: string[]; postId?: string
src/grok/conversation.ts:89
↓ 5 callersFunctionbuildCookie
(token: string, cf: string)
src/routes/openai.ts:568
↓ 5 callersFunctionclearImageContinuousError
()
app/static/chat/chat.js:492
↓ 5 callersFunctionclearKvCacheByType
( env: Env, type: CacheType | null, batch = 200, maxLoops = 20, )
src/routes/admin.ts:79
↓ 5 callersFunctionclearStoredAppKey
()
app/static/common/admin-auth.js:153
↓ 5 callersMethodcommit
Persist current in-memory token state.
app/services/token/manager.py:447
↓ 5 callersFunctionconfirmAction
(message, options = {})
app/static/cache/cache.js:198
↓ 5 callersFunctionemitCompleted
(index: number, value: string)
src/routes/openai.ts:877
↓ 5 callersFunctionenforceQuota
(args: { env: Env; apiAuth: ApiAuthInfo; model: string; kind: "chat" | "image" | "video"; imageCount
src/routes/openai.ts:132
↓ 5 callersFunctionextractApiErrorMessage
(payload, fallback = '请求失败')
app/static/token/token.js:47
↓ 5 callersFunctiongetChecked
(id)
app/static/token/token.js:121
↓ 5 callersFunctiongetClientIp
(req: Request)
src/routes/openai.ts:49
↓ 5 callersMethodget_token_for_model
按模型选择可用 Token(包含 basic->super 回退与 heavy 配额桶选择)。
app/services/token/manager.py:215
↓ 5 callersFunctionjson_dumps
(obj: Any)
app/core/storage.py:38
↓ 5 callersFunctionjson_loads
(obj: str | bytes)
app/core/storage.py:41
↓ 5 callersMethodmark_synced
标记已同步
app/services/token/models.py:197
↓ 5 callersFunctionpickImageResults
(images: string[], n: number)
src/routes/openai.ts:273
↓ 5 callersFunctionrenderContent
(container, content, forceText)
app/static/chat/chat.js:279
↓ 5 callersFunctionrenderLocalCacheList
(type, items)
app/static/cache/cache.js:798
↓ 5 callersFunctionrequire_ok
(name: str, status: int, body: bytes, *, allow: set[int] | None = None)
scripts/smoke_test.py:52
↓ 5 callersFunctionsafeParseJson
(raw: string, fallback: T)
src/settings.ts:124
↓ 5 callersFunctionsetText
(id, value)
app/static/keys/keys.js:127
↓ 5 callersFunctionshowUserMsg
(role, content)
app/static/chat/chat.js:100
↓ 5 callersFunctionsyncToServer
()
app/static/token/token.js:734
↓ 5 callersFunctionupdateDeleteButton
()
app/static/cache/cache.js:614
↓ 5 callersFunctionupdateLoadButton
()
app/static/cache/cache.js:602
↓ 5 callersFunctionvalidateTokenType
(token_type: string)
src/routes/admin.ts:62
↓ 5 callersFunctionwithResponseHeaders
(res: Response, extra: Record<string, string>)
src/index.ts:29
↓ 4 callersFunction_as_int
(v: Any)
app/core/config.py:25
↓ 4 callersMethod_ensure_schema
确保数据库表存在
app/core/storage.py:491
↓ 4 callersFunction_normalize_limit
(v: Any)
app/api/v1/admin.py:375
↓ 4 callersMethod_proxies
构建代理配置
app/services/grok/assets.py:190
↓ 4 callersFunction_wrapped_stream
()
app/api/v1/image.py:695
↓ 4 callersFunctionbindRetryableImage
(img)
app/static/chat/chat.js:159
↓ 4 callersFunctionbuildImageJsonPayload
(field: ImageResponseFormat, values: string[])
src/routes/openai.ts:1077
↓ 4 callersFunctioncloseKeyModal
()
app/static/keys/keys.js:348
↓ 4 callersFunctioncreateStreamErrorImageEventStream
(args: { message: string; responseField: ImageResponseFormat; onFinish?: (result: { status: number; dura
src/routes/openai.ts:794
↓ 4 callersMethoddownload
下载文件到本地 Raises: UpstreamException: 下载失败
app/services/grok/assets.py:567
↓ 4 callersFunctionerror_response
构建 OpenAI 错误响应
app/core/exceptions.py:29
↓ 4 callersFunctionestimate_prompt_tokens
(value: Any, *, overhead: int = PROMPT_OVERHEAD)
app/services/compat/usage.py:35
↓ 4 callersFunctionestimate_tool_call_tokens
(tool_calls: list[Any])
app/services/compat/usage.py:42
↓ 4 callersFunctionextractErrorMessage
(payload, fallback = '请求失败')
app/static/keys/keys.js:95
↓ 4 callersMethodfeed
(self, chunk: str)
app/services/compat/tooling.py:151
↓ 4 callersMethodfetch
获取远程资源并转 Base64 Raises: UpstreamException: 当获取失败时
app/services/grok/assets.py:235
↓ 4 callersMethodflush
(self)
app/services/compat/tooling.py:158
↓ 4 callersFunctionflushStop
()
src/grok/processor.ts:229
↓ 4 callersFunctionfmtLimit
(v)
app/static/keys/keys.js:28
↓ 4 callersFunctionformatBytes
(sizeBytes: number)
src/routes/admin.ts:67
↓ 4 callersFunctionfromBase64
(base64)
app/static/common/admin-auth.js:16
↓ 4 callersMethodgen_id
生成 Statsig ID Returns: Base64 编码的 ID
app/services/grok/statsig.py:22
↓ 4 callersMethodget
获取模型信息
app/services/grok/model.py:176
↓ 4 callersFunctiongetUserApiKey
()
app/static/chat/chat.js:30
↓ 4 callersFunctionhttp_get
(url: str, *, headers: dict[str, str] | None = None, timeout: float = 5.0)
scripts/smoke_test.py:10
↓ 4 callersFunctionisContentModerationMessage
(message: string)
src/routes/openai.ts:123
↓ 4 callersFunctionisTokenInvalid
(item)
app/static/token/token.js:94
↓ 4 callersFunctionloadKeys
()
app/static/keys/keys.js:386
↓ 4 callersMethodload_tokens
(self)
app/core/storage.py:633
↓ 4 callersMethodmake
(name: str, arguments: Any)
app/services/compat/tooling.py:66
↓ 4 callersFunctionnormalizeImageGenerationMethod
(value: unknown)
src/settings.ts:143
↓ 4 callersFunctionnormalizeLimitInput
(raw)
app/static/keys/keys.js:279
↓ 4 callersFunctionnormalizeUsageValue
(v)
app/static/keys/keys.js:48
↓ 4 callersFunctionparseJsonSafely
(response)
app/static/keys/keys.js:106
↓ 4 callersFunctionparseRemainingValue
(v)
app/static/keys/keys.js:41
↓ 4 callersFunctionquotaError
(bucket: string)
src/routes/openai.ts:119
↓ 4 callersFunctionrenderTable
()
app/static/token/token.js:377
↓ 4 callersFunctionrender_generated_image
(token: str, url: str)
app/services/compat/media.py:9
↓ 4 callersFunctionsetActionButtonsState
()
app/static/token/token.js:1084
↓ 4 callersFunctionsetChatSendingState
(sending)
app/static/chat/chat.js:114
↓ 4 callersFunctionsetEmptyState
(visible, text = '')
app/static/keys/keys.js:120
↓ 4 callersFunctionsetImageContinuousError
(message)
app/static/chat/chat.js:497
↓ 4 callersFunctionsetSubmitState
(submitting)
app/static/keys/keys.js:270
↓ 4 callersFunctionstartBatchLoad
(tokens)
app/static/cache/cache.js:1057
↓ 4 callersFunctionsyncLocalSelectAllState
(type)
app/static/cache/cache.js:557
↓ 4 callersFunctiontoBase64
(bytes)
app/static/common/admin-auth.js:10
↓ 4 callersFunctionupdateImageModeUI
()
app/static/chat/chat.js:471
↓ 4 callersFunctionupdateSelectionState
()
app/static/token/token.js:500
↓ 4 callersMethodupload
上传文件到 Grok Returns: (file_id, file_uri) Raises: ValidationException: 输入无效
app/services/grok/assets.py:291
↓ 4 callersFunctionuploadImage
( imageInput: string, cookie: string, settings: GrokSettings, )
src/grok/upload.ts:34
↓ 4 callersMethodvalidate_key
验证 Key,返回 Key 信息
app/services/api_keys.py:405
↓ 3 callersMethod__init__
( self, message: str, error_type: str = ErrorType.SERVER.value, code: str = No
app/core/exceptions.py:51
↓ 3 callersFunction_as_bool
(v: Any)
app/core/config.py:34
↓ 3 callersMethod_build_headers
构建请求头
app/services/grok/media.py:53
↓ 3 callersMethod_build_proxies
构建代理
app/services/grok/media.py:89
← previousnext →101–200 of 1,181, ranked by callers