Skip to content

Commit 2da13f5

Browse files
committed
Merge branch 'feature/gemini_cli-alignment' into dev
2 parents 5dad458 + 5f604d3 commit 2da13f5

File tree

3 files changed

+342
-137
lines changed

3 files changed

+342
-137
lines changed

src/rotator_library/providers/gemini_auth_base.py

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,34 @@
1414

1515
lib_logger = logging.getLogger("rotator_library")
1616

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

2547

0 commit comments

Comments
 (0)