Bug Description
When configuring a Gemini connection for the experimental instance-ai module (Settings > AI Assistant > Connect a model), the "Host" field value entered in the UI is not actually used when building the outgoing request to the Google Generative Language API.
Regardless of what is entered in the Host field (with or without a trailing slash, with or without the /v1beta path segment), the underlying @ai-sdk/google client always sends requests to:
https://generativelanguage.googleapis.com/models/{model}:streamGenerateContent?alt=sse
This is missing the required /v1beta path segment (the correct/default endpoint is https://generativelanguage.googleapis.com/v1beta/models/{model}:streamGenerateContent), so every request returns a 404 Not Found from Google's API, regardless of model name or API key validity.
This affects both:
- The "Connect a model" save/test-connection flow in Settings ("Couldn't connect with these settings / Not Found")
- Actual AI Assistant usage after a model is "connected" (
Instance AI error in instance-ai-stream / AI_NoOutputGeneratedError: No output generated)
The API key itself is confirmed valid — curl "https://generativelanguage.googleapis.com/v1beta/models?key=API_KEY" from the same host returns a normal model list.
To Reproduce
- Enable the experimental instance-ai module via env vars:
- N8N_ENABLED_MODULES=instance-ai
- N8N_INSTANCE_AI_SANDBOX_ENABLED=true
- N8N_INSTANCE_AI_SANDBOX_PROVIDER=n8n-sandbox
- N8N_SANDBOX_SERVICE_URL=http://sandbox-api:8080
- N8N_SANDBOX_SERVICE_API_KEY=
- N8N_INSTANCE_AI_SEARXNG_URL=http://searxng:8080
- Go to Settings > AI Assistant > Connect a model.
- Select Provider: "Google Gemini(PaLM) Api".
- Enter:
- Host: https://generativelanguage.googleapis.com/v1beta (tried with and without trailing slash, and without the /v1beta suffix — same result every time)
- API Key: a valid AI Studio key (verified working via curl against v1beta/models)
- Model ID: tried gemini-2.5-flash, gemini-3.5-flash-lite, gemini-3.7-flash — same result for all
- Click Save.
- Observe "Couldn't connect with these settings / Not Found" in the UI.
- Tail
docker logs -f n8n while saving / using the AI Assistant chat — the logged outgoing request URL always omits /v1beta:
https://generativelanguage.googleapis.com/models/gemini-3.5-flash-lite:streamGenerateContent?alt=sse
Expected behavior
The Host value entered in "Connect a model" should be respected and used as the base URL for outgoing requests to the Gemini API (or, if the intent is for the Host field to only capture the origin, n8n should append the correct /v1beta/models/... path itself). Either way, the resulting request URL should be https://generativelanguage.googleapis.com/v1beta/models/{model}:streamGenerateContent, matching the @ai-sdk/google default, and the connection should succeed with a valid API key.
Debug Info
core
- n8nVersion: 2.34.6
- platform: docker (self-hosted)
- nodeJsVersion: 24.18.0
- nodeEnv: production
- database: postgres
- executionMode: regular
- concurrency: -1
- license: enterprise (production)
storage
- success: all
- error: all
- progress: false
- manual: true
- binaryMode: filesystem
pruning
- enabled: true
- maxAge: 336 hours
- maxCount: 10000 executions
cluster
- instanceCount: 1
- versions: 2.34.6
- instances:
- instanceType: main, instanceRole: leader, version: 2.34.6
- checks:
- check: hostid-clash, status: succeeded
- check: lifecycle, status: succeeded
- check: split-brain, status: succeeded
- check: version-mismatch, status: succeeded
Generated at: 2026-08-14T18:19:36.568Z
Operating System
Ubuntu Linux 24.04 (n8n is hosted inside Docker, using Docker Compose)
n8n Version
2.34.6
Node.js Version
24.18.0
Database
PostgreSQL
Execution mode
main (default)
Hosting
self hosted
Bug Description
When configuring a Gemini connection for the experimental
instance-aimodule (Settings > AI Assistant > Connect a model), the "Host" field value entered in the UI is not actually used when building the outgoing request to the Google Generative Language API.Regardless of what is entered in the Host field (with or without a trailing slash, with or without the
/v1betapath segment), the underlying@ai-sdk/googleclient always sends requests to:https://generativelanguage.googleapis.com/models/{model}:streamGenerateContent?alt=sse
This is missing the required
/v1betapath segment (the correct/default endpoint ishttps://generativelanguage.googleapis.com/v1beta/models/{model}:streamGenerateContent), so every request returns a 404 Not Found from Google's API, regardless of model name or API key validity.This affects both:
Instance AI error in instance-ai-stream/AI_NoOutputGeneratedError: No output generated)The API key itself is confirmed valid —
curl "https://generativelanguage.googleapis.com/v1beta/models?key=API_KEY"from the same host returns a normal model list.To Reproduce
docker logs -f n8nwhile saving / using the AI Assistant chat — the logged outgoing request URL always omits /v1beta:https://generativelanguage.googleapis.com/models/gemini-3.5-flash-lite:streamGenerateContent?alt=sse
Expected behavior
The Host value entered in "Connect a model" should be respected and used as the base URL for outgoing requests to the Gemini API (or, if the intent is for the Host field to only capture the origin, n8n should append the correct /v1beta/models/... path itself). Either way, the resulting request URL should be https://generativelanguage.googleapis.com/v1beta/models/{model}:streamGenerateContent, matching the @ai-sdk/google default, and the connection should succeed with a valid API key.
Debug Info
core
storage
pruning
cluster
Generated at: 2026-08-14T18:19:36.568Z
Operating System
Ubuntu Linux 24.04 (n8n is hosted inside Docker, using Docker Compose)
n8n Version
2.34.6
Node.js Version
24.18.0
Database
PostgreSQL
Execution mode
main (default)
Hosting
self hosted