Package Information
Available Nodes
Documentation
n8n-nodes-openai-chatkit
Custom n8n node for interacting with the OpenAI ChatKit (Agent Builder) beta without having to wire every HTTP call manually.
Features
- Create session – request a short-lived
client_secretfor an Agent Builder workflow and keep it stored in the node state. - Refresh session – rotate the stored
client_secretbefore it expires. - Send message – deliver user text (plus optional system prompt, metadata, and thread id) to the workflow and receive the full ChatKit response.
- Manual session override – provide an existing
session_id/client_secretpair directly when you do not want to use the stored state.
The node talks straight to the OpenAI API using the ChatKit beta header, so all you need is an API key with access to the feature preview.
Installation
npm install n8n-nodes-openai-chatkit
During local development you can build the project with:
npm install
npm run build
Copy the generated dist folder to your n8n custom nodes directory (usually ~/.n8n/custom/) and restart n8n.
Credentials
Create credentials of type OpenAI ChatKit API with the following fields:
- API Key – required. Must have access to the ChatKit beta.
- Base URL – optional. Defaults to
https://api.openai.com. Override only when routing through a compatible proxy. - Organization / Project – optional. Forwarded as
OpenAI-Organization/OpenAI-Projectheaders when provided.
Node usage
Session → Create
- Provide the Agent Builder
workflowIdand (optionally) auserId, metadata JSON, or extra session options JSON. - The response stores
session.id,client_secret, andexpires_atin the node state and returns the masked values.
- Provide the Agent Builder
Message → Send
- Supply the text in Message Text and map any incoming data from previous nodes.
- By default the stored session is reused. Switch Session Source to Provide Manually if you want to paste a session id and client secret instead.
- Optional fields: workflow override, thread id, role, system prompt, message metadata, and timeout.
Session → Refresh (optional)
- Requests a new
client_secretfor the stored session and updates the node state.
- Requests a new
Session → End (Local)
- Clears the stored session information so the next run can start fresh.
API calls performed
The node issues the following REST requests against the configured base URL:
POST /v1/chatkit/sessionsPOST /v1/chatkit/sessions/{session_id}/refreshPOST /v1/chatkit/sessions/{session_id}/messages
If an account still serves the earlier /v1/chat/sessions routes, the node automatically retries against those paths so you do not have to adjust any settings. Each request includes the OpenAI-Beta: chatkit_beta=v1 header required for the ChatKit preview.
Looking for end-to-end samples? The openai-chatkit-starter-app and openai-chatkit-advanced-samples repositories demonstrate how the workflows respond to these APIs.
Publishing
The repository ships a GitHub Actions workflow (.github/workflows/release.yml) that publishes the package to npm whenever a v*.*.* tag is pushed. The workflow runs npm ci, npm run build, and npm publish --provenance using the configured NPM_TOKEN secret.
License
MIT