Repository navigation
Conversation
- buildModelsRequest: use x-goog-api-key header and /v1/models URL for Google adapter - fetchProviderModels: normalize Gemini API response format (models array with name field) to OpenAI-compatible shape (data array with id field)
…beta
The Google provider's models never appeared in the dashboard or Codex model
picker: /models was probed with Authorization: Bearer, which the Generative
Language API rejects, and its { models: [...] } response shape was never
parsed. buildModelsRequest now targets /v1beta/models?pageSize=1000 (v1 misses
preview models; pageSize caps at 1000 so no pageToken loop) with the
documented x-goog-api-key header, and the catalog maps the Google shape
(strip the models/ prefix, keep generateContent-capable models, use
inputTokenLimit as the context hint). API-key validation on `ocx login`
switches to the same probe.
The branch keys on effectiveGoogleMode(), which backfills googleMode from the
provider registry — a saved key-login config omits it — so google-vertex and
google-antigravity keep their existing request paths (regression-tested).
Supersedes PR #55 (same intent; that patch didn't compile and leaked the
header change into vertex/antigravity).
Co-Authored-By: Claude Fable 5 <[email protected]>
|
Thanks @simplvis — good catch on both the header and the |
|
Correction to my note above: after re-checking the actual diff, this PR contains no pagination handling — that part of my earlier comment was wrong, apologies for the confusion. The accurate summary: 84cef2f on the stabilization branch fully supersedes this PR — same |
…beta
The Google provider's models never appeared in the dashboard or Codex model
picker: /models was probed with Authorization: Bearer, which the Generative
Language API rejects, and its { models: [...] } response shape was never
parsed. buildModelsRequest now targets /v1beta/models?pageSize=1000 (v1 misses
preview models; pageSize caps at 1000 so no pageToken loop) with the
documented x-goog-api-key header, and the catalog maps the Google shape
(strip the models/ prefix, keep generateContent-capable models, use
inputTokenLimit as the context hint). API-key validation on `ocx login`
switches to the same probe.
The branch keys on effectiveGoogleMode(), which backfills googleMode from the
provider registry — a saved key-login config omits it — so google-vertex and
google-antigravity keep their existing request paths (regression-tested).
Supersedes PR lidge-jun#55 (same intent; that patch didn't compile and leaked the
header change into vertex/antigravity).
Co-Authored-By: Claude Fable 5 <[email protected]>
Google Generative Language API uses x-goog-api-key header instead of Authorization: Bearer, and its /models response returns { models: [{ name: "models/gemini-..." }] } rather than OpenAI's { data: [{ id: "gemini-..." }] } format.
This fix handles both issues so that the Google provider's models appear in the opencodex dashboard and Codex model picker.