Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/TQZHR/grok2api
/ functions
Functions
1,181 in github.com/TQZHR/grok2api
⨍
Functions
1,181
◇
Types & classes
114
↳
Endpoints
45
↓ 2 callers
Function
make_response_object
(model: str, response_id: str, artifacts: ChatArtifacts)
app/services/compat/responses_api.py:100
↓ 2 callers
Method
mark_asset_clear
Record online asset cleanup timestamp.
app/services/token/manager.py:404
↓ 2 callers
Function
messages_create
( *, model: str, messages: list[dict[str, Any]], system: str | list[Any] | None, stream: b
app/services/compat/anthropic_api.py:91
↓ 2 callers
Function
nextLocalMidnightExpirationSeconds
(now = nowMs(), tzOffsetMinutes: number)
src/kv/cleanup.ts:34
↓ 2 callers
Function
nonEmptyPromptOrError
(prompt: string)
src/routes/openai.ts:1113
↓ 2 callers
Function
normalizeGeneratedAssetUrls
(input: unknown)
src/grok/processor.ts:146
↓ 2 callers
Function
normalizeGeneratedImageUrls
(input: unknown)
src/routes/openai.ts:254
↓ 2 callers
Function
normalizeSsoToken
(raw: string)
src/routes/admin.ts:74
↓ 2 callers
Function
normalizeTokenRecord
(pool, raw)
app/static/token/token.js:67
↓ 2 callers
Function
pad2
(n: number)
src/repo/apiKeyUsage.ts:17
↓ 2 callers
Function
parseChunk
(line: string)
src/grok/compat.ts:129
↓ 2 callers
Function
parseImageCount
(input: unknown)
src/routes/openai.ts:517
↓ 2 callers
Function
parseImageModel
(input: unknown, fallback: string)
src/routes/openai.ts:527
↓ 2 callers
Function
parseImagePrompt
(input: unknown)
src/routes/openai.ts:523
↓ 2 callers
Function
parseImageStream
(input: unknown)
src/routes/openai.ts:531
↓ 2 callers
Function
parseIntSafe
(v: string | undefined, fallback: number)
src/routes/media.ts:29
↓ 2 callers
Function
parseQuotaValue
(v)
app/static/token/token.js:40
↓ 2 callers
Function
parseTags
(tagsJson: string)
src/repo/tokens.ts:24
↓ 2 callers
Function
parse_sso_pair
(raw_token: str)
app/services/account/account_settings_refresh.py:31
↓ 2 callers
Function
parse_tool_calls
(text: str, available_tools: list[str] | None = None)
app/services/compat/tooling.py:123
↓ 2 callers
Method
process
处理并收集图片
app/services/grok/processor.py:549
↓ 2 callers
Function
processBatchQueue
()
app/static/cache/cache.js:1091
↓ 2 callers
Function
processBatchQueue
()
app/static/token/token.js:978
↓ 2 callers
Function
processDeleteQueue
()
app/static/cache/cache.js:1204
↓ 2 callers
Function
processDeleteQueue
()
app/static/token/token.js:1166
↓ 2 callers
Function
randomString
(length: number, lettersOnly = true)
src/grok/headers.ts:19
↓ 2 callers
Function
readToolCalls
(chat: Record<string, unknown>)
src/grok/compat.ts:25
↓ 2 callers
Function
refresh_account_settings_for_tokens
( tokens: Iterable[str], concurrency: int | None = None, retries: int | None = None, )
app/services/account/account_settings_refresh.py:176
↓ 2 callers
Method
reload
重新加载 Token 池数据
app/services/token/manager.py:91
↓ 2 callers
Function
renderAccountTable
(data)
app/static/cache/cache.js:342
↓ 2 callers
Function
requestDeleteLocalFile
(type, name)
app/static/cache/cache.js:870
↓ 2 callers
Method
reset
重置配额到默认值
app/services/token/models.py:149
↓ 2 callers
Function
resetImageContinuousMetrics
(resetCount)
app/static/chat/chat.js:502
↓ 2 callers
Function
resolveImageResponseFormatByMethodOrError
( raw: unknown, defaultMode: string, imageMethod: ReturnType<typeof resolveImageGenerationMethod>, )
src/routes/openai.ts:1162
↓ 2 callers
Function
resolve_aspect_ratio
(size: Optional[str])
app/api/v1/image.py:244
↓ 2 callers
Function
resolve_image_generation_method
(raw: Any)
app/services/grok/imagine_experimental.py:45
↓ 2 callers
Function
resolve_image_response_format
Keep legacy behavior, but for experimental imagine path: if caller does not explicitly provide response_format and global default is `url`,
app/api/v1/image.py:213
↓ 2 callers
Function
responseUsage
(chat: Record<string, unknown>)
src/grok/compat.ts:30
↓ 2 callers
Function
response_field_name
(response_format: str)
app/api/v1/image.py:230
↓ 2 callers
Function
runImageCall
(args: { requestModel: string; prompt: string; fileIds: string[]; cookie: string; settings: Awaited<
src/routes/openai.ts:572
↓ 2 callers
Function
runImageStreamCall
(args: { requestModel: string; prompt: string; fileIds: string[]; cookie: string; settings: Awaited<
src/routes/openai.ts:611
↓ 2 callers
Function
runTasksSettledWithLimit
( items: T[], limit: number, fn: (item: T) => Promise<R>, )
src/routes/openai.ts:74
↓ 2 callers
Function
saveSettings
( env: Env, updates: { global_config?: GlobalSettings; grok_config?: GrokSettings; token_confi
src/settings.ts:216
↓ 2 callers
Method
save_config
(self, data: Dict[str, Any])
app/core/storage.py:609
↓ 2 callers
Method
select
选择一个可用 Token 策略: 1. 选择 active 状态且有配额的 token 2. 优先选择剩余额度最多的 3. 如果额度相同,随机选择(避免并发冲突)
app/services/token/pool.py:31
↓ 2 callers
Function
sendExperimentalImageEditRequest
(args: { prompt: string; fileUris: string[]; cookie: string; settings: GrokSettings; })
src/grok/imagineExperimental.ts:330
↓ 2 callers
Function
serializeCreds
(creds)
app/static/common/admin-auth.js:119
↓ 2 callers
Function
setLoading
(loading)
app/static/keys/keys.js:114
↓ 2 callers
Function
setNsfwRefreshUiEnabled
(enabled)
app/static/token/token.js:176
↓ 2 callers
Function
showCacheSection
(type)
app/static/cache/cache.js:722
↓ 2 callers
Function
startBatchDelete
(tokens)
app/static/cache/cache.js:1186
↓ 2 callers
Function
stopRun
(sendStatus: boolean)
src/routes/admin.ts:428
↓ 2 callers
Function
streamChat
(body, bubbleEl, commitHistory = true)
app/static/chat/chat.js:1013
↓ 2 callers
Function
syncSelectAllState
()
app/static/cache/cache.js:579
↓ 2 callers
Function
toAbsoluteUrl
(url)
app/static/chat/chat.js:48
↓ 2 callers
Function
toImageDataUrl
(raw)
app/static/chat/chat.js:70
↓ 2 callers
Function
toIsoDateKey
(ts: number)
src/repo/logs.ts:75
↓ 2 callers
Function
toIsoHourKey
(ts: number)
src/repo/logs.ts:66
↓ 2 callers
Function
toMb
(b: number)
src/routes/admin.ts:214
↓ 2 callers
Function
try_parse_json
(body: bytes)
scripts/smoke_test.py:60
↓ 2 callers
Function
updateApiKeyName
(db: Env["DB"], key: string, name: string)
src/repo/apiKeys.ts:127
↓ 2 callers
Function
updateStorageModeButton
()
app/static/common/admin-auth.js:228
↓ 2 callers
Method
update_quota
更新配额(用于 API 同步) Args: new_quota: 新的配额值
app/services/token/models.py:101
↓ 2 callers
Function
uploadImages
(files)
app/static/chat/chat.js:900
↓ 2 callers
Function
upsertCacheRow
(db: Env["DB"], row: CacheRow)
src/repo/cache.ts:16
↓ 2 callers
Method
usage_for_day
返回指定 day 的 usage map: { key: {chat_used,...} }
app/services/api_keys.py:324
↓ 2 callers
Function
validateApiKey
(db: Env["DB"], key: string)
src/repo/apiKeys.ts:167
↓ 2 callers
Function
wsSleep
(ms: number)
src/routes/admin.ts:135
↓ 2 callers
Function
xorCipher
(bytes, keyBytes)
app/static/common/admin-auth.js:25
↓ 1 callers
Method
__init__
(self, proxy: str = None)
app/services/grok/assets.py:149
↓ 1 callers
Function
_apply_legacy_config
Merge legacy settings into current config: - fill missing keys - override keys that are still default values
app/core/config.py:142
↓ 1 callers
Function
_as_int
(value: str | None, default: int)
scripts/wait_for_storage.py:19
↓ 1 callers
Function
_build_choice_instruction
(tool_choice: Any)
app/services/compat/tooling.py:214
↓ 1 callers
Method
_build_headers
构建请求头
app/services/grok/usage.py:47
↓ 1 callers
Method
_build_proxies
构建代理配置
app/services/grok/usage.py:83
↓ 1 callers
Function
_build_token_pattern
(token: str)
scripts/check_model_catalog_sync.py:45
↓ 1 callers
Method
_build_video_html
构建视频 HTML 标签
app/services/grok/processor.py:298
↓ 1 callers
Method
_build_video_html
(self, video_url: str, thumbnail_url: str = "")
app/services/grok/processor.py:375
↓ 1 callers
Method
_build_ws_payload
( prompt: str, request_id: str, aspect_ratio: str = "2:3", )
app/services/grok/imagine_experimental.py:86
↓ 1 callers
Function
_cache_local_url
(service: DownloadService, token: str, url: str)
app/services/compat/media.py:25
↓ 1 callers
Method
_cache_path
获取缓存路径
app/services/grok/assets.py:555
↓ 1 callers
Method
_cleanup
清理过期数据
app/services/request_stats.py:131
↓ 1 callers
Function
_clear_one
(t: str)
app/api/v1/admin.py:1023
↓ 1 callers
Function
_coerce_system
(system: str | list[Any] | None)
app/services/compat/anthropic_api.py:232
↓ 1 callers
Function
_coerce_text
(value: Any)
app/services/compat/usage.py:17
↓ 1 callers
Function
_coerce_tool_result
(message: dict[str, Any])
app/services/compat/common.py:244
↓ 1 callers
Function
_collect_completion
(prepared, *, emit_think: bool)
app/services/compat/openai_chat.py:134
↓ 1 callers
Function
_collect_imagine_batch
(token: str, prompt: str, aspect_ratio: str)
app/api/v1/admin.py:120
↓ 1 callers
Function
_collect_message
(prepared, *, emit_think: bool)
app/services/compat/anthropic_api.py:114
↓ 1 callers
Function
_collect_python_model_ids
(text: str)
scripts/check_model_catalog_sync.py:37
↓ 1 callers
Function
_collect_response
(prepared, *, emit_think: bool)
app/services/compat/responses_api.py:168
↓ 1 callers
Function
_collect_workers_model_ids
(text: str)
scripts/check_model_catalog_sync.py:41
↓ 1 callers
Method
_dl_headers
构建下载请求头
app/services/grok/assets.py:194
↓ 1 callers
Function
_experimental_stream_generation
( token: str, prompt: str, n: int, response_format: str, response_field: str, aspect_r
app/api/v1/image.py:354
↓ 1 callers
Function
_ext_from_mime
(mime: str)
app/api/v1/uploads.py:20
↓ 1 callers
Method
_extract_cookie_value
(cookie_str: str, name: str)
app/services/token/manager.py:158
↓ 1 callers
Function
_extract_outermost_json_obj
(text: str)
app/services/compat/tooling.py:295
↓ 1 callers
Method
_extract_progress
(msg: Dict[str, Any])
app/services/grok/imagine_experimental.py:123
↓ 1 callers
Method
_extract_url
(msg: Dict[str, Any])
app/services/grok/imagine_experimental.py:115
↓ 1 callers
Method
_feed_scanning
(self, chunk: str)
app/services/compat/tooling.py:168
← previous
next →
401–500 of 1,181, ranked by callers