Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/su-kaka/gcli2api
/ functions
Functions
693 in github.com/su-kaka/gcli2api
⨍
Functions
693
◇
Types & classes
71
↳
Endpoints
49
↓ 260 callers
Method
error
(self, message: str)
log.py:280
↓ 242 callers
Method
debug
(self, message: str)
log.py:271
↓ 231 callers
Method
info
(self, message: str)
log.py:274
↓ 188 callers
Function
showStatus
(message, type = 'info')
front/common.js:521
↓ 147 callers
Method
warning
(self, message: str)
log.py:277
↓ 39 callers
Function
getAuthHeaders
()
front/common.js:607
↓ 28 callers
Function
get_config_value
Get configuration value with priority: ENV > Storage > default.
config.py:97
↓ 28 callers
Function
showMessageModal
(title, message, type = 'info')
front/common.js:568
↓ 25 callers
Method
refresh
刷新访问令牌
src/google_oauth_api.py:73
↓ 22 callers
Function
validate_mode
验证 mode 参数 Args: mode: 模式字符串 ("geminicli" 或 "antigravity") Returns: str: 验证后的 mode 字符串 Raises: HTTPExcepti
src/panel/utils.py:136
↓ 20 callers
Method
_ensure_initialized
确保已初始化
src/storage/sqlite_manager.py:359
↓ 20 callers
Method
_ensure_initialized
(self)
src/storage/psql_manager.py:231
↓ 20 callers
Method
_ensure_initialized
确保已初始化
src/storage/mongodb_manager.py:483
↓ 20 callers
Function
build_streaming_response_or_error
Prefetch the first async item so router code can return an upstream error response directly before FastAPI commits a 200 streaming response.
src/router/stream_passthrough.py:19
↓ 20 callers
Method
connect
(self, websocket: WebSocket)
src/panel/utils.py:30
↓ 20 callers
Function
get_storage_adapter
获取全局存储适配器实例
src/storage_adapter.py:326
↓ 20 callers
Function
setConfigField
(fieldId, value)
front/common.js:2767
↓ 17 callers
Function
model_to_dict
兼容 Pydantic v1 和 v2 的模型转字典方法,排除 None 值 - v1: model.dict(exclude_none=True) - v2: model.model_dump(exclude_none=True)
src/models.py:7
↓ 16 callers
Method
_get_collection_name
根据 mode 获取对应的集合名
src/storage/mongodb_manager.py:488
↓ 16 callers
Function
post_async
通用异步POST请求
src/httpx_client.py:72
↓ 15 callers
Method
get_valid_credential
获取有效的凭证 - 随机负载均衡版 每次随机选择一个可用的凭证(未禁用、未冷却、符合preview要求) 如果刷新失败会自动禁用失效凭证并重试获取下一个可用凭证 Args: mode: 凭证模式 ("gemi
src/credential_manager.py:49
↓ 15 callers
Function
normalize_gemini_request
规范化 Gemini 请求 处理逻辑: 1. 模型特性处理 (thinking config, search tools) 3. 参数范围限制 (maxOutputTokens, topK) 4. 工具清理 Args: reque
src/converter/gemini_fix.py:579
↓ 14 callers
Method
_ensure_initialized
确保存储适配器已初始化
src/storage_adapter.py:156
↓ 14 callers
Method
_get_table_name
根据 mode 获取对应的表名
src/storage/sqlite_manager.py:364
↓ 14 callers
Method
_get_table_name
(self, mode: str)
src/storage/psql_manager.py:235
↓ 14 callers
Function
_sse_event
生成 SSE 事件
src/converter/anthropic2gemini.py:960
↓ 14 callers
Function
getValue
(id, def = '')
front/common.js:2784
↓ 14 callers
Function
prepend_async_item
Yield a prefetched item before continuing the original iterator.
src/router/stream_passthrough.py:7
↓ 14 callers
Function
read_first_async_item
Python 3.9-compatible async equivalent of built-in anext().
src/router/stream_passthrough.py:14
↓ 13 callers
Method
update_credential_state
更新凭证状态
src/storage/psql_manager.py:440
↓ 12 callers
Function
record_api_call_error
记录API调用错误 Args: credential_manager: 凭证管理器实例 credential_name: 凭证名称 status_code: HTTP状态码 cooldown_until: 冷却截止时
src/api/utils.py:167
↓ 11 callers
Method
_rk_tier
按 tier 分桶的未禁用凭证 Redis Set key
src/storage/mongodb_manager.py:207
↓ 10 callers
Method
_ensure_initialized
确保管理器已初始化(内部使用)
src/credential_manager.py:29
↓ 10 callers
Method
create_task
创建并注册一个任务
src/task_manager.py:46
↓ 10 callers
Method
get_credential
获取凭证数据
src/storage/psql_manager.py:382
↓ 10 callers
Function
stream_request
流式请求函数 Args: body: 请求体 native: 是否返回原生bytes流,False则返回str流 headers: 额外的请求头 Yields: Response对象(错误时)或 bytes
src/api/geminicli.py:119
↓ 10 callers
Function
stream_request
流式请求函数 Args: body: 请求体 native: 是否返回原生bytes流,False则返回str流 headers: 额外的请求头 Yields: Response对象(错误时)或 bytes
src/api/antigravity.py:288
↓ 9 callers
Function
get_base_model_from_feature_model
Get base model name from feature model name.
src/utils.py:80
↓ 8 callers
Method
_rk_avail
所有未禁用凭证的 Redis Set key
src/storage/mongodb_manager.py:203
↓ 8 callers
Method
_rk_preview
preview=True 凭证的 Redis Set key
src/storage/mongodb_manager.py:211
↓ 8 callers
Method
close
关闭数据库连接池
src/storage/psql_manager.py:223
↓ 8 callers
Function
convert_gemini_to_openai_response
将 Gemini 格式非流式响应转换为 OpenAI 格式非流式响应 注意: 如果收到的不是 200 开头的响应,不做任何处理,直接转发原始响应 Args: gemini_response: Gemini 格式的响应体 (字典或响应对象)
src/converter/openai2gemini.py:1471
↓ 8 callers
Function
create_health_check_response
创建健康检查响应 Args: format: 响应格式("openai"、"gemini" 或 "anthropic") **kwargs: 格式特定的额外参数 - model: 模型名称(anthropic格式需要
src/router/hi_check.py:72
↓ 8 callers
Function
decode_tool_id_and_signature
从编码的ID中提取原始工具ID和thoughtSignature。 Args: encoded_id: 编码的工具调用ID Returns: (原始工具ID, thoughtSignature) 元组 Examples:
src/converter/thoughtSignature_fix.py:56
↓ 8 callers
Function
get_antigravity_api_url
Get Antigravity API URL setting. 用于Google Antigravity API的URL。 Environment variable: ANTIGRAVITY_API_URL Database config key: antig
config.py:446
↓ 8 callers
Function
is_anti_truncation_model
Check if model name indicates anti-truncation should be used.
src/utils.py:75
↓ 8 callers
Function
is_health_check_request
检查是否是健康检查请求(Hi消息) Args: request_data: 请求数据 format: 请求格式("openai"、"gemini" 或 "anthropic") Returns: 是
src/router/hi_check.py:12
↓ 8 callers
Function
is_skip_thought_signature_placeholder
Return True for the internal placeholder that should not reach clients.
src/converter/thoughtSignature_fix.py:23
↓ 7 callers
Function
apply_anti_truncation
对请求payload应用反截断处理和正则替换 在systemInstruction中添加提醒,要求模型在结束时输出DONE_MARKER标记 Args: payload: 原始请求payload Returns: 添加了反截断指令
src/converter/anti_truncation.py:123
↓ 7 callers
Method
from_dict
从字典创建凭证
src/google_oauth_api.py:128
↓ 7 callers
Function
get_async
通用异步GET请求
src/httpx_client.py:64
↓ 7 callers
Function
non_stream_request
非流式请求函数 Args: body: 请求体 native: 保留参数以保持接口一致性(实际未使用) headers: 额外的请求头 Returns: Response对象
src/api/geminicli.py:411
↓ 7 callers
Method
process_stream
处理流式响应,检测并处理截断
src/converter/anti_truncation.py:216
↓ 7 callers
Method
refresh_if_needed
如果需要则刷新token
src/google_oauth_api.py:62
↓ 6 callers
Function
_append_schema_hint
Move fragile validation details into description instead of sending them raw.
src/converter/gemini_fix.py:33
↓ 6 callers
Function
_log
(level: str, message: str)
log.py:228
↓ 6 callers
Function
_prepare_credentials_data
准备凭证数据字典(统一函数)
src/auth.py:45
↓ 6 callers
Method
_rk_config_all
所有配置的 Redis Hash key
src/storage/mongodb_manager.py:1199
↓ 6 callers
Function
escapeHtml
(text)
front/common.js:2096
↓ 6 callers
Function
gemini_to_anthropic_response
将 Gemini 格式非流式响应转换为 Anthropic 格式非流式响应 注意: 如果收到的不是 200 开头的响应体,不做任何处理,直接转发 Args: gemini_response: Gemini 格式的响应体字典 model:
src/converter/anthropic2gemini.py:787
↓ 6 callers
Function
getChecked
(id, def = false)
front/common.js:2787
↓ 6 callers
Function
get_anti_truncation_max_attempts
Get maximum attempts for anti-truncation continuation. Environment variable: ANTI_TRUNCATION_MAX_ATTEMPTS Database config key: anti_trun
config.py:185
↓ 6 callers
Function
is_fake_streaming_model
Check if model name indicates fake streaming should be used.
src/utils.py:70
↓ 6 callers
Function
non_stream_request
非流式请求函数 Args: body: 请求体 headers: 额外的请求头 Returns: Response对象
src/api/antigravity.py:556
↓ 6 callers
Function
parse_response_for_fake_stream
从完整响应中提取内容和推理内容(用于假流式) Args: response_data: Gemini API 响应数据 Returns: (content, reasoning_content, finish_reason, images): 内容
src/converter/fake_stream.py:26
↓ 6 callers
Method
start
启动保活服务。 仅当配置了有效的保活URL时才创建后台任务,否则零开销。
src/keeplive.py:38
↓ 6 callers
Method
store_credential
存储凭证数据
src/storage_adapter.py:28
↓ 5 callers
Function
_cleanup_auth_flow_server
清理认证流程的服务器资源
src/auth.py:78
↓ 5 callers
Method
_clear_content
清空收集的内容,释放内存
src/converter/anti_truncation.py:211
↓ 5 callers
Function
_close_block
关闭当前内容块
src/converter/anthropic2gemini.py:965
↓ 5 callers
Method
_rk_cd
模型冷却 Redis key(带 TTL)
src/storage/mongodb_manager.py:215
↓ 5 callers
Function
build_antigravity_headers
构建 Antigravity CLI API 请求头。
src/api/antigravity.py:244
↓ 5 callers
Function
convert_gemini_to_openai_stream
将 Gemini 格式流式响应块转换为 OpenAI SSE 格式流式响应 注意: 如果收到的不是 200 开头的响应,不做任何处理,直接转发原始内容 Args: gemini_stream_chunk: Gemini 格式的流式响应块 (字符串,通常是
src/converter/openai2gemini.py:1647
↓ 5 callers
Function
enable_required_apis
自动启用必需的API服务
src/google_oauth_api.py:405
↓ 5 callers
Function
getInt
(id, def = 0)
front/common.js:2785
↓ 5 callers
Function
get_auto_ban_error_codes
Get auto ban error codes. Environment variable: AUTO_BAN_ERROR_CODES (comma-separated, e.g., "400,403") Database config key: auto_ban_er
config.py:131
↓ 5 callers
Method
initialize
初始化存储后端
src/storage_adapter.py:19
↓ 5 callers
Function
is_internal_placeholder_text
(text: Any)
src/converter/thoughtSignature_fix.py:17
↓ 5 callers
Function
save_credentials
通过统一存储系统保存凭证
src/auth.py:911
↓ 5 callers
Method
set_cred_disabled
设置凭证的启用/禁用状态
src/credential_manager.py:154
↓ 5 callers
Method
store_credential
存储或更新凭证
src/storage/psql_manager.py:339
↓ 5 callers
Method
to_dict
转为字典
src/google_oauth_api.py:154
↓ 5 callers
Method
update_credential_state
更新凭证状态
src/credential_manager.py:133
↓ 4 callers
Function
_append_schema_hint
把不兼容的校验信息挪到 description 里,避免上游直接拒收。
src/converter/openai2gemini.py:567
↓ 4 callers
Function
_build_candidate
构建标准候选响应结构 Args: parts: parts 列表 finish_reason: 结束原因 Returns: 候选响应字典
src/converter/fake_stream.py:127
↓ 4 callers
Method
_escape_model_name
转义模型名中的点号,避免 MongoDB 将其解释为嵌套结构 Args: model_name: 原始模型名 (如 "gemini-2.5-flash") Returns: 转义后的模型名 (如 "
src/storage/mongodb_manager.py:33
↓ 4 callers
Function
_is_auth_error
(text: str)
src/api/vertex.py:410
↓ 4 callers
Function
_is_non_whitespace_text
判断文本是否包含"非空白"内容。 说明:下游(Antigravity/Claude 兼容层)会对纯 text 内容块做校验: - text 不能为空字符串 - text 不能仅由空白字符(空格/换行/制表等)组成
src/converter/anthropic2gemini.py:222
↓ 4 callers
Function
async_shutdown_server
异步关闭OAuth回调服务器,避免阻塞主流程
src/auth.py:949
↓ 4 callers
Function
clear_all_model_cooldowns_for_credential
清空指定凭证的所有模型冷却(后端支持时执行)。
src/panel/creds.py:91
↓ 4 callers
Method
close
关闭存储后端
src/storage_adapter.py:23
↓ 4 callers
Function
gemini_stream_to_anthropic_stream
将 Gemini 格式流式响应转换为 Anthropic SSE 格式流式响应 注意: 如果收到的不是 200 开头的响应体,不做任何处理,直接转发 Args: gemini_stream: Gemini 格式的流式响应 (bytes 迭代器)
src/converter/anthropic2gemini.py:924
↓ 4 callers
Function
get_oauth_proxy_url
Get OAuth proxy URL setting. 用于Google OAuth2认证的代理URL。 Environment variable: OAUTH_PROXY_URL Database config key: oauth_proxy_url
config.py:376
↓ 4 callers
Function
get_retry_config
获取重试配置 Returns: 包含重试配置的字典
src/api/utils.py:130
↓ 4 callers
Function
get_user_projects
获取用户可访问的Google Cloud项目列表
src/google_oauth_api.py:470
↓ 4 callers
Function
handle_error_with_retry
统一处理错误和重试逻辑 仅在以下情况下进行自动重试: 1. 429错误(速率限制) 2. 503错误(服务不可用) 3. 500错误(服务临时不可用) 4. 导致凭证封禁的错误(AUTO_BAN_ERROR_CODES配置) Args:
src/api/utils.py:66
↓ 4 callers
Function
parse_and_log_cooldown
解析并记录冷却时间 Args: error_text: 错误响应文本 mode: 模式(geminicli 或 antigravity) Returns: 冷却截止时间(Unix时间戳),如果解析失败则返回None
src/api/utils.py:202
↓ 4 callers
Method
record_api_call_result
记录API调用结果 Args: credential_name: 凭证名称 success: 是否成功 error_code: 错误码(如果失败) cooldown_u
src/credential_manager.py:243
↓ 4 callers
Function
record_api_call_success
记录API调用成功 Args: credential_manager: 凭证管理器实例 credential_name: 凭证名称 mode: 模式(geminicli 或 antigravity) mode
src/api/utils.py:146
↓ 3 callers
Function
_anthropic_debug_enabled
检查是否启用 Anthropic 调试模式
src/converter/anthropic2gemini.py:194
next →
1–100 of 693, ranked by callers