Skip to content

Allow latest Gemini Models to be accessible - #10

Open
pnpninja wants to merge 1 commit into
huntboom:iOS-workingfrom
pnpninja:iOS-working
Open

Allow latest Gemini Models to be accessible#10
pnpninja wants to merge 1 commit into
huntboom:iOS-workingfrom
pnpninja:iOS-working

Conversation

@pnpninja

Copy link
Copy Markdown

The current code returns an error saying the Gemini 2.0 model is no longer accessible. This fixes it

Tested in Basalt Emulator

@yoann54

yoann54 commented Jun 2, 2026

Copy link
Copy Markdown

Thanks for tackling this @pnpninja — the hardcoded gemini-2.0-flash has been fully broken since Google retired it on 2026-06-01, so this is much needed.

One suggestion to make it last longer: the two presets in the current diff (gemini-2.5-flash / gemini-2.5-pro) are themselves on Google's deprecation list, with shutdown scheduled for June–July 2026. So a fixed dropdown will go stale again pretty fast.

Could we add a free-text "Custom…" option alongside the dropdown? That way, whenever Google rotates models, users can just type the new ID instead of waiting for an app update. The dropdown stays for convenience; the text field is the safety net.

Proposed clayConfig (replacing the select block in this PR):

{
  type: "select",
  messageKey: "geminiModel",
  defaultValue: "gemini-3.1-flash-lite",
  label: "Gemini model",
  description: "Pick a current model. Choose \u201CCustom\u2026\u201D to type any model ID \u2014 handy when Google retires a model and this list is out of date.",
  options: [
    { label: "Gemini 3.1 Flash-Lite (cheapest, recommended)", value: "gemini-3.1-flash-lite" },
    { label: "Gemini 3.5 Flash (balanced)", value: "gemini-3.5-flash" },
    { label: "Custom\u2026", value: "custom" },
  ],
},
{
  type: "input",
  messageKey: "geminiModelCustom",
  label: "Custom Gemini model ID",
  description: "Only used when \u201CCustom\u2026\u201D is selected above. Enter the exact model ID, e.g. gemini-3.1-pro.",
  attributes: { placeholder: "gemini-3.1-flash-lite" },
},

Small resolver so the call site stays clean (feed it the same way the app already reads geminiApiKey):

// Resolve which Gemini model to call.
// `selected` = value of the "geminiModel" select
// `custom`   = value of the "geminiModelCustom" input
function resolveGeminiModel(selected, custom) {
  selected = (selected || "").trim();
  custom = (custom || "").trim();

  // "Custom…" chosen and an ID was typed → use it verbatim.
  if (selected === "custom" && custom) return custom;

  // A concrete preset was chosen.
  if (selected && selected !== "custom") return selected;

  // Nothing set yet (e.g. installs from before this change) → safe current default.
  return "gemini-3.1-flash-lite";
}

And at the request site, build the URL from the resolved model instead of the hardcoded string:

var model = resolveGeminiModel(settings.geminiModel, settings.geminiModelCustom);
var url = "https://generativelanguage.googleapis.com/v1beta/models/"
        + encodeURIComponent(model)
        + ":generateContent?key=" + apiKey;

Benefits:

  • Custom field = real future-proofing. No new release needed next time Google rotates a model.
  • Default targets a current-gen model. gemini-3.1-flash-lite is GA, cheap, fast — well suited to a watch, and not on the 2.5 deprecation list.
  • Backwards compatible. The defaultValue + fallback mean existing installs that never touched this setting auto-migrate to a valid model instead of erroring.

Happy to help test on hardware if useful. Thanks again!

@pnpninja

pnpninja commented Jun 2, 2026

Copy link
Copy Markdown
Author

I wonder if we can pull this info and populate it dynamically in the dropdown?

@yoann54

yoann54 commented Jun 2, 2026

Copy link
Copy Markdown

That would be the perfect move @pnpninja I see there is the same problem on Claude ai section as well.

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.

2 participants