Skip to content

Run Cue's think call on Gemini behind CUE_MODEL_PROVIDER=gemini - #64

Merged
a-Fig merged 3 commits into
mainfrom
gemini
Nov 13, 2026
Merged

a-Fig merged 3 commits into
mainfrom
gemini

Conversation

@a-Fig

@a-Fig a-Fig commented Nov 13, 2026

Copy link
Copy Markdown
Owner

Closes #55

Why

For Google's "Best Use of Gemini API" track, and as the first step toward moving Cue to Gemini. CUE_MODEL_PROVIDER=gemini runs Cue's think call on Gemini. The default stays claude, so nothing changes until the flag is set.

For Tyler: this adds an outside service (Google's Gemini API) and a key, GEMINI_API_KEY. The key the server reads from its environment pays for every tick while the flag is on.

Change

  • gemini.js (new): each tick is one generateContent call to gemini-3.8-flash (GEMINI_MODEL, thinking level GEMINI_THINKING, default low). The call carries Google Search grounding and Cue's display tools as function declarations, built from the same schemas Claude gets, with additionalProperties removed since Gemini's schema subset doesn't accept it. Search runs on Google's side inside that one call, and display tools are fire-and-forget, so no tool results go back. It returns {actions, usage, note?} in the shape think() already returns, so public/ doesn't change. Tools added to DISPLAY_TOOLS later carry over on their own.
  • agent.js: picks the provider. There's no Claude fallback (Tyler, 2026-11-13: "if we're using gemini, we're using gemini"). A Gemini error fails the tick the way a Claude error does, and server.js answers 500. The only timeout is a 30 s guard against a stuck request (GEMINI_TIMEOUT_MS).
  • The system prompt's mentions of web_search read as "Google Search" for Gemini.
  • Cost: gemini-3.8-flash is priced at $0.75 / $3.75 per million tokens (input / output, thinking included). That's its introductory rate through 2026-12-31, taken from secondary sources; I didn't read Google's own pricing page. Search grounding is billed per query on top of that and isn't counted yet.
  • evals/replay.mjs: the summary line names the Gemini model when the flag is on.

Screenshots

None: nothing visible changes.

Verified

  • npm run check passes.
  • Not yet run against Gemini. The GEMINI_API_KEY in this machine's environment returns 429 RESOURCE_EXHAUSTED ("exceeded your current quota") on every Gemini model (3.8, 3.7, 3.5 Flash, 3.1 Flash-Lite). Drew is finding a working key. Until then, the request shape is untested, in particular toolConfig.includeServerSideToolInvocations, which lets Google Search and function calls share a turn. I couldn't read Google's docs page for it. If the shape is wrong, the first call fails with Gemini's error message in the log.
  • When the code still had a fallback, one tick ran through it on the 429: Claude answered with show_research, a caption and a ping in 5.5 s. That fallback has since been removed.
  • To come once there's a key: a small node evals/replay.mjs run on Gemini and on Claude (score, latency, cost), added here as a table.

Review

Needs an Opus review (it changes agent.js). Not yet reviewed.

🤖 Generated with Claude Code

smash and others added 3 commits November 13, 2026 13:50
For the hackathon's Gemini track, and as the first step toward moving
Cue to Gemini. gemini.js makes one generateContent call to
gemini-3.8-flash with Google Search grounding and Cue's display tools
as function declarations, built from the same schemas, and returns the
same actions, so public/ needs no change. Search runs on Google's side
inside that one call, and display tools are fire-and-forget, so no tool
results go back.

Gemini returned 503 "high demand" and then 429 quota errors today, so
any error, or no answer within GEMINI_TIMEOUT_MS (8 s), falls back to
Claude for that tick and logs "gemini failed, using claude: ...". The
default provider stays claude.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Tyler, 2026-11-13: if we're using Gemini, we're using Gemini. A
Gemini error now fails the tick like a Claude error does, and the
timeout is only a 30 s guard against a hung request.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run Cue's think call on Gemini (hackathon Gemini track)

1 participant