coding-stream

OpenAI-compatible n8n Chat Model with native SSE streaming and dynamic Bearer + X-Request-By

Package Information

Released: this month
Downloads: 0 weekly / 0 monthly
Latest Version: 0.1.8

Documentation

Coding Stream Chat Model for n8n

A separate community node, based on the ChatOpenAI approach of Glashkoff/n8n-nodes-llm-chat. Does NOT alter that installed package. Provides a standard AiLanguageModel for n8n AI Agent with native LangChain/OpenAI SDK streaming (no n8n Webhook SSE JSONL envelopes).

Two headers

  • Authorization: Bearer <token> is provided automatically by OpenAI SDK using its apiKey setting. Supply dynamic token from your existing n8n token-fetch nodes.
  • X-Request-By: system is passed through OpenAI SDK configuration.defaultHeaders.

Requirements

Node.js/npm for packaging; a self-hosted n8n version compatible with the pinned @n8n/ai-utilities dependency (0.27.3), e.g. check your n8n's versions. Build requires Internet for npm dependencies.

Build

npm install
npm run build
npm pack

Publish under your own npm account after changing name in package.json to an available n8n-nodes-* name; then install via n8n Settings → Community Nodes. Local tarball installation may not be supported in Community Nodes UI.

Setup

  1. In main workflow, ensure Get Token completes before AI Agent.
  2. Replace existing LLM Chat Model with Coding Stream Chat Model and attach via Model connector.
  3. Set Gateway Base URL: https://external-ai-gateway.sovcombank.group/llm/v1.
  4. Set Model: coding-ultima.
  5. Set Bearer Token expression referencing the node that holds your valid token, e.g. {{ $('Get Token').first().json.access_token }} (change node name/path to match your own main workflow).
  6. Keep X-Request-By as system.
  7. To see output streaming to a chat/webhook client, your trigger and agent must also use n8n streaming response mode. The Chat Model supplies native streaming but cannot force the top-level response to stream.

Tests

Test short content, longer streaming response, tool calls, token error, and tracing callbacks. This package is source-complete but not yet built or runtime-tested against your n8n and protected gateway.

Design note

There is intentionally no Keycloak, Redis, or Valkey inside the model node. Token retrieval is external to this model. If an AI Agent does multiple LLM calls after token expiry during one execution, refresh token before the model supplyData call or shorten agent run; the node does not auto-refresh it.

Discussion