Skip to content

Instance AI (experimental module): Host field in "Connect a model" dialog is ignored, causing all Gemini requests to 404 #36354

Description

@iammarxg

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

  1. 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
  2. Go to Settings > AI Assistant > Connect a model.
  3. Select Provider: "Google Gemini(PaLM) Api".
  4. 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
  5. Click Save.
  6. Observe "Couldn't connect with these settings / Not Found" in the UI.
  7. 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs FeedbackWaiting for further input or clarification.status:in-linearIssue or PR is now in Linear

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions