Repository navigation
fix(gemini): API field casing, safety finish reasons, pagination timeout #933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
diegosouzapw
merged 36 commits into
cheaper-inference:release/v3.4.7
from
christopher-s:gemini-google-ai-studio-audit
Apr 2, 2026
Merged
Changes from 31 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
0e73b3b
docs: add Gemini model metadata design spec
christopher-s 4feea2e
docs: revise Gemini model metadata spec — add backwards compat, drop …
christopher-s aac99f6
docs: add Gemini model metadata implementation plan
christopher-s 3055456
docs: fix plan — add context_length to both catalog model pushes
christopher-s f1805c8
feat(gemini): extract metadata from models API response
christopher-s 325d048
feat(sync): carry Gemini metadata through model sync
christopher-s bd5f39e
feat(db): extend replaceCustomModels with metadata fields
christopher-s 49ac0ca
feat(catalog): use stored inputTokenLimit for custom model context_le…
christopher-s faae82e
feat(v1beta): use stored token limits and metadata in Gemini models e…
christopher-s ea6d0f5
docs: add Gemini available models sync implementation plan
christopher-s 668b235
docs: fix plan — add missing import for buildModelSyncInternalHeaders
christopher-s 9e4132f
feat(db): add syncedAvailableModels namespace and CRUD functions
christopher-s 7607cec
feat(sync): write Gemini models to syncedAvailableModels with union l…
christopher-s 5c27e0f
feat(gemini): auto-trigger model sync when API key is saved
christopher-s 125fb81
feat(dashboard): Gemini Available Models reads from API sync, hide Cu…
christopher-s 5b140d2
feat(api): catalog and v1beta read from synced Gemini models
christopher-s 464fd6d
fix(v1beta): remove Gemini duplicates — filter non-consecutive entrie…
christopher-s 8ed0917
feat(gemini): per-connection model tracking with cleanup on key delete
christopher-s b4e674a
fix(gemini): no registry fallback — show 0 models when no API keys exist
christopher-s 7f785b8
fix(gemini): refresh Available Models UI after API key add/delete
christopher-s 2341bba
feat(gemini): progress dialog on key save, remove hardcoded registry,…
christopher-s 3ae810a
fix(gemini): log sync errors, optimize synced models query
christopher-s 0038fe5
feat(gemini): per-model quota lockout instead of connection-wide
christopher-s f8d045c
fix(gemini): per-model quota isolation — 429 on one model keeps other…
christopher-s 03ff03e
fix(gemini): filter out locked models during credential selection
christopher-s 35061df
refactor: consolidate per-model quota logic into shared helpers
christopher-s b1183c2
feat(models): add pageSize=1000 and nextPageToken pagination for Gemini
christopher-s a069df4
fix: address PR review — timeouts, pagination safety, standardized co…
christopher-s 25c63c8
merge: sync with upstream origin/main (v3.4.5+v3.4.6)
christopher-s 75daf98
fix(gemini): correct API field casing, add safety finish reasons, pag…
christopher-s 50683e6
fix(gemini): correct misleading SAFETY comment — partial SSE content …
christopher-s ccab588
chore: remove superpowers plans/specs from tracking, add to .gitignore
christopher-s 910471a
chore: remove .data/ from tracking (call_logs, db_backups, storage)
christopher-s 80f2c79
chore: restore .agents/ tracking — do not gitignore
christopher-s 6dcd5b7
chore: restore .agents/workflows — actively used upstream
christopher-s 6698d33
fix(tests): update T28/T31 for gemini dynamic model sync
christopher-s File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
71 changes: 71 additions & 0 deletions
71
...a/call_logs/2026-03-31/2026-03-31T15-24-20.891Z_0bf58d48-ea41-429a-8193-ed3e55f7a6bd.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| { | ||
| "schemaVersion": 2, | ||
| "summary": { | ||
| "id": "0bf58d48-ea41-429a-8193-ed3e55f7a6bd", | ||
| "timestamp": "2026-03-31T15:24:20.891Z", | ||
| "method": "POST", | ||
| "path": "/v1/chat/completions", | ||
| "status": 200, | ||
| "model": "gemini-2.5-flash", | ||
| "requestedModel": "gemini-cli/gemini-2.5-flash", | ||
| "provider": "gemini-cli", | ||
| "account": "christopher.staley@gmail.com", | ||
| "connectionId": "352fc97c-8e30-4ffa-b41e-8ce422a0db3e", | ||
| "duration": 5007, | ||
| "tokens": { | ||
| "in": 0, | ||
| "out": 0 | ||
| }, | ||
| "requestType": null, | ||
| "sourceFormat": "openai", | ||
| "targetFormat": "gemini-cli", | ||
| "apiKeyId": "c8635ff9-2ee0-4045-ba77-75325347623f", | ||
| "apiKeyName": "Test", | ||
| "comboName": null | ||
| }, | ||
| "requestBody": { | ||
| "model": "gemini-cli/gemini-2.5-flash", | ||
| "messages": [ | ||
| { | ||
| "role": "user", | ||
| "content": "Say exactly: HELLO" | ||
| } | ||
| ], | ||
| "stream": false, | ||
| "max_tokens": 20 | ||
| }, | ||
| "responseBody": { | ||
| "response": { | ||
| "candidates": [ | ||
| { | ||
| "content": { | ||
| "role": "model" | ||
| }, | ||
| "finishReason": "MAX_TOKENS" | ||
| } | ||
| ], | ||
| "usageMetadata": { | ||
| "promptTokenCount": 5, | ||
| "totalTokenCount": 22, | ||
| "trafficType": "ON_DEMAND", | ||
| "promptTokensDetails": [ | ||
| { | ||
| "modality": "TEXT", | ||
| "tokenCount": 5 | ||
| } | ||
| ], | ||
| "thoughtsTokenCount": 17 | ||
| }, | ||
| "modelVersion": "gemini-2.5-flash", | ||
| "createTime": "2026-03-31T15:24:18.823251Z", | ||
| "responseId": "IufLadOfMoqV4_UPs52fkAE" | ||
| }, | ||
| "traceId": "2fa07f42074e3bcc", | ||
| "metadata": { | ||
| "remoteContext": { | ||
| "ragState": "RAG_DISABLED" | ||
| } | ||
| } | ||
| }, | ||
| "error": null | ||
| } | ||
83 changes: 83 additions & 0 deletions
83
...a/call_logs/2026-03-31/2026-03-31T15-24-22.008Z_aa481f62-0899-4423-8cdc-a8b791aacb95.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| { | ||
| "schemaVersion": 2, | ||
| "summary": { | ||
| "id": "aa481f62-0899-4423-8cdc-a8b791aacb95", | ||
| "timestamp": "2026-03-31T15:24:22.008Z", | ||
| "method": "POST", | ||
| "path": "/v1/chat/completions", | ||
| "status": 200, | ||
| "model": "gemini-2.5-flash-lite", | ||
| "requestedModel": "gemini-cli/gemini-2.5-flash-lite", | ||
| "provider": "gemini-cli", | ||
| "account": "christopher.staley@gmail.com", | ||
| "connectionId": "352fc97c-8e30-4ffa-b41e-8ce422a0db3e", | ||
| "duration": 1085, | ||
| "tokens": { | ||
| "in": 0, | ||
| "out": 0 | ||
| }, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| "requestType": null, | ||
| "sourceFormat": "openai", | ||
| "targetFormat": "gemini-cli", | ||
| "apiKeyId": "c8635ff9-2ee0-4045-ba77-75325347623f", | ||
| "apiKeyName": "Test", | ||
| "comboName": null | ||
| }, | ||
| "requestBody": { | ||
| "model": "gemini-cli/gemini-2.5-flash-lite", | ||
| "messages": [ | ||
| { | ||
| "role": "user", | ||
| "content": "Say exactly: HELLO" | ||
| } | ||
| ], | ||
| "stream": false, | ||
| "max_tokens": 20 | ||
| }, | ||
| "responseBody": { | ||
| "response": { | ||
| "candidates": [ | ||
| { | ||
| "content": { | ||
| "role": "model", | ||
| "parts": [ | ||
| { | ||
| "text": "HELLO" | ||
| } | ||
| ] | ||
| }, | ||
| "finishReason": "STOP", | ||
| "avgLogprobs": -0.000548450683709234 | ||
| } | ||
| ], | ||
| "usageMetadata": { | ||
| "promptTokenCount": 5, | ||
| "candidatesTokenCount": 1, | ||
| "totalTokenCount": 6, | ||
| "trafficType": "ON_DEMAND", | ||
| "promptTokensDetails": [ | ||
| { | ||
| "modality": "TEXT", | ||
| "tokenCount": 5 | ||
| } | ||
| ], | ||
| "candidatesTokensDetails": [ | ||
| { | ||
| "modality": "TEXT", | ||
| "tokenCount": 1 | ||
| } | ||
| ] | ||
| }, | ||
| "modelVersion": "gemini-2.5-flash-lite", | ||
| "createTime": "2026-03-31T15:24:21.199660Z", | ||
| "responseId": "JefLaeyXDMGK998P5caw2QE" | ||
| }, | ||
| "traceId": "ed939cdca1f71552", | ||
| "metadata": { | ||
| "remoteContext": { | ||
| "ragState": "RAG_DISABLED" | ||
| } | ||
| } | ||
| }, | ||
| "error": null | ||
| } | ||
39 changes: 39 additions & 0 deletions
39
...a/call_logs/2026-03-31/2026-03-31T15-24-26.699Z_065cf4d0-a142-4123-81e1-c90a9b654b10.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| { | ||
| "schemaVersion": 2, | ||
| "summary": { | ||
| "id": "065cf4d0-a142-4123-81e1-c90a9b654b10", | ||
| "timestamp": "2026-03-31T15:24:26.699Z", | ||
| "method": "POST", | ||
| "path": "/v1/chat/completions", | ||
| "status": 429, | ||
| "model": "gemini-2.5-pro", | ||
| "requestedModel": "gemini-cli/gemini-2.5-pro", | ||
| "provider": "gemini-cli", | ||
| "account": "christopher.staley@gmail.com", | ||
| "connectionId": "352fc97c-8e30-4ffa-b41e-8ce422a0db3e", | ||
| "duration": 4594, | ||
| "tokens": { | ||
| "in": 0, | ||
| "out": 0 | ||
| }, | ||
| "requestType": null, | ||
| "sourceFormat": "openai", | ||
| "targetFormat": "gemini-cli", | ||
| "apiKeyId": "c8635ff9-2ee0-4045-ba77-75325347623f", | ||
| "apiKeyName": "Test", | ||
| "comboName": null | ||
| }, | ||
| "requestBody": { | ||
| "model": "gemini-cli/gemini-2.5-pro", | ||
| "messages": [ | ||
| { | ||
| "role": "user", | ||
| "content": "Say exactly: HELLO" | ||
| } | ||
| ], | ||
| "stream": false, | ||
| "max_tokens": 20 | ||
| }, | ||
| "responseBody": null, | ||
| "error": "[429]: You have exhausted your capacity on this model." | ||
| } |
84 changes: 84 additions & 0 deletions
84
...a/call_logs/2026-03-31/2026-03-31T15-25-57.431Z_9347967f-4754-4e31-b353-18f4b4397096.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| { | ||
| "schemaVersion": 2, | ||
| "summary": { | ||
| "id": "9347967f-4754-4e31-b353-18f4b4397096", | ||
| "timestamp": "2026-03-31T15:25:57.431Z", | ||
| "method": "POST", | ||
| "path": "/v1/chat/completions", | ||
| "status": 200, | ||
| "model": "gemini-2.5-flash", | ||
| "requestedModel": "gemini-cli/gemini-2.5-flash", | ||
| "provider": "gemini-cli", | ||
| "account": "christopher.staley@gmail.com", | ||
| "connectionId": "352fc97c-8e30-4ffa-b41e-8ce422a0db3e", | ||
| "duration": 2965, | ||
| "tokens": { | ||
| "in": 0, | ||
| "out": 0 | ||
| }, | ||
| "requestType": null, | ||
| "sourceFormat": "openai", | ||
| "targetFormat": "gemini-cli", | ||
| "apiKeyId": "c8635ff9-2ee0-4045-ba77-75325347623f", | ||
| "apiKeyName": "Test", | ||
| "comboName": null | ||
| }, | ||
| "requestBody": { | ||
| "model": "gemini-cli/gemini-2.5-flash", | ||
| "messages": [ | ||
| { | ||
| "role": "user", | ||
| "content": "What is 2+2? Reply with just the number." | ||
| } | ||
| ], | ||
| "stream": false, | ||
| "max_tokens": 50 | ||
| }, | ||
| "responseBody": { | ||
| "response": { | ||
| "candidates": [ | ||
| { | ||
| "content": { | ||
| "role": "model", | ||
| "parts": [ | ||
| { | ||
| "text": "4" | ||
| } | ||
| ] | ||
| }, | ||
| "finishReason": "STOP", | ||
| "avgLogprobs": -13.736383438110352 | ||
| } | ||
| ], | ||
| "usageMetadata": { | ||
| "promptTokenCount": 13, | ||
| "candidatesTokenCount": 1, | ||
| "totalTokenCount": 48, | ||
| "trafficType": "ON_DEMAND", | ||
| "promptTokensDetails": [ | ||
| { | ||
| "modality": "TEXT", | ||
| "tokenCount": 13 | ||
| } | ||
| ], | ||
| "candidatesTokensDetails": [ | ||
| { | ||
| "modality": "TEXT", | ||
| "tokenCount": 1 | ||
| } | ||
| ], | ||
| "thoughtsTokenCount": 34 | ||
| }, | ||
| "modelVersion": "gemini-2.5-flash", | ||
| "createTime": "2026-03-31T15:25:56.802914Z", | ||
| "responseId": "hOfLaeKAMemU4_UP762GkQ0" | ||
| }, | ||
| "traceId": "7fb4332789afda2", | ||
| "metadata": { | ||
| "remoteContext": { | ||
| "ragState": "RAG_DISABLED" | ||
| } | ||
| } | ||
| }, | ||
| "error": null | ||
| } |
71 changes: 71 additions & 0 deletions
71
...a/call_logs/2026-03-31/2026-03-31T15-26-56.737Z_4d8ae4c4-ee1c-4409-9218-fa7cbf085889.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| { | ||
| "schemaVersion": 2, | ||
| "summary": { | ||
| "id": "4d8ae4c4-ee1c-4409-9218-fa7cbf085889", | ||
| "timestamp": "2026-03-31T15:26:56.737Z", | ||
| "method": "POST", | ||
| "path": "/v1/chat/completions", | ||
| "status": 200, | ||
| "model": "gemini-3-flash-preview", | ||
| "requestedModel": "gemini-cli/gemini-3-flash-preview", | ||
| "provider": "gemini-cli", | ||
| "account": "christopher.staley@gmail.com", | ||
| "connectionId": "352fc97c-8e30-4ffa-b41e-8ce422a0db3e", | ||
| "duration": 1063, | ||
| "tokens": { | ||
| "in": 0, | ||
| "out": 0 | ||
| }, | ||
| "requestType": null, | ||
| "sourceFormat": "openai", | ||
| "targetFormat": "gemini-cli", | ||
| "apiKeyId": "c8635ff9-2ee0-4045-ba77-75325347623f", | ||
| "apiKeyName": "Test", | ||
| "comboName": null | ||
| }, | ||
| "requestBody": { | ||
| "model": "gemini-cli/gemini-3-flash-preview", | ||
| "messages": [ | ||
| { | ||
| "role": "user", | ||
| "content": "What is 2+2? Reply with just the number." | ||
| } | ||
| ], | ||
| "stream": false, | ||
| "max_tokens": 20 | ||
| }, | ||
| "responseBody": { | ||
| "response": { | ||
| "candidates": [ | ||
| { | ||
| "content": { | ||
| "role": "model" | ||
| }, | ||
| "finishReason": "MAX_TOKENS" | ||
| } | ||
| ], | ||
| "usageMetadata": { | ||
| "promptTokenCount": 13, | ||
| "totalTokenCount": 30, | ||
| "trafficType": "ON_DEMAND", | ||
| "promptTokensDetails": [ | ||
| { | ||
| "modality": "TEXT", | ||
| "tokenCount": 13 | ||
| } | ||
| ], | ||
| "thoughtsTokenCount": 17 | ||
| }, | ||
| "modelVersion": "gemini-3-flash-preview", | ||
| "createTime": "2026-03-31T15:26:55.921478Z", | ||
| "responseId": "v-fLaYafOOmU4_UP762GkQ0" | ||
| }, | ||
| "traceId": "5d73dbb69c78c833", | ||
| "metadata": { | ||
| "remoteContext": { | ||
| "ragState": "RAG_DISABLED" | ||
| } | ||
| } | ||
| }, | ||
| "error": null | ||
| } |
39 changes: 39 additions & 0 deletions
39
...a/call_logs/2026-03-31/2026-03-31T15-27-01.155Z_35e92ad3-bbdd-42bb-aed0-07a6eaaa0f95.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| { | ||
| "schemaVersion": 2, | ||
| "summary": { | ||
| "id": "35e92ad3-bbdd-42bb-aed0-07a6eaaa0f95", | ||
| "timestamp": "2026-03-31T15:27:01.155Z", | ||
| "method": "POST", | ||
| "path": "/v1/chat/completions", | ||
| "status": 429, | ||
| "model": "gemini-3-pro-preview", | ||
| "requestedModel": "gemini-cli/gemini-3-pro-preview", | ||
| "provider": "gemini-cli", | ||
| "account": "christopher.staley@gmail.com", | ||
| "connectionId": "352fc97c-8e30-4ffa-b41e-8ce422a0db3e", | ||
| "duration": 4390, | ||
| "tokens": { | ||
| "in": 0, | ||
| "out": 0 | ||
| }, | ||
| "requestType": null, | ||
| "sourceFormat": "openai", | ||
| "targetFormat": "gemini-cli", | ||
| "apiKeyId": "c8635ff9-2ee0-4045-ba77-75325347623f", | ||
| "apiKeyName": "Test", | ||
| "comboName": null | ||
| }, | ||
| "requestBody": { | ||
| "model": "gemini-cli/gemini-3-pro-preview", | ||
| "messages": [ | ||
| { | ||
| "role": "user", | ||
| "content": "What is 2+2? Reply with just the number." | ||
| } | ||
| ], | ||
| "stream": false, | ||
| "max_tokens": 20 | ||
| }, | ||
| "responseBody": null, | ||
| "error": "[429]: You have exhausted your capacity on this model." | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The inclusion of the
.data/call_logs/directory in this pull request appears to be accidental. These files contain sensitive Personally Identifiable Information (PII), specifically user email addresses (e.g.,christopher.staley@gmail.comon line 12) and full chat histories. Committing such data to a repository is a significant security and privacy risk. Furthermore, committing over 180 log files bloats the repository size and history. These files should be removed from the PR, and the.data/directory should be added to the.gitignorefile to prevent future accidental commits. Additionally, the actual code changes described in the pull request summary (fixing API field casing, safety finish reasons, and pagination timeouts in TypeScript files) are missing from the provided diff, which consists entirely of these JSON log files.