Chat Trigger
Deploy an OpenAI-compatible chat endpoint. Any application that uses the OpenAI SDK — Python, Node.js, curl, IDE plugins, chat widgets — connects directly to your workflow.
Use Chat Trigger when:
- You want to deploy an AI chatbot or conversational agent as an API
- Callers use the OpenAI SDK (or any OpenAI-compatible client)
- You need streaming (SSE) token-by-token responses
- You want a simple, purpose-built chat endpoint with minimal configuration
If you need a general-purpose REST API with multiple HTTP methods and custom routing, use API Endpoint instead.
Chat Trigger produces a single chat output handle containing the parsed chat request.
| Handle | Type | Description |
|---|---|---|
chat | object | Parsed OpenAI chat request — message, history, system prompt, and metadata |
The chat object (accessed as {{ chat.* }}) shape:
| Field | Type | Description |
|---|---|---|
message | string | The latest user message extracted from messages[] |
history | array | All previous messages in the conversation (everything except the latest user message) |
system_prompt | string | The system message, if one was provided in messages[] |
metadata | object | Request metadata — model, stream, temperature, requestId, sessionId, headers, and query params |
| Setting | Type | Default | Description |
|---|---|---|---|
model_name | text | tensorify | Model name reported in ChatCompletion responses and the /models endpoint. Cosmetic — does not affect which LLM runs. |
| Setting | Type | Default | Description |
|---|---|---|---|
authType | select | none | Authentication strategy: none (open), tensorify-api-key (workspace API keys), or bearer-secret (custom token). |
secret | secret | — | Custom Bearer token for endpoint authentication. Stored encrypted. Shown when authType is bearer-secret. |
Tensorify API Key is the simplest option — callers send Authorization: Bearer tfk_... using a workspace API key from Settings → API Keys. No custom secrets to create or manage.
Bearer Secret lets you set a custom token that callers must provide. Useful when you want a simple shared secret without tying it to a workspace API key.
| Setting | Type | Default | Description |
|---|---|---|---|
responseMode | select | use-workflow-response | use-workflow-response waits for the Return node and wraps the result as a ChatCompletion. ack-immediately returns an empty ChatCompletion instantly. |
| Setting | Type | Default | Description |
|---|---|---|---|
mockPayload | code editor (JSON) | {
"messages": [{"role": "user", "content": "Hello"}]
} | Test payload for canvas test runs. Uses OpenAI messages[] format. |
Build a chatbot with streaming responses:
- Drag a Chat Trigger onto the canvas
- Set
authTypetotensorify-api-key - Add an AI Agent node — configure your LLM provider and system prompt, enable Streaming
- Add a Return node
- Wire: Chat Trigger
chat→ AI Agentmessage→ Returninput - Deploy the workflow
Access chat data in downstream nodes:
{{ chat.message }}
{{ chat.history }}
{{ chat.system_prompt }}
{{ chat.metadata.model }}
{{ chat.metadata.stream }}
from openai import OpenAI
client = OpenAI(
base_url="https://triggers.tensorify.io/h/YOUR_HOOK_PATH",
api_key="tfk_your_workspace_api_key",
)
response = client.chat.completions.create(
model="tensorify",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What can you help me with?"},
],
)
print(response.choices[0].message.content)
response = client.chat.completions.create(
model="tensorify",
messages=[{"role": "user", "content": "Tell me a story."}],
stream=True,
)
for chunk in response:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
curl -X POST https://triggers.tensorify.io/h/YOUR_HOOK_PATH/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer tfk_your_workspace_api_key" \
-d '{
"model": "tensorify",
"messages": [{"role": "user", "content": "Hello!"}]
}'
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://triggers.tensorify.io/h/YOUR_HOOK_PATH",
apiKey: "tfk_your_workspace_api_key",
});
const response = await client.chat.completions.create({
model: "tensorify",
messages: [{ role: "user", content: "Hello!" }],
});
console.log(response.choices[0].message.content);
When deployed, the Chat Trigger exposes:
| Route | Purpose |
|---|---|
| POST /chat/completions | Chat completions (main endpoint) |
| GET /models | Lists available models |
For multi-turn conversations, add a Window Memory node and set its session key to the request's session header:
{{ chat.metadata.headers['x-tensorify-session-id'] || 'default' }}
Then pass a session ID from the client:
response = client.chat.completions.create(
model="tensorify",
messages=[{"role": "user", "content": "Remember, my name is Alice."}],
extra_headers={"X-Tensorify-Session-Id": "user-alice-123"},
)
- Do not append
/chat/completionsto the base URL. OpenAI SDKs append it automatically. Setbase_urltohttps://triggers.tensorify.io/h/YOUR_HOOK_PATH— not.../chat/completions. - Model name is cosmetic. The
model_namesetting controls what appears in API responses. It does not select an LLM — your AI Agent node's provider configuration determines which model runs. - Streaming requires both sides. Enable streaming in the AI Agent node settings AND pass
stream=Truein the SDK request. - Return node required. When
responseModeisuse-workflow-response, a Return node must be connected — otherwise the caller's connection hangs until timeout.
- Deploy as an OpenAI Endpoint — step-by-step guide
- AI Agent — configure LLM provider, tools, and memory
- Streaming AI Responses — SSE streaming setup
- API Endpoint — general-purpose REST APIs
- Agent Memory — Window Memory and Qdrant Memory
