Skip to content

fix(gemma): resolve 404 errors and improve port resolution#25340

Merged
Samee24 merged 2 commits intosameez/gemma-auto-setupfrom
abhijit-2592/gemma/fix-404-error
Apr 13, 2026
Merged

fix(gemma): resolve 404 errors and improve port resolution#25340
Samee24 merged 2 commits intosameez/gemma-auto-setupfrom
abhijit-2592/gemma/fix-404-error

Conversation

@Abhijit-2592
Copy link
Copy Markdown
Contributor

Summary

This PR resolves 404 errors encountered when using the LiteRT-LM server with the Gemini SDK by ensuring the correct API version (v1beta) is used. It also improves the user experience by dynamically resolving the server port from project settings in the gemma CLI commands.

Details

  • LocalLiteRtLmClient: Explicitly set apiVersion: 'v1beta' and vertexai: false in the GoogleGenAI constructor. The local LiteRT-LM server follows the v1beta endpoint structure, and the SDK defaults to v1, causing 404s.
  • gemma CLI commands: Updated start, status, and stop commands to read the port from experimental.gemmaModelRouter.classifier.host in the settings file if the --port flag is not provided.
  • Linting: Fixed unsafe type assertions and restricted syntax (typeof on object properties) to comply with project standards.

Related Issues

Related to sameez/gemma-auto-setup.

How to Validate

  1. Configure a custom port in your settings (e.g., experimental.gemmaModelRouter.classifier.host: "http://localhost:1234").
  2. Run gemini gemma start and verify it uses the configured port.
  3. Verify that LocalLiteRtLmClient tests pass: npm test -w @google/gemini-cli-core -- src/core/localLiteRtLmClient.test.ts.

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run

- Updated LocalLiteRtLmClient to use apiVersion: 'v1beta' and vertexai: false to ensure compatibility with the local LiteRT-LM server structure.
- Updated gemma CLI commands (start, status, stop) to dynamically resolve the port from settings if not provided via flags.
@Abhijit-2592 Abhijit-2592 requested a review from a team as a code owner April 13, 2026 21:19
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request improves the robustness of the LiteRT-LM server integration by fixing API version mismatches that caused 404 errors. Additionally, it streamlines the developer experience by allowing the CLI tools to intelligently detect the server port from existing project configurations, reducing the need for manual flag management.

Highlights

  • API Compatibility: Updated the GoogleGenAI client configuration to explicitly use 'v1beta' and disable vertexai, resolving 404 errors when communicating with the LiteRT-LM server.
  • Dynamic Port Resolution: Enhanced the CLI commands (start, status, stop) to automatically resolve the server port from the project settings if not explicitly provided via the --port flag.
  • Testing: Added verification in the unit tests to ensure the client is initialized with the correct API version and base URL.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-cli
Copy link
Copy Markdown
Contributor

gemini-cli Bot commented Apr 13, 2026

Hi @Abhijit-2592, thank you so much for your contribution to Gemini CLI! We really appreciate the time and effort you've put into this.

We're making some updates to our contribution process to improve how we track and review changes. Please take a moment to review our recent discussion post: Improving Our Contribution Process & Introducing New Guidelines.

Key Update: Starting January 26, 2026, the Gemini CLI project will require all pull requests to be associated with an existing issue. Any pull requests not linked to an issue by that date will be automatically closed.

Thank you for your understanding and for being a part of our community!

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Gemma-related CLI commands (start, status, stop) to resolve the server port from configuration settings if not explicitly provided via the command line. It also updates the LocalLiteRtLmClient to use the v1beta API version and adds corresponding test assertions. Feedback highlights significant code duplication in the port resolution logic across multiple files and identifies an issue where the status command's default Yargs configuration prevents the new settings-based port resolution from taking effect.

Comment thread packages/cli/src/commands/gemma/start.ts
Comment thread packages/cli/src/commands/gemma/status.ts
@gemini-cli gemini-cli Bot added the status/need-issue Pull requests that need to have an associated issue. label Apr 13, 2026
- Extracted port and enabled status resolution into a shared `resolveGemmaConfig` utility in `platform.ts` to reduce duplication.
- Removed the default value for the `--port` option in the `status` command so that the workspace settings act as the single source of truth when the flag is omitted.
Copy link
Copy Markdown
Contributor

@Samee24 Samee24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Samee24 Samee24 merged commit 8d3ac52 into sameez/gemma-auto-setup Apr 13, 2026
3 of 4 checks passed
@Samee24 Samee24 deleted the abhijit-2592/gemma/fix-404-error branch April 13, 2026 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status/need-issue Pull requests that need to have an associated issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants