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
↓ 1 callers
Method
_flush_loop
(self)
app/services/token/manager.py:144
↓ 1 callers
Function
_format_log_line
(raw: str)
app/api/v1/admin.py:1148
↓ 1 callers
Function
_format_tool_definitions
(tools: list[dict[str, Any]])
app/services/compat/tooling.py:195
↓ 1 callers
Function
_gather_limited
( task_factories: List[Callable[[], Awaitable[List[str]]]], max_concurrency: int, )
app/api/v1/image.py:256
↓ 1 callers
Function
_get_delete_batch_size
()
app/services/grok/assets.py:65
↓ 1 callers
Function
_get_runtime_token
(model: str)
app/services/compat/common.py:259
↓ 1 callers
Function
_get_target
(storage_type: str, storage_url: str)
scripts/wait_for_storage.py:26
↓ 1 callers
Function
_get_usage_semaphore
()
app/services/grok/usage.py:26
↓ 1 callers
Method
_is_completed
(msg: Dict[str, Any], progress: Optional[float])
app/services/grok/imagine_experimental.py:140
↓ 1 callers
Method
_legacy_cache_path
Legacy cache path (data/temp).
app/services/grok/assets.py:561
↓ 1 callers
Function
_legacy_setting_to_config
Migrate legacy `data/setting.toml` format (grok/global) to the new config schema. Best-effort mapping only for stable fields. It does not de
app/core/config.py:48
↓ 1 callers
Method
_load_data
从磁盘加载统计数据
app/services/request_stats.py:48
↓ 1 callers
Method
_load_data
从磁盘加载日志数据
app/services/request_logger.py:52
↓ 1 callers
Method
_load_data
加载 API Keys
app/services/api_keys.py:50
↓ 1 callers
Function
_load_defaults
加载默认配置文件
app/core/config.py:207
↓ 1 callers
Function
_make_json_sink
创建 JSON sink
app/core/logger.py:54
↓ 1 callers
Function
_normalize_admin_token_item
(pool_name: str, item: Any)
app/api/v1/admin.py:416
↓ 1 callers
Function
_normalize_anthropic_content
(role: str, content: Any)
app/services/compat/anthropic_api.py:177
↓ 1 callers
Function
_normalize_asset_path
(raw: str)
app/services/compat/media.py:35
↓ 1 callers
Function
_normalize_asset_path
(raw_url: str)
app/services/grok/imagine_experimental.py:55
↓ 1 callers
Method
_normalize_input_token
(cls, token_str: str)
app/services/token/manager.py:170
↓ 1 callers
Function
_normalize_response_content
(content: Any)
app/services/compat/responses_api.py:234
↓ 1 callers
Function
_normalize_token_status
(raw_status: Any)
app/api/v1/admin.py:407
↓ 1 callers
Function
_normalize_tokens
(raw_token: str)
app/core/legacy_migration.py:206
↓ 1 callers
Function
_parse_alt_xml
(text: str)
app/services/compat/tooling.py:277
↓ 1 callers
Function
_parse_json_array
(text: str)
app/services/compat/tooling.py:264
↓ 1 callers
Function
_parse_json_envelope
(text: str)
app/services/compat/tooling.py:252
↓ 1 callers
Function
_parse_xml_tool_calls
(text: str)
app/services/compat/tooling.py:234
↓ 1 callers
Function
_pool_to_token_type
(pool_name: str)
app/api/v1/admin.py:384
↓ 1 callers
Function
_producer
()
app/api/v1/image.py:421
↓ 1 callers
Method
_rebuild_index
重建索引(预留接口,用于加载时调用)
app/services/token/pool.py:104
↓ 1 callers
Method
_refresh_loop
刷新循环
app/services/token/scheduler.py:20
↓ 1 callers
Function
_resolve_emit_think
(thinking: str | None)
app/services/compat/openai_chat.py:227
↓ 1 callers
Function
_run
(factory: Callable[[], Awaitable[List[str]]])
app/services/grok/imagine_generation.py:64
↓ 1 callers
Function
_run
(factory: Callable[[], Awaitable[List[str]]])
app/api/v1/image.py:262
↓ 1 callers
Function
_safe_json
(raw: str)
app/services/compat/anthropic_api.py:241
↓ 1 callers
Function
_safe_log_file_path
Resolve a log file name under ./logs safely.
app/api/v1/admin.py:1129
↓ 1 callers
Method
_save_usage_data
(self)
app/services/api_keys.py:171
↓ 1 callers
Function
_scan_removed_identifiers
()
scripts/check_model_catalog_sync.py:51
↓ 1 callers
Function
_split_at_boundary
(text: str, prefix: str)
app/services/compat/tooling.py:335
↓ 1 callers
Function
_split_csv_tags
(v: Any)
app/core/config.py:40
↓ 1 callers
Function
_stream_completion
(prepared, *, emit_think: bool)
app/services/compat/openai_chat.py:146
↓ 1 callers
Function
_stream_message
(prepared, *, emit_think: bool)
app/services/compat/anthropic_api.py:126
↓ 1 callers
Function
_synthetic_image_stream
( selected_images: List[str], response_field: str, )
app/api/v1/image.py:457
↓ 1 callers
Function
_text_stream
()
tests/test_responses_messages_api.py:32
↓ 1 callers
Method
_to_asset_urls
(file_uris: List[str])
app/services/grok/imagine_experimental.py:293
↓ 1 callers
Function
_tool_result_text
(content: Any)
app/services/compat/anthropic_api.py:223
↓ 1 callers
Function
_trigger_account_settings_refresh_background
( tokens: list[str], concurrency: int, retries: int, )
app/api/v1/admin.py:501
↓ 1 callers
Method
_tz_offset_minutes
(self)
app/services/api_keys.py:128
↓ 1 callers
Function
_upload_attachments
(token: str, attachments: list[str])
app/services/compat/common.py:282
↓ 1 callers
Function
_verify_ws_api_key
(websocket: WebSocket)
app/api/v1/admin.py:101
↓ 1 callers
Function
addTokens
(db: Env["DB"], tokens: string[], token_type: TokenType)
src/repo/tokens.ts:99
↓ 1 callers
Method
add_key
添加 API Key(支持自定义 key 与每日额度)
app/services/api_keys.py:190
↓ 1 callers
Function
appendCacheBust
(url)
app/static/chat/chat.js:123
↓ 1 callers
Function
appendWaterfallImage
(item, connectionIndex)
app/static/chat/chat.js:511
↓ 1 callers
Function
applyLogFilter
(rawLines)
app/static/datacenter/datacenter.js:195
↓ 1 callers
Function
applyRuntimeUiFlags
()
app/static/token/token.js:203
↓ 1 callers
Function
autoLoadOnlineAssets
()
app/static/cache/cache.js:37
↓ 1 callers
Function
batchAddApiKeys
( db: Env["DB"], name_prefix: string, count: number, )
src/repo/apiKeys.ts:59
↓ 1 callers
Function
batchDeleteApiKeys
(db: Env["DB"], keys: string[])
src/repo/apiKeys.ts:100
↓ 1 callers
Function
batchUpdateApiKeyStatus
( db: Env["DB"], keys: string[], is_active: boolean, )
src/repo/apiKeys.ts:115
↓ 1 callers
Function
bearerToken
(authHeader: string | null)
src/auth.ts:14
↓ 1 callers
Function
bindFileInputs
()
app/static/chat/chat.js:340
↓ 1 callers
Function
bindRetryableImages
(root)
app/static/chat/chat.js:177
↓ 1 callers
Function
buildAnthropicJsonFromChat
( model: string, chat: Record<string, unknown>, )
src/grok/compat.ts:94
↓ 1 callers
Function
buildCharts
()
app/static/datacenter/datacenter.js:35
↓ 1 callers
Function
buildImageRequestConfig
()
app/static/chat/chat.js:1111
↓ 1 callers
Function
buildImagineWsPayload
(prompt: string, requestId: string, aspectRatio: string)
src/grok/imagineExperimental.ts:133
↓ 1 callers
Function
buildImagineWsUrl
()
app/static/chat/chat.js:553
↓ 1 callers
Function
buildLimitsPayload
()
app/static/keys/keys.js:287
↓ 1 callers
Function
buildResponsesJsonFromChat
( model: string, chat: Record<string, unknown>, )
src/grok/compat.ts:43
↓ 1 callers
Function
buildToolChoiceInstruction
(toolChoice: unknown)
src/grok/tooling.ts:179
↓ 1 callers
Function
buildToolSystemPrompt
(tools: Array<Record<string, unknown>>, toolChoice: unknown)
src/grok/tooling.ts:79
↓ 1 callers
Function
buildVideoPosterPreview
(videoUrl: string, posterUrl?: string)
src/grok/processor.ts:108
↓ 1 callers
Function
buildVideoTag
(src: string)
src/grok/processor.ts:104
↓ 1 callers
Method
build_payload
构造请求体 Args: message: 消息文本 model: 模型名称 mode: 模型模式 think: 是否开启思考 f
app/services/grok/chat.py:192
↓ 1 callers
Function
build_tool_system_prompt
(tools: list[dict[str, Any]], tool_choice: Any = None)
app/services/compat/tooling.py:84
↓ 1 callers
Function
calcPercent
(processed, total)
app/static/cache/cache.js:219
↓ 1 callers
Method
chat_openai
OpenAI 兼容接口
app/services/grok/chat.py:392
↓ 1 callers
Function
cleanNode
(node)
app/static/chat/chat.js:241
↓ 1 callers
Function
cleanup
()
src/grok/imagineExperimental.ts:250
↓ 1 callers
Function
clearOnlineCacheBatch
(tokens = [])
app/static/cache/cache.js:1243
↓ 1 callers
Function
clearRequestLogs
(db: Env["DB"])
src/repo/logs.ts:51
↓ 1 callers
Function
clearSelectedAccounts
()
app/static/cache/cache.js:1168
↓ 1 callers
Function
closeAddModal
()
app/static/token/token.js:543
↓ 1 callers
Function
closeEditModal
()
app/static/token/token.js:655
↓ 1 callers
Function
closeImportModal
()
app/static/token/token.js:785
↓ 1 callers
Method
completions
Chat Completions 入口 Args: model: 模型名称 messages: 消息列表 stream: 是否流式 thinking:
app/services/grok/chat.py:448
↓ 1 callers
Method
consume
消耗配额(本地预估) Args: token_str: Token 字符串 effort: 消耗力度 Returns: 是否成功
app/services/token/manager.py:233
↓ 1 callers
Method
consume_daily_usage
Consume per-day quota for the given API key. incs keys: chat_used/heavy_used/image_used/video_used
app/services/api_keys.py:336
↓ 1 callers
Method
consume_heavy
消耗 heavy 配额(本地预估)。 当 heavy_quota 为 -1(未知)时,不扣减配额,仅记录一次使用。
app/services/token/models.py:127
↓ 1 callers
Method
convert_url
(self, token: str, url: str, response_format: str = "b64_json")
app/services/grok/imagine_experimental.py:288
↓ 1 callers
Function
copyToClipboard
(text, btn)
app/static/config/config.js:365
↓ 1 callers
Method
count
统计资产数量(不保留明细)
app/services/grok/assets.py:429
↓ 1 callers
Method
count
Token 数量
app/services/token/pool.py:75
↓ 1 callers
Function
createAnthropicStreamFromChatStream
( source: ReadableStream<Uint8Array>, model: string, )
src/grok/compat.ts:328
↓ 1 callers
Function
createExperimentalImageEventStream
(args: { prompt: string; n: number; cookie: string; settings: Awaited<ReturnType<typeof getSettings>>[
src/routes/openai.ts:841
↓ 1 callers
Function
createPost
( fileUri: string, cookie: string, settings: GrokSettings, )
src/grok/create.ts:38
↓ 1 callers
Function
createResponsesStreamFromChatStream
( source: ReadableStream<Uint8Array>, model: string, )
src/grok/compat.ts:140
↓ 1 callers
Function
create_app
创建 FastAPI 应用
main.py:89
← previous
next →
501–600 of 1,181, ranked by callers