Repository navigation
Google Gemini 3.7 Flash is incorrectly rewritten to nonexistent -tiered model ID #1894
Description
Client or integration
Codex App
Provider or upstream service
Google Gemini API / AI Studio
OpenCodex version
2.22.0
Endpoint or capability
/v1/responses → Gemini streamGenerateContent
Current behaviour
Selecting google/gemini-3.7-flash returns HTTP 404.
OpenCodex rewrites the valid model ID:
gemini-3.7-flash → gemini-3.7-flash-tiered
This mapping currently exists in src/adapters/google.ts:
const GEMINI_DIRECT_WIRE_RENAMES: Record<string, string> = {
"gemini-3.7-flash": "gemini-3.7-flash-tiered",
"gemini-3.6-flash": "gemini-3.6-flash-tiered",
};The authenticated Gemini Models API confirms:
models/gemini-3.7-flashreturns HTTP 200.models/gemini-3.7-flash-tieredreturns HTTP 404 with:
Model is not found: models/gemini-3.7-flash-tiered for api version v1beta
Consequently, requests routed through OpenCodex fail with http_404.
Expected behaviour
OpenCodex should send gemini-3.7-flash unchanged to the Gemini API, matching Google's documented model code and the model returned by models.list.
Minimal redacted request or reproduction
# Confirm the documented model exists
curl \
-H "x-goog-api-key: $GEMINI_API_KEY" \
https://generativelanguage.googleapis.com/v1beta/models/gemini-3.7-flash
# HTTP 200
# Confirm the OpenCodex-rewritten model does not exist
curl \
-H "x-goog-api-key: $GEMINI_API_KEY" \
https://generativelanguage.googleapis.com/v1beta/models/gemini-3.7-flash-tiered
# HTTP 404
# Reproduce through OpenCodex
codex exec \
--skip-git-repo-check \
-m google/gemini-3.7-flash \
"Reply only OK"
# HTTP 404 / http_404Actual response or error
Model is not found: models/gemini-3.7-flash-tiered for api version v1betaOpenCodex request history reports:
provider: google
model: gemini-3.7-flash
status: 404
errorCode: http_404
Upstream documentation
https://ai.google.dev/gemini-api/docs/models/gemini-3.7-flash
Suggested mapping or implementation notes
Remove the gemini-3.7-flash entry from GEMINI_DIRECT_WIRE_RENAMES, allowing the direct Gemini adapter to use the documented model ID unchanged.
A local test with that single mapping removed resolves the incorrect endpoint selection.
Additional context
- OS: macOS 15.7.7
- The API key is valid and can retrieve
models/gemini-3.7-flash. - The same stale rewrite is present on the current
mainbranch. - Existing provider-compatibility issues were searched; no duplicate was found.
Checks
- I searched existing provider and compatibility issues.
- The request and response were redacted.
- The expected behaviour is based on an upstream specification or concrete client requirement.
Activity
RainbowDashy commentedon Aug 17, 2026
#1739 seems to fix this issue
Merge pull request #1921 from lidge-jun/codex/wave5-wp0-wp1
lidge-jun commentedon Aug 17, 2026
Fixed on
devin #1921 (merge9dbc5fc42), which lands #1739.What was actually wrong. Your capture and the one behind commit
a70bb78d4disagree, and both are correct. That commit was written from a live account where
gemini-3.7-flashreturned 404 andgemini-3.7-flash-tieredreturned 200; youraccount returns exactly the inverse, with
models.listcarrying no-tieredrowat all. So the rename is a per-deployment fact, not a universal one — which means
the bug was not the mapping's direction but that it was unconditional. Whichever
spelling is hardcoded, one population gets a 404.
What shipped. A provider-level setting rather than a new guess:
{ "providers": { "google": { "directGeminiWireRenames": false } } }Omitted or
truekeeps the-tieredrewrite for the deployments that need it;falsesends the requested id to the wire unchanged, which is what your accountwants. Vertex keeps the requested model identity and Cloud Code Assist routing is
untouched. The default is unchanged, so you will need to set this explicitly
after the release containing it — closing this issue without saying so would leave
you exactly where you started.
A second defect surfaced while fixing this one: the
-tieredspelling was leakinginto the system identity, so the model was being told it was
gemini-3.7-flash-tiered. The wire id and the identity are now separate.Verification.
bun run typecheck,bun run privacy:scan, and the full suite(12747 pass, 10 skip, 0 fail across 823 files) green on the merged tree; focused
regressions in
tests/google-adapter.test.tsandtests/config.test.tscover thedefault, the opt-out, the persisted round-trip, and the identity line.
Closing as completed. This is on
devand not yet in a published release — it willship in the next one after v2.24.2.
docs(devlog): plan the Wave 5A-5D + Wave 6 execution campaign
Merge PR lidge-jun#1739: allow AI Studio bare Gemini Flash IDs
docs(devlog): record the WP9 gate result
docs(devlog): correct the closeout count and record the red merge
docs(devlog): plan the Wave 5A-5D + Wave 6 execution campaign
Merge PR lidge-jun#1739: allow AI Studio bare Gemini Flash IDs
Merge pull request lidge-jun#1921 from lidge-jun/codex/wave5-wp0-wp1
docs(devlog): record the WP9 gate result
docs(devlog): correct the closeout count and record the red merge