Skip to content

feat(providers): add Gemini Agent Platform (Express) provider - #64

Merged
MegalithOfficial merged 8 commits into
LettuceAI:mainfrom
rppavan:main
Jun 24, 2026
Merged

feat(providers): add Gemini Agent Platform (Express) provider#64
MegalithOfficial merged 8 commits into
LettuceAI:mainfrom
rppavan:main

Conversation

@rppavan

@rppavan rppavan commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Adds a new provider that speaks the Gemini wire format but targets aiplatform.googleapis.com with x-goog-api-key auth and a curated model whitelist (the Express endpoint can't list models).

  • Chat and image-generation adapters, delegating payload/response handling to the shared Gemini adapter
  • Support for Nano Banana image models, including non-streaming responses parsed as a single JSON body
  • Consolidates the scattered "is this a Gemini provider" checks behind shared predicates so all Gemini-family behavior stays in sync

Adds a new provider that speaks the Gemini wire format but targets
aiplatform.googleapis.com with x-goog-api-key auth and a curated model
whitelist (the Express endpoint can't list models).

- Chat and image-generation adapters, delegating payload/response
  handling to the shared Gemini adapter
- Support for Nano Banana image models, including non-streaming
  responses parsed as a single JSON body
- Consolidates the scattered "is this a Gemini provider" checks behind
  shared predicates so all Gemini-family behavior stays in sync

By apparao.parwatikar
@MegalithOfficial

Copy link
Copy Markdown
Contributor

Can we avoid hardcoding the Express model list here? If the Express API does not expose a list-models endpoint, I would rather treat this provider as "manual model ID entry" instead of returning a baked-in whitelist from known_models(). A hardcoded list will go stale and makes the app look authoritative about model availability when access can vary by key/account.

A couple of other issues I noticed:

First, The image-generation Express adapter normalizes base_url differently from the chat adapter. Chat upgrades trailing /v1 or /v1beta to /v1beta1, but image generation only checks for /v1beta1 and otherwise appends /v1beta1. So a user-provided base like https://aiplatform.googleapis.com/v1 becomes https://aiplatform.googleapis.com/v1/v1beta1/....

Second, Provider API-key verification may not be Express-aware. gemini-agent-platform-express appears to fall through to the default verifier behavior, which uses bearer auth and a /v1/models-style endpoint. That does not match the Express API shape used by the adapter (publishers/google/models/{model}:... with API-key auth), so I would expect verification to fail or at least not validate the same path generation uses.

I would suggest removing the hardcoded known_models() list, making Express use manual model IDs, and adding Express-specific verification and URL normalization.

The aarch64-linux-android `cargo check` runs with `-D warnings`, and the
`#[cfg(mobile)]` branch of `llamacpp_context_info` failed to discard the
mmproj/MTP params added later, breaking the Android check. Bind them with
`let _ =` like the existing params.

By apparao.parwatikar
@MegalithOfficial

Copy link
Copy Markdown
Contributor

You didnt have to fix that. Its not something caused by your changes. Im still changing some stuff in llama.cpp.

rppavan added 3 commits June 21, 2026 13:17
Curated model catalog for the Gemini Agent Platform (Express) provider,
served as a remote-refreshable manifest since the Express endpoint has no
API-key-listable models endpoint.

By apparao.parwatikar
- Image adapter now reuses chat's express_base() so /v1 and /v1beta
  bases upgrade to /v1beta1 the same way (no more .../v1/v1beta1/...).
- Replace the stale hardcoded known_models() whitelist with a curated
  manifest, LiteLLM-style: bundled default + runtime fetch from a public
  raw URL (1h TTL cache, validate, fall back to cache then bundled).
  Model-id stays free-text, so the list is only a convenience.
- Remove the now-dead known_models trait default and the unreachable
  list_models_endpoint/parse_models_list overrides.

By apparao.parwatikar
@rppavan

rppavan commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

@MegalithOfficial Fixed the two issues, for the model list I have added a json manifest in the repo, also the app live fetches it when it needs, it's like what litellm does for its 'model prices and context window' json file.
I realize that for litellm it's their core functionality to maintain the model info, this app has a different purpose. I just wanted make it easier to use.

@MegalithOfficial

Copy link
Copy Markdown
Contributor

I still prefer manual rather than having it hardcoded or via a JSON file. It creates extra responsibility that I am not willing to take.

rppavan added 2 commits June 22, 2026 00:03
The curated/remote-refreshable model manifest added maintenance burden
(keeping the model list current). Remove it entirely and let users enter
the Express model id manually, since the Express endpoint has no
API-key-listable models endpoint anyway.

- Delete providers::express_models and the bundled manifest JSON.
- get_remote_models returns an empty list for gemini-agent-platform-express
  (same as llamacpp); the model-id field stays free-text.
- Update the adapter comment to match.

By apparao.parwatikar
ModelSetup only enabled manual input when the fetched model list was
non-empty, so providers that return an empty list (e.g. Gemini Express,
which now has no listable catalog) left the onboarding screen stuck on an
empty dropdown with no way to type a model id. Mirror ConfigForm: switch
to manual input when the list is empty or the fetch throws.

By apparao.parwatikar
@rppavan

rppavan commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

@MegalithOfficial Sure. Removed the model manifest, Gemini Express is now, manual edit only.
Unrelated to this, can you please take a look at "Unsaved changes: Save or discard your changes before leaving." prompt which shows up every time I try to make any edits, even when there is as 'save' button on the page. It's really annoying. Can we disable it somehow?

@MegalithOfficial

Copy link
Copy Markdown
Contributor

Ignore windows action failure, Its because of llama.cpp changing their frontend.

…ution

# Conflicts:
#	src/core/storage/schemas.ts
@MegalithOfficial
MegalithOfficial merged commit ef506d0 into LettuceAI:main Jun 24, 2026
3 of 4 checks passed
@MegalithOfficial

Copy link
Copy Markdown
Contributor

Please provide your discord name so i can give you contributors role on server.

@rppavan

rppavan commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

@MegalithOfficial It's spelled same as my github account: rppavan

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