MCPcopy Create free account

hub / github.com/TQZHR/grok2api / functions

Functions1,181 in github.com/TQZHR/grok2api

↓ 3 callersFunction_deep_merge
深度合并字典:override 覆盖 base。
app/core/config.py:190
↓ 3 callersMethod_find_token_info
(self, token_str: str)
app/services/token/manager.py:180
↓ 3 callersFunction_format_step_error
(result: dict, fallback: str = "unknown error")
app/services/account/account_settings_refresh.py:62
↓ 3 callersFunction_get_assets_semaphore
()
app/services/grok/assets.py:52
↓ 3 callersMethod_get_session
获取复用 Session
app/services/grok/assets.py:213
↓ 3 callersMethod_headers
构建请求头
app/services/grok/assets.py:154
↓ 3 callersFunction_image_generation_method
()
app/api/v1/image.py:238
↓ 3 callersFunction_is_valid_image_value
(value: Any)
app/api/v1/image.py:248
↓ 3 callersMethod_load_usage_data
Load per-day per-key usage counters.
app/services/api_keys.py:142
↓ 3 callersMethod_normalize_key_row
(self, row: Dict[str, Any])
app/services/api_keys.py:111
↓ 3 callersFunction_parse_json_tolerant
(raw: str)
app/services/compat/tooling.py:319
↓ 3 callersFunction_pick_images
(all_images: List[str], n: int)
app/api/v1/image.py:539
↓ 3 callersFunction_read_text
(path: Path)
scripts/check_model_catalog_sync.py:33
↓ 3 callersFunction_stop_run
()
app/api/v1/admin.py:148
↓ 3 callersFunctionapplyKeyFilters
()
app/static/keys/keys.js:137
↓ 3 callersFunctionapplyToolsToPrompt
( content: string, tools: Array<Record<string, unknown>> | null | undefined, toolChoice: unknown, )
src/routes/openai.ts:1063
↓ 3 callersFunctionarrayBufferToBase64
(buf: ArrayBuffer)
src/utils/base64.ts:1
↓ 3 callersFunctionattachAssistantRetryAction
(bubbleEl)
app/static/chat/chat.js:182
↓ 3 callersFunctioncall_grok_legacy
调用 Grok 获取图片,返回图片列表
app/api/v1/image.py:269
↓ 3 callersFunctionclampProgress
(input: unknown)
src/grok/imagineExperimental.ts:69
↓ 3 callersFunctioncloseConfirm
(ok)
app/static/token/token.js:1153
↓ 3 callersFunctioncloseDrawer
()
app/static/common/header.js:13
↓ 3 callersFunctioncollect_chat_artifacts
(prepared: PreparedChatRequest, *, emit_think: bool)
app/services/compat/common.py:107
↓ 3 callersFunctionconfirmAction
(message, options = {})
app/static/token/token.js:1133
↓ 3 callersFunctioncreateImageEventStream
(args: { upstream: Response; responseFormat: ImageResponseFormat; baseUrl: string; cookie: string; s
src/routes/openai.ts:372
↓ 3 callersFunctioncreateOpenAiStreamFromGrokNdjson
( grokResp: Response, opts: { cookie: string; settings: GrokSettings; global: GlobalSettings;
src/grok/processor.ts:169
↓ 3 callersFunctionderiveKeyState
(row)
app/static/keys/keys.js:83
↓ 3 callersFunctiondisplayKey
(key: string)
src/utils/crypto.ts:23
↓ 3 callersFunctionemitCompleted
()
src/grok/compat.ts:158
↓ 3 callersFunctionenforce_daily_quota
Enforce per-day quotas for a non-admin API key. - chat/heavy/video: count by request (1) - image: count by generated images - chat
app/services/quota.py:15
↓ 3 callersMethodextract
从 OpenAI 消息格式提取内容 Args: messages: OpenAI 格式消息列表 is_video: 是否为视频模型 Returns:
app/services/grok/chat.py:53
↓ 3 callersFunctionextractContent
(messages: OpenAIChatMessage[])
src/grok/conversation.ts:27
↓ 3 callersFunctionfindTokenIndexByKey
(tokenKey)
app/static/token/token.js:115
↓ 3 callersFunctionfinishBatchProcess
(aborted = false)
app/static/token/token.js:1039
↓ 3 callersFunctionformatTime
(ms)
app/static/cache/cache.js:213
↓ 3 callersFunctiongenerateImagineWs
(args: { prompt: string; n: number; cookie: string; settings: GrokSettings; timeoutMs?: number; as
src/grok/imagineExperimental.ts:158
↓ 3 callersFunctiongetAssets
(env: Env)
src/index.ts:10
↓ 3 callersFunctiongetKvStats
(db: Env["DB"])
src/routes/admin.ts:192
↓ 3 callersFunctiongetRefreshProgress
(db: Env["DB"])
src/repo/refreshProgress.ts:14
↓ 3 callersMethodget_pool_tokens
获取指定池的所有 Token Args: pool_name: 池名称 Returns: Token 列表
app/services/token/manager.py:512
↓ 3 callersFunctionimageGenerationMethod
(settingsBundle: Awaited<ReturnType<typeof getSettings>>)
src/routes/openai.ts:633
↓ 3 callersFunctionisDebugRequest
(c: any)
src/index.ts:21
↓ 3 callersFunctionisTokenActive
(item)
app/static/token/token.js:107
↓ 3 callersFunctionisToolCapableModel
(model: string)
src/routes/openai.ts:1058
↓ 3 callersMethoditer_assets
分页迭代资产列表
app/services/grok/assets.py:360
↓ 3 callersFunctioniterate_chat_events
(raw_stream)
app/services/compat/common.py:153
↓ 3 callersMethodload
显式加载配置
app/core/config.py:236
↓ 3 callersFunctionloadLocalCacheList
(type)
app/static/cache/cache.js:770
↓ 3 callersFunctionmakeDeltaChunk
( id: string, created: number, model: string, delta: Record<string, unknown>, finish_reason?: Stream
src/grok/processor.ts:39
↓ 3 callersFunctionmake_chat_response_id
()
app/services/compat/openai_chat.py:27
↓ 3 callersFunctionparseIntSafe
(v: string | undefined, fallback: number)
src/routes/openai.ts:113
↓ 3 callersFunctionparseOpenAiFromGrokNdjson
( grokResp: Response, opts: { cookie: string; settings: GrokSettings; global: GlobalSettings;
src/grok/processor.ts:497
↓ 3 callersFunctionparseToolCalls
(text: string, availableTools?: string[])
src/grok/tooling.ts:118
↓ 3 callersFunctionpick
(token_type: TokenType)
src/repo/tokens.ts:155
↓ 3 callersFunctionpickImageSrc
(item)
app/static/chat/chat.js:80
↓ 3 callersFunctionprepare_chat_request
( *, model: str, messages: list[dict[str, Any]], emit_think: bool, tools: list[dict[str, A
app/services/compat/common.py:62
↓ 3 callersFunctionreadChoice
(chat: Record<string, unknown>)
src/grok/compat.ts:15
↓ 3 callersFunctionreadMessage
(chat: Record<string, unknown>)
src/grok/compat.ts:20
↓ 3 callersFunctionrefreshImageGenerationMethod
()
app/static/chat/chat.js:769
↓ 3 callersFunctionrefreshMetricsOnce
(silent = false)
app/static/datacenter/datacenter.js:142
↓ 3 callersFunctionrefreshModels
()
app/static/chat/chat.js:800
↓ 3 callersMethodrefresh_tokens
( self, tokens: Iterable[str], concurrency: int = DEFAULT_NSFW_REFRESH_CONCURRENCY,
app/services/account/account_settings_refresh.py:109
↓ 3 callersFunctionrenderAttachments
(kind)
app/static/chat/chat.js:366
↓ 3 callersFunctionrenderTable
()
app/static/keys/keys.js:175
↓ 3 callersFunctionresolveAspectRatio
(size: unknown)
src/grok/imagineExperimental.ts:51
↓ 3 callersFunctionresponseFieldName
(format: ImageResponseFormat)
src/routes/openai.ts:242
↓ 3 callersFunctionresponses_create
( *, model: str, input_value: str | list[Any], instructions: str | None, stream: bool,
app/services/compat/responses_api.py:144
↓ 3 callersFunctionretry_on_status
通用重试函数 Args: func: 重试的异步函数 *args: 函数参数 extract_status: 异常提取状态码的函数 on_retry: 重试时的回调函数 **kwargs: 函
app/services/grok/retry.py:57
↓ 3 callersMethodsave_tokens
(self, data: Dict[str, Any])
app/core/storage.py:659
↓ 3 callersFunctionsetRefreshProgress
(db: Env["DB"], p: Partial<RefreshProgress>)
src/repo/refreshProgress.ts:45
↓ 3 callersMethodstart
启动调度器
app/services/token/scheduler.py:71
↓ 3 callersFunctionstripCfPrefix
(value: string)
src/settings.ts:132
↓ 3 callersFunctiontoOutIndex
(offset: number, localIndex: number)
src/routes/openai.ts:903
↓ 3 callersFunctiontryConsumeDailyUsage
(args: { db: Env["DB"]; key: string; day: string; field: ApiKeyUsageField; inc: number; limit: num
src/repo/apiKeyUsage.ts:57
↓ 3 callersFunctionupdateApiKeyStatus
(db: Env["DB"], key: string, is_active: boolean)
src/repo/apiKeys.ts:108
↓ 3 callersFunctionupdateImageCardCompleted
(card, src, failed)
app/static/chat/chat.js:1085
↓ 3 callersFunctionupdateOnlineCountFromTokens
(tokens)
app/static/cache/cache.js:700
↓ 3 callersFunctionupdateTokenLimits
( db: Env["DB"], token: string, updates: { remaining_queries?: number; heavy_remaining_queries?: number
src/repo/tokens.ts:212
↓ 3 callersFunctionupdateToolbarForSection
()
app/static/cache/cache.js:693
↓ 3 callersFunctionvalidate_edit_request
Validate image edit request parameters.
app/api/v1/image.py:134
↓ 2 callersMethod_build_edit_payload
(prompt: str, image_urls: List[str], model_name: str)
app/services/grok/imagine_experimental.py:306
↓ 2 callersFunction_build_image_response
(selected_images: List[str], response_field: str)
app/api/v1/image.py:548
↓ 2 callersMethod_build_payload
构建视频生成载荷
app/services/grok/media.py:168
↓ 2 callersFunction_build_response_tool_items
(calls)
app/services/compat/responses_api.py:256
↓ 2 callersFunction_build_video_poster_preview
将 <video> 替换为可点击的 Poster 预览图(用于前端展示)
app/services/grok/processor.py:19
↓ 2 callersFunction_coerce_concurrency
(value: Any, default: int = DEFAULT_NSFW_REFRESH_CONCURRENCY)
app/services/account/account_settings_refresh.py:48
↓ 2 callersFunction_coerce_retries
(value: Any, default: int = DEFAULT_NSFW_REFRESH_RETRIES)
app/services/account/account_settings_refresh.py:55
↓ 2 callersFunction_collect_experimental_generation_images
( token: str, prompt: str, n: int, response_format: str, aspect_ratio: str, concurrenc
app/api/v1/image.py:336
↓ 2 callersFunction_collect_tokens_from_pool_payload
(payload: Any)
app/api/v1/admin.py:464
↓ 2 callersMethod_day_str
(self, at_ms: Optional[int] = None, tz_offset_minutes: Optional[int] = None)
app/services/api_keys.py:136
↓ 2 callersFunction_dedupe_images
(images: List[str])
app/api/v1/image.py:252
↓ 2 callersFunction_display_key
(key: str)
app/api/v1/admin.py:368
↓ 2 callersMethod_ensure_defaults
(self)
app/core/config.py:230
↓ 2 callersFunction_extract_content
(role: str, content: Any)
app/services/compat/common.py:204
↓ 2 callersFunction_extract_cookie_value
(cookie_str: str, name: str)
app/core/legacy_migration.py:196
↓ 2 callersFunction_extract_cookie_value
(cookie_str: str, name: str)
app/services/account/account_settings_refresh.py:19
↓ 2 callersFunction_extract_from_call_list
(items: list[Any])
app/services/compat/tooling.py:307
↓ 2 callersMethod_feed_capturing
(self, chunk: str)
app/services/compat/tooling.py:182
↓ 2 callersFunction_fetch_assets
(token: str)
app/api/v1/admin.py:869
↓ 2 callersFunction_fetch_detail
(token: str)
app/api/v1/admin.py:876
← previousnext →201–300 of 1,181, ranked by callers