Repository navigation
feat: include User-Agent request context header on generateContent calls - #2
Merged
Merged
Conversation
Adds a static User-Agent header ('hermes-agent (gemini-image/0.1.0)') to outgoing generateContent requests for support and compatibility context without including any user or prompt metadata. Updates the generation unit test to assert the header is sent alongside x-goog-api-key.
There was a problem hiding this comment.
Code Review
This pull request adds a User-Agent header to the Google AI Studio API requests, defining PLUGIN_VERSION and USER_AGENT constants in init.py. It also updates the test suite to assert that the User-Agent header is correctly set. There are no review comments, so no feedback is provided.
markmcd
reviewed
Oct 9, 2026
| BASE_URL = "https://generativelanguage.googleapis.com/v1beta" | ||
| DEFAULT_MODEL = "gemini-nano-banana-2.1" | ||
| PLUGIN_VERSION = "0.1.0" | ||
| USER_AGENT = f"hermes-agent (gemini-image/{PLUGIN_VERSION})" |
Member
There was a problem hiding this comment.
I think this needs to be hermes-agent/{hermes_version} (gemini-image)
or if you have both versions available you can just put both strings in the UA like hermes-agents/{hermes_version} gemini-image/{plugin_version}
they picked up the hermes version like this too, if that works?
if possible, I prefer the multi-agent version so we can understand both separately.
Formats User-Agent as 'hermes-agent/<hermes_version> gemini-image/<plugin_version>' using get_version_info().base_version so both versions can be tracked separately. Updates the unit test to verify both HERMES_VERSION and PLUGIN_VERSION are present in the header.
markmcd
approved these changes
Oct 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a static User-Agent header ('hermes-agent (gemini-image/0.1.0)') to outgoing generateContent requests for support and compatibility context without including any user or prompt metadata. Updates the generation unit test to assert the header is sent alongside x-goog-api-key.