Cohere Chat Nodes

Hi, when using the Cohere Chat Model node, im getting thi errors:

BadRequestError Status code: 400 Body: { “id”: “xxxxxxx-c0eb-41cf-997e-xxxxxxx”, “message”: "invalid request: this model is not supported with ‘/v1/chat’, please use ‘/v2/chat’ instead. More details in the migration guide: Migrating From API v1 to API v2 | Cohere " }

And apparently, based on Cohere latest docs Working with Cohere's API and SDK | Cohere

all chat endpoints must use /v2, but the existing built-in node uses /v1

and model checks still uses /v1. So i think this node need to be updated to use /v2 for chat + /v1 for model fetch.

Tried other openai compatible nodes with custom base url, but none work with Cohere (e.g: OpenAI Chat Model node)

Anyone can maybe share workaround to be use with the Basic LLM Chain? other than raw request using http node. Thanks

Information on your n8n setup

  • n8n version: 2.31.0
  • Database (default: SQLite): postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker
  • Operating system: ubuntu24

@lamanrasmi

Can you use http request node instead?
I believe this is the only way.

@lamanrasmi kjooleng’s answer is right for now — there isn’t a supported way to fully avoid the HTTP Request node here today. A couple of details that might help:

  • The reason the OpenAI Chat Model node with a custom base URL doesn’t work isn’t just the endpoint version — Cohere’s v2/chat request/response format isn’t the same shape as OpenAI’s chat completions, so the OpenAI-compatible node can’t map it correctly (it isn’t built to speak Cohere’s own protocol).
    • The built-in Cohere Chat Model node hardcoding /v1/chat while your model requires /v2/chat looks like a genuine bug in that node, since the model list check itself still lives on /v1. Worth filing on n8n’s GitHub issue tracker if you haven’t already, so it gets fixed at the source instead of everyone working around it.
    • One thing to note: the HTTP Request node can’t be wired in as a drop-in replacement for the Chat Model input on an AI Agent or Basic LLM Chain — that connector needs the LangChain “language model” interface, not a plain HTTP output. So the workaround only really works if you call Cohere directly with an HTTP Request node as a normal step in your flow and parse the JSON response yourself, not as a sub-node feeding an Agent/Chain.
      Hope that saves you some trial and error.

Thanks for letting us know about this, We have created CV-13 as the internal dev ticket to look into it.

Welcome @lamanrasmi!

Cohere supports an OpenAI-compatible endpoint at https://api.cohere.com/compatibility/v1 - that’s your best workaround for using it inside an AI Agent or Basic LLM Chain right now. Just use the OpenAI Chat Model node, point the base URL to that Cohere compatibility endpoint, and use your Cohere API key. This keeps the LangChain interface intact so it works natively with agents and chains.

For the v1/v2 bug, it’s worth opening a GitHub issue at GitHub - n8n-io/n8n: Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations. · GitHub so the built-in node gets updated.

Thanks for the heads up! Finally managed to get it to work with the following setup:

  1. OpenAI Credential.
  2. Basic LLM Chain node.
  3. OpenAI Chat Model connected to Basic LLM Chain node.
    • both model list & text generation now working.

No need to open a GH issue, If you see the comment before we have already opened a ticket to fix this.

New version n8n@2.33.0 got released which includes the GitHub PR 34878.