Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/Sophomoresty/gemini-web2api
/ functions
Functions
69 in github.com/Sophomoresty/gemini-web2api
⨍
Functions
69
◇
Types & classes
4
↓ 23 callers
Method
send_json
(self, data, status=200)
gemini_web2api/server.py:47
↓ 21 callers
Method
send_json
(self, data, status=200)
gemini_web2api.py:431
↓ 13 callers
Function
log
(msg: str)
gemini_web2api/gemini.py:25
↓ 7 callers
Function
log
(msg: str)
gemini_web2api.py:99
↓ 4 callers
Method
_start_sse
(self)
gemini_web2api/server.py:56
↓ 4 callers
Function
_upload_images
Upload images and return list of file references. Returns None if no images.
gemini_web2api/server.py:23
↓ 4 callers
Function
generate
Non-streaming generation with retry.
gemini_web2api/gemini.py:192
↓ 3 callers
Method
_call_gemini
(self, prompt, model_id, think_mode, tools)
gemini_web2api.py:514
↓ 3 callers
Function
_get_ssl_ctx
()
gemini_web2api/gemini.py:32
↓ 3 callers
Method
_parse_body
(self, body: bytes)
gemini_web2api/server.py:63
↓ 3 callers
Method
_resolve_model
(self, model_name)
gemini_web2api.py:504
↓ 3 callers
Function
load_cookie
Load cookie from file with mtime-based caching.
gemini_web2api/gemini.py:48
↓ 3 callers
Function
resolve_model
Resolve model name to (name, mode_id, think_mode, error, extra_fields). Unknown model names fall back to default rather than erroring, since
gemini_web2api/models.py:38
↓ 2 callers
Function
_account_prefix
Return the Gemini account path prefix for non-default Google accounts.
gemini_web2api/gemini.py:80
↓ 2 callers
Method
_authorized
(self)
gemini_web2api.py:440
↓ 2 callers
Method
_authorized
(self)
gemini_web2api/server.py:69
↓ 2 callers
Function
_build_headers
()
gemini_web2api/gemini.py:88
↓ 2 callers
Function
_build_payload
(prompt: str, model_id: int, think_mode: int, file_refs: list = None, extra_fields: dict = None)
gemini_web2api/gemini.py:107
↓ 2 callers
Function
_extract_texts_from_line
Parse a single wrb.fr line and return list of text strings found.
gemini_web2api/gemini.py:159
↓ 2 callers
Function
_get_url
()
gemini_web2api/gemini.py:140
↓ 2 callers
Function
_google_tool_choice_instruction
Extract tool_choice constraint from Google API toolConfig.
gemini_web2api/tools.py:168
↓ 2 callers
Method
_handle_google_generate
Handle Google native generateContent / streamGenerateContent.
gemini_web2api.py:741
↓ 2 callers
Method
_handle_google_generate
(self, body: bytes, stream: bool)
gemini_web2api/server.py:313
↓ 2 callers
Function
account_prefix
Return the Gemini account path prefix for non-default Google accounts.
gemini_web2api.py:135
↓ 2 callers
Function
build_tool_prompt
Build natural tool-use prompt for Gemini Web that avoids prompt-injection detection.
gemini_web2api/tools.py:149
↓ 2 callers
Function
clean_gemini_text
Remove internal code execution artifacts.
gemini_web2api.py:311
↓ 2 callers
Function
clean_text
(text: str)
gemini_web2api/gemini.py:150
↓ 2 callers
Function
extract_response_text
Parse StreamGenerate response to extract final text.
gemini_web2api.py:320
↓ 2 callers
Function
gemini_stream_generate
Send prompt to Gemini StreamGenerate with retry.
gemini_web2api.py:145
↓ 2 callers
Function
generate_stream
Streaming generation via httpx with retry on connection failure.
gemini_web2api/gemini.py:222
↓ 2 callers
Function
load_cookie
Load cookie from file. Returns (cookie_str, sapisid).
gemini_web2api.py:105
↓ 2 callers
Function
make_sapisidhash
(sapisid: str)
gemini_web2api.py:129
↓ 2 callers
Function
make_sapisidhash
(sapisid: str)
gemini_web2api/gemini.py:74
↓ 2 callers
Function
messages_to_prompt
Convert OpenAI messages to prompt string.
gemini_web2api.py:355
↓ 2 callers
Function
messages_to_prompt
Convert OpenAI messages to (prompt_str, images_list). Returns (prompt, images) where images is a list of (bytes, mime_type) tuples.
gemini_web2api/tools.py:54
↓ 2 callers
Function
parse_tool_calls
Extract tool_call blocks. Returns (clean_text, tool_calls_list).
gemini_web2api/tools.py:120
↓ 1 callers
Function
_build_tool_choice_instruction
Build tool_choice constraint instruction. tool_choice values: - "none": do not call any tool - "auto": decide whether to call tools (
gemini_web2api/tools.py:34
↓ 1 callers
Function
_cached_page_tokens
()
gemini_web2api/multimodal.py:44
↓ 1 callers
Function
_get_httpx_client
()
gemini_web2api/gemini.py:39
↓ 1 callers
Function
_get_page_tokens
Fetch WIZ_global_data tokens from Gemini page (Push-ID, X-Client-Pctx).
gemini_web2api/multimodal.py:14
↓ 1 callers
Method
_google_contents_to_prompt
Convert Google API contents format to prompt string.
gemini_web2api.py:718
↓ 1 callers
Method
_handle_chat
(self, body: bytes)
gemini_web2api/server.py:136
↓ 1 callers
Method
_handle_google_models_list
GET /v1beta/models — Google AI format model list.
gemini_web2api.py:706
↓ 1 callers
Method
_handle_responses
(self, body: bytes)
gemini_web2api/server.py:206
↓ 1 callers
Method
_parse_google_model_from_path
Extract model name from /v1beta/models/{model}:method path.
gemini_web2api.py:699
↓ 1 callers
Function
extract_response_text
Parse full response to get final text.
gemini_web2api/gemini.py:182
↓ 1 callers
Function
fetch_image_bytes
Fetch image from URL.
gemini_web2api/multimodal.py:119
↓ 1 callers
Function
find_config
Search for config file in standard locations.
gemini_web2api/config.py:32
↓ 1 callers
Function
gemini_stream_generate_iter
Send prompt and yield incremental text deltas using httpx streaming.
gemini_web2api.py:217
↓ 1 callers
Function
google_contents_to_prompt
Convert Google API contents/tools/systemInstruction to (prompt_str, images_list). Returns (prompt, images) where images is a list of (bytes, mime
gemini_web2api/tools.py:185
↓ 1 callers
Method
handle_chat
(self, body: bytes)
gemini_web2api.py:522
↓ 1 callers
Method
handle_responses
OpenAI Responses API for Codex CLI compatibility.
gemini_web2api.py:597
↓ 1 callers
Function
load_config
(path: str)
gemini_web2api.py:795
↓ 1 callers
Function
load_config
Load config from JSON file.
gemini_web2api/config.py:24
↓ 1 callers
Function
main
()
gemini_web2api.py:802
↓ 1 callers
Function
main
()
gemini_web2api/__main__.py:12
↓ 1 callers
Function
parse_google_function_calls
Extract function_call blocks from model output. Handles 3 formats: 1. ```function_call\\n{...}\\n``` (standard) 2. function_call\\n{...}
gemini_web2api/tools.py:250
↓ 1 callers
Function
parse_tool_calls
Extract tool_call blocks. Returns (clean_text, tool_calls_list).
gemini_web2api.py:404
↓ 1 callers
Function
upload_image
Upload image via Scotty resumable upload. Returns file reference path.
gemini_web2api/multimodal.py:52
Function
_compress_b64_if_needed
Compress image if base64 is too large for text embedding.
gemini_web2api/tools.py:11
Function
_usage
(prompt: str, text: str)
gemini_web2api/server.py:17
Method
do_GET
(self)
gemini_web2api.py:455
Method
do_GET
(self)
gemini_web2api/server.py:84
Method
do_OPTIONS
(self)
gemini_web2api.py:448
Method
do_OPTIONS
(self)
gemini_web2api/server.py:77
Method
do_POST
(self)
gemini_web2api.py:478
Method
do_POST
(self)
gemini_web2api/server.py:108
Method
log_message
(self, fmt, *args)
gemini_web2api.py:428
Method
log_message
(self, fmt, *args)
gemini_web2api/server.py:44