Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 27 additions & 5 deletions src/rotator_library/providers/gemini_auth_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,34 @@

lib_logger = logging.getLogger("rotator_library")

# Headers for Gemini CLI auth/discovery calls
# Uses KV string format for Client-Metadata (different from Antigravity's JSON format)
# Headers for Gemini CLI auth/discovery calls (loadCodeAssist, onboardUser, etc.)
#
# For OAuth/Code Assist path, native gemini-cli only sends:
# - Content-Type: application/json
# - Authorization: Bearer <token>
# - User-Agent: GeminiCLI/${version} (${platform}; ${arch})
#
# Headers NOT sent by native CLI (confirmed via explore agent analysis of server.ts):
# - X-Goog-Api-Client: Not used in Code Assist path
# - Client-Metadata: Sent in REQUEST BODY for these endpoints, not as HTTP header
#
# Note: The commented headers below previously worked well for SDK fingerprinting.
# Uncomment if you want to try SDK mimicry for potential rate limit benefits.
#
# Source: gemini-cli/packages/core/src/code_assist/server.ts:284-290
GEMINI_CLI_AUTH_HEADERS = {
"User-Agent": "google-api-nodejs-client/9.15.1",
"X-Goog-Api-Client": "gl-node/22.17.0",
"Client-Metadata": "ideType=IDE_UNSPECIFIED,platform=PLATFORM_UNSPECIFIED,pluginType=GEMINI",
"User-Agent": "GeminiCLI/0.26.0 (win32; x64)",
# -------------------------------------------------------------------------
# COMMENTED OUT - Not sent by native gemini-cli for OAuth/Code Assist path
# -------------------------------------------------------------------------
# "X-Goog-Api-Client": "gl-node/22.17.0 gdcl/1.30.0", # SDK mimicry - not used by native CLI
# "Client-Metadata": ( # Sent in body, not as header
# "ideType=IDE_UNSPECIFIED,"
# "pluginType=GEMINI,"
# "ideVersion=0.26.0,"
# "platform=WINDOWS_AMD64,"
# "updateChannel=stable"
# ),
}


Expand Down
Loading