Bug Description
When using the built-in gemini provider with a GEMINI_API_KEY in ~/.hermes/.env, the agent fails with an HTTP
400 error from the Google AI Studio endpoint. Was also using a Vertex AI to generate GEMINI_API_KEY (started with AQ.Ab8...) but was able to make it run with a different API key (that started with AIzaS...)
Workaround: Renaming the key to OPENAI_API_KEY and setting provider:a single Bearer header.
Steps to Reproduce
- Generate a standard Google Cloud API key (
AIza...).
- Add
GEMINI_API_KEY=your_key to ~/.hermes/.env.
- Set
provider: gemini and default: gemini-1.5-flash in ~/.hermes/config.yaml.
- Run the agent:
~/.hermes/hermes-agent/venv/bin/python3 ~/.hermes/hermes-agent/cli.py "hello".
- Observe the
BadRequestError [HTTP 400] with the message "Multiple authentication credentials received".
Expected Behavior
The agent should successfully authenticate using either the x-goog-api-key header OR the Authorization: Bearer header, but not both.
Ideally, if using the OpenAI SDK transport, the manual injection of x-goog-api-key should be suppressed when a Bearer token is present.
Actual Behavior
The agent initialization fails with the following error: BadRequestError [HTTP 400]: Error code: 400 - [{'error': {'code': 400, 'message': 'Multiple authentication credentials received. Please pass only one.', 'status': 'INVALID_ARGUMENT'}}]
Affected Component
Configuration (config.yaml, .env, hermes setup)
Messaging Platform (if gateway-related)
No response
Operating System
Parrot Security
Python Version
3.11.15
Hermes Version
v0.8.0 (2026.4.8)
Relevant Logs / Traceback
️API call failed (attempt 1/3): BadRequestError [HTTP 400]
Provider: gemini Model: gemini-2.5-flash
Endpoint: https://generativelanguage.googleapis.com/v1beta/openai
Error: HTTP 400: Error code: 400 - [{'error': {'code': 400, 'message': 'Multiple authentication credentials received. Please pass only one.', 'status': 'INVALID_ARGUMENT'}}]
Root Cause Analysis (optional)
- The gemini provider logic manually injects an x-goog-api-key header.
- Simultaneously, the underlying openai
Python SDK automatically injects an Authorization: Bearer header.
- Google’s API gateway rejects requests that contain both headers as an ambiguous credential set.
Proposed Fix (optional)
No response
Are you willing to submit a PR for this?
Bug Description
When using the built-in gemini provider with a GEMINI_API_KEY in ~/.hermes/.env, the agent fails with an HTTP
400 error from the Google AI Studio endpoint. Was also using a Vertex AI to generate GEMINI_API_KEY (started with AQ.Ab8...) but was able to make it run with a different API key (that started with AIzaS...)
Workaround: Renaming the key to OPENAI_API_KEY and setting provider:a single Bearer header.
Steps to Reproduce
AIza...).GEMINI_API_KEY=your_keyto~/.hermes/.env.provider: geminianddefault: gemini-1.5-flashin~/.hermes/config.yaml.~/.hermes/hermes-agent/venv/bin/python3 ~/.hermes/hermes-agent/cli.py "hello".BadRequestError [HTTP 400]with the message "Multiple authentication credentials received".Expected Behavior
The agent should successfully authenticate using either the
x-goog-api-keyheader OR theAuthorization: Bearerheader, but not both.Ideally, if using the OpenAI SDK transport, the manual injection of
x-goog-api-keyshould be suppressed when a Bearer token is present.Actual Behavior
The agent initialization fails with the following error: BadRequestError [HTTP 400]: Error code: 400 - [{'error': {'code': 400, 'message': 'Multiple authentication credentials received. Please pass only one.', 'status': 'INVALID_ARGUMENT'}}]
Affected Component
Configuration (config.yaml, .env, hermes setup)
Messaging Platform (if gateway-related)
No response
Operating System
Parrot Security
Python Version
3.11.15
Hermes Version
v0.8.0 (2026.4.8)
Relevant Logs / Traceback
️API call failed (attempt 1/3): BadRequestError [HTTP 400] Provider: gemini Model: gemini-2.5-flash Endpoint: https://generativelanguage.googleapis.com/v1beta/openai Error: HTTP 400: Error code: 400 - [{'error': {'code': 400, 'message': 'Multiple authentication credentials received. Please pass only one.', 'status': 'INVALID_ARGUMENT'}}]Root Cause Analysis (optional)
Python SDK automatically injects an Authorization: Bearer header.
Proposed Fix (optional)
No response
Are you willing to submit a PR for this?