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
_file_lock
(name: str, timeout: int = 10)
app/services/grok/assets.py:74
↓ 2 callers
Function
_format_json
格式化日志
app/core/logger.py:16
↓ 2 callers
Function
_gen
()
tests/test_responses_messages_api.py:25
↓ 2 callers
Function
_get_media_semaphore
()
app/services/grok/media.py:32
↓ 2 callers
Function
_get_token_for_model
获取指定模型可用 token,失败时抛出统一异常
app/api/v1/image.py:513
↓ 2 callers
Method
_headers
(self, token: str, referer: str = "https://grok.com/imagine")
app/services/grok/imagine_experimental.py:79
↓ 2 callers
Method
_load
初始化加载
app/services/token/manager.py:45
↓ 2 callers
Function
_load_legacy_api_keys
Backward-compatible API keys loader. Older versions stored multiple API keys in `data/api_keys.json` with a shape like: [{"key": "...",
app/core/auth.py:31
↓ 2 callers
Function
_make_app
()
tests/test_auth_headers.py:8
↓ 2 callers
Function
_parse_quota_value
(v: Any)
app/api/v1/admin.py:388
↓ 2 callers
Method
_proxies
(self)
app/services/grok/imagine_experimental.py:76
↓ 2 callers
Method
_rand
生成随机字符串
app/services/grok/statsig.py:16
↓ 2 callers
Function
_refresh_one
(t)
app/api/v1/admin.py:759
↓ 2 callers
Function
_resolve_nsfw_refresh_concurrency
(override: Any = None)
app/api/v1/admin.py:483
↓ 2 callers
Function
_resolve_nsfw_refresh_retries
(override: Any = None)
app/api/v1/admin.py:492
↓ 2 callers
Function
_resolve_output_index
(raw_index: int)
app/api/v1/image.py:369
↓ 2 callers
Function
_run
(prompt: str, aspect_ratio: str)
app/api/v1/admin.py:162
↓ 2 callers
Function
_run_one
(token: str)
app/core/legacy_migration.py:250
↓ 2 callers
Function
_safe_int
(v: Any, default: int = 0)
app/api/v1/admin.py:400
↓ 2 callers
Method
_save_data
保存统计数据到磁盘
app/services/request_stats.py:79
↓ 2 callers
Method
_save_data
保存日志数据到磁盘
app/services/request_logger.py:75
↓ 2 callers
Method
_sse
构建 SSE 响应 (覆盖基类)
app/services/grok/processor.py:455
↓ 2 callers
Function
_stream_response
(prepared, *, emit_think: bool)
app/services/compat/responses_api.py:180
↓ 2 callers
Function
_stream_tool_calls
(response_id: str, model: str, calls: list[ParsedToolCall])
app/services/compat/openai_chat.py:208
↓ 2 callers
Function
_tool_xml_stream
()
tests/test_responses_messages_api.py:15
↓ 2 callers
Function
_try_repair_json
(raw: str)
app/services/compat/tooling.py:328
↓ 2 callers
Function
_wrapped_experimental_stream
()
app/api/v1/image.py:597
↓ 2 callers
Method
accept_tos_version
( self, sso: str, sso_rw: str, impersonate: str, user_agent: Optional[
app/services/account/user_agreement_service.py:19
↓ 2 callers
Function
addApiKey
( db: Env["DB"], name: string, opts?: { key?: string; limits?: Partial<ApiKeyLimits> }, )
src/repo/apiKeys.ts:38
↓ 2 callers
Function
addAttachments
(kind, files)
app/static/chat/chat.js:356
↓ 2 callers
Function
assetFetchError
(message: string, buildSha: string)
src/index.ts:35
↓ 2 callers
Function
authError
(message: string, code: string)
src/auth.ts:27
↓ 2 callers
Function
base64UrlDecode
(input: string)
src/routes/media.ts:35
↓ 2 callers
Function
base64UrlEncode
(bytes: Uint8Array)
src/utils/crypto.ts:1
↓ 2 callers
Function
base64UrlEncode
(input: string)
src/grok/processor.ts:128
↓ 2 callers
Function
base64UrlEncodeString
(input: string)
src/routes/openai.ts:209
↓ 2 callers
Function
base64UrlEncodeString
(input: string)
src/routes/admin.ts:98
↓ 2 callers
Function
baseUrlFromSettings
(settingsBundle: Awaited<ReturnType<typeof getSettings>>, origin: string)
src/routes/openai.ts:1142
↓ 2 callers
Function
buildExperimentalImageEditPayload
(args: { prompt: string; imageReferences: string[]; modelName: "imagine-image-edit" | "grok-3"; })
src/grok/imagineExperimental.ts:282
↓ 2 callers
Function
buildVideoHtml
(args: { videoUrl: string; posterUrl?: string; posterPreview: boolean })
src/grok/processor.ts:123
↓ 2 callers
Function
build_chat_usage
(prompt: str, *, text: str = "", thinking: str = "", tool_calls: list[Any] | None = None)
app/services/compat/openai_chat.py:31
↓ 2 callers
Method
build_headers
构造请求头
app/services/grok/chat.py:155
↓ 2 callers
Function
cacheUI
()
app/static/cache/cache.js:86
↓ 2 callers
Function
calc
(type: "sso" | "ssoSuper")
src/routes/admin.ts:1176
↓ 2 callers
Function
call_experimental_generation_once
( token: str, prompt: str, response_format: str = "b64_json", n: int = 4, aspect_ratio: st
app/services/grok/imagine_generation.py:71
↓ 2 callers
Function
call_grok_experimental_edit
( token: str, prompt: str, model_id: str, file_uris: List[str], response_format: str = "b6
app/api/v1/image.py:319
↓ 2 callers
Method
chat_edit
( self, token: str, prompt: str, file_uris: List[str], )
app/services/grok/imagine_experimental.py:347
↓ 2 callers
Method
check_limit
检查并清理缓存限制
app/services/grok/assets.py:796
↓ 2 callers
Function
classify_line
(line: str | bytes)
app/services/compat/stream_adapter.py:11
↓ 2 callers
Function
collectExperimentalGenerationImages
(args: { prompt: string; n: number; cookie: string; settings: Awaited<ReturnType<typeof getSettings>>[
src/routes/openai.ts:637
↓ 2 callers
Function
collectImageUrls
(resp: Response)
src/routes/openai.ts:348
↓ 2 callers
Function
collect_experimental_generation_images
( token: str, prompt: str, n: int, response_format: str, aspect_ratio: str, concurrenc
app/services/grok/imagine_generation.py:88
↓ 2 callers
Method
convert_urls
(self, token: str, urls: Iterable[str], response_format: str = "b64_json")
app/services/grok/imagine_experimental.py:255
↓ 2 callers
Function
copyToClipboard
(text, silent = false)
app/static/keys/keys.js:259
↓ 2 callers
Function
createAdminSession
(db: Env["DB"], expireHours = DEFAULT_EXPIRE_HOURS)
src/repo/adminSessions.ts:8
↓ 2 callers
Function
createImageCard
(index)
app/static/chat/chat.js:1056
↓ 2 callers
Function
createMediaPost
( args: { mediaType: MediaPostType; prompt?: string; mediaUrl?: string }, cookie: string, settings: Grok
src/grok/create.ts:8
↓ 2 callers
Method
create_post
创建媒体帖子 Args: token: 认证 Token prompt: 提示词(视频生成用) media_type: 媒体类型 (MEDIA_POST_TYPE_VIDEO
app/services/grok/media.py:93
↓ 2 callers
Function
deleteApiKey
(db: Env["DB"], key: string)
src/repo/apiKeys.ts:93
↓ 2 callers
Function
deleteCacheRows
(db: Env["DB"], keys: string[])
src/repo/cache.ts:39
↓ 2 callers
Method
delete_all
删除所有文件
app/services/grok/assets.py:490
↓ 2 callers
Function
deriveKey
(salt)
app/static/common/admin-auth.js:49
↓ 2 callers
Function
emitPartial
(index: number, progress: number)
src/routes/openai.ts:862
↓ 2 callers
Method
enable_nsfw
( self, sso: str, sso_rw: str, impersonate: str, user_agent: Optional[
app/services/account/nsfw_service.py:19
↓ 2 callers
Function
ensureUsageRow
(db: Env["DB"], key: string, day: string, atMs: number)
src/repo/apiKeyUsage.ts:50
↓ 2 callers
Function
escapeHtml
(s)
app/static/chat/chat.js:39
↓ 2 callers
Function
extractApiToken
(req: { header(name: string): string | undefined | null })
src/auth.ts:20
↓ 2 callers
Function
extract_status
(e: Exception)
app/services/grok/retry.py:84
↓ 2 callers
Method
feed
(self, data: str)
app/services/compat/stream_adapter.py:45
↓ 2 callers
Method
feedCapturing
(chunk: string)
src/grok/tooling.ts:167
↓ 2 callers
Function
generateApiKey
()
src/utils/crypto.ts:11
↓ 2 callers
Method
generate_key
生成一个新的 sk- 开头的 key
app/services/api_keys.py:182
↓ 2 callers
Method
generate_name
生成一个随机 key 名称
app/services/api_keys.py:186
↓ 2 callers
Method
generate_ws
( self, token: str, prompt: str, n: int = 2, aspect_ratio: str = "2:3"
app/services/grok/imagine_experimental.py:148
↓ 2 callers
Function
getActiveSelectedSet
()
app/static/cache/cache.js:688
↓ 2 callers
Function
getImageContinuousActiveCount
()
app/static/chat/chat.js:399
↓ 2 callers
Function
getImageContinuousOpenCount
()
app/static/chat/chat.js:403
↓ 2 callers
Function
getRequestLogs
(db: Env["DB"], limit = 1000)
src/repo/logs.ts:43
↓ 2 callers
Function
getRequestStats
(db: Env["DB"])
src/repo/logs.ts:83
↓ 2 callers
Function
getSelectedChatModel
()
app/static/chat/chat.js:204
↓ 2 callers
Function
getStoredAppKey
()
app/static/common/admin-auth.js:126
↓ 2 callers
Function
getText
(section, key)
app/static/config/config.js:71
↓ 2 callers
Method
get_all_keys
获取所有 Keys
app/services/api_keys.py:426
↓ 2 callers
Method
get_key_row
获取 Key 原始记录(不要求 active)
app/services/api_keys.py:317
↓ 2 callers
Function
get_scheduler
获取调度器单例
app/services/token/scheduler.py:96
↓ 2 callers
Function
guessExtFromMime
(mime: string)
src/grok/upload.ts:18
↓ 2 callers
Function
imageFormatDefault
(settingsBundle: Awaited<ReturnType<typeof getSettings>>)
src/routes/openai.ts:1150
↓ 2 callers
Function
invalidStreamNMessage
()
src/routes/openai.ts:1041
↓ 2 callers
Function
isAutoRefresh
()
app/static/datacenter/datacenter.js:30
↓ 2 callers
Function
isSuccessStatus
(status: number)
src/repo/logs.ts:62
↓ 2 callers
Function
isUuid
(s: string)
src/routes/media.ts:49
↓ 2 callers
Function
isValidImageModel
(model: string)
src/routes/openai.ts:1031
↓ 2 callers
Method
is_heavy_bucket_model
是否使用 heavy 配额桶(目前仅 grok-4-heavy)。
app/services/grok/model.py:205
↓ 2 callers
Method
list
(self)
tests/test_admin_token_nsfw_refresh.py:11
↓ 2 callers
Function
listApiKeys
(db: Env["DB"])
src/repo/apiKeys.ts:24
↓ 2 callers
Function
listCacheRowsByType
( db: Env["DB"], type: CacheType, limit: number, offset: number, )
src/repo/cache.ts:56
↓ 2 callers
Function
listOldestRows
( db: Env["DB"], type: CacheType | null, beforeMs: number | null, limit: number, )
src/repo/cache.ts:71
↓ 2 callers
Function
localDayString
(now = nowMs(), tzOffsetMinutes = 480)
src/repo/apiKeyUsage.ts:21
↓ 2 callers
Function
makeToolCallChunks
( id: string, created: number, model: string, calls: ParsedToolCall[], )
src/grok/processor.ts:66
↓ 2 callers
Function
make_message_id
()
app/services/compat/anthropic_api.py:17
← previous
next →
301–400 of 1,181, ranked by callers