In n8n, I’m using the Basic LLM Chain node to call the Google Gemini Chat Model (gemini-3-flash-preview) to process simple user messages. At runtime, the node returns the error Unexpected token '<'; '<!doctype' ... is not valid JSON. This error appears in the outputs of both the Basic LLM Chain node and the Google Gemini Chat Model node, indicating that the response is an HTML page rather than valid JSON. In Cherry Studio, using the same API key via the Gemini v1beta interface works fine (including web search), so the API itself seems to be fine. How can I troubleshoot or resolve this issue in n8n?
1 Like
so that error means n8n is getting an html error page instead of json from the api. couple things to check - make sure your gemini api key in n8n credentials is the same one that works in cherry studio, and verify the model name is exactly `gemini-1.5-flash` (not gemini-3-flash-preview - that model name doesnt exist). also worth checking if you have the right api endpoint selected in the credentials. lmk if changing the model name fixes it