Skip to main content

n8n Integration

Connect Zihin to n8n for no-code LLM automation workflows with intelligent model routing, tool calling, and media processing.

Installation

  1. In n8n: SettingsCommunity NodesInstall
  2. Search for n8n-nodes-zihin
  3. Click Install

npm (Self-hosted)

npm install n8n-nodes-zihin

Requires n8n >= 1.20.0 and Node.js >= 18.


Credential Setup

  1. Get your API Key at console.zihin.aiSettingsAPI Keys
  2. In n8n: CredentialsAdd CredentialZihin API
  3. Enter your API Key

The credential is validated automatically against the Zihin API.


Available Nodes

NodeTypePurpose
Zihin Chat ModelAI Sub-nodeLLM with tool calling for AI Agent workflows
ZihinApp NodeStandalone media processing (image, audio, document)
Zihin Image ToolAI ToolVision AI analysis — auto-discovered by AI Agents
Zihin Audio ToolAI ToolSpeech-to-text — auto-discovered by AI Agents
Zihin Document ToolAI ToolDocument parsing — auto-discovered by AI Agents

Workflow: AI Agent with Tool Calling

The most common pattern — an AI Agent powered by Zihin with access to tools:

[Chat Trigger] → [AI Agent] ← Zihin Chat Model

[Tools]
├── Calculator
├── HTTP Request
├── Zihin Image Tool
└── Zihin Document Tool

Steps:

  1. Add a Chat Trigger node
  2. Add an AI Agent node and connect the trigger
  3. Under Chat Model, select Zihin Chat Model
    • Model: auto (intelligent routing) or a specific model
    • Task Type: select based on your use case
  4. Under Tools, add any tools the agent should use
  5. Execute and test
tip

Set Model to auto and select the appropriate Task Type — Zihin automatically picks the best provider and model for the task.


Workflow: Media Processing

Process images, audio, or documents without an AI Agent:

[Webhook Trigger] → [Zihin] → [Set Node] → [Respond to Webhook]

Example — Transcribe uploaded audio:

  1. Add a Webhook node (receive file URL)
  2. Add a Zihin node
    • Resource: Audio
    • Operation: Transcribe
    • Audio: {{ $json.audioUrl }}
    • Language: pt
  3. Process the transcription downstream

The media tools are also auto-discovered by n8n's AI Agent framework — add them under Tools and the agent invokes them when needed.


Task Types

When using model: auto, the task type helps Zihin route to the optimal model:

Task TypeValueBest For
General Chatchat_generalConversations, Q&A
WritingwriteContent creation, drafting
Rewritingrewrite_editEditing, summarizing
Extractionextract_structureStructured data extraction
Reasoningreasoning_analysisComplex analysis, math
CodecodeProgramming, debugging
Data Querydata_querySQL, data questions
ResearchresearchMulti-source research

Nodes Reference

Zihin Chat Model

LangChain-compatible chat model with intelligent provider routing and tool calling support.

ParameterDefaultDescription
ModelautoLLM model or auto for intelligent routing
Task Typechat_generalRouting hint for auto mode

Options:

OptionDefaultDescription
Temperature0.7Creativity (0–2)
Max Tokens4096Maximum response tokens (1–128,000)
Top P1Nucleus sampling (0–1)
Frequency Penalty0Reduce repetition (-2 to 2)
Presence Penalty0Encourage new topics (-2 to 2)
Timeout60,000msRequest timeout (1–300s)
Max Retries2Retries with exponential backoff (0–5)
Stop SequencesComma-separated generation stop strings
Session IDMaintain conversation context across calls
JSON Output SchemaForce structured JSON responses

Supported Providers: OpenAI, Anthropic, Google, Grok, OpenRouter. The model list is loaded dynamically from the Zihin API — new models become available automatically.

Zihin Media Processing

Standalone node for image analysis, audio transcription, and document parsing.

OperationRequired FieldsSupported Formats
Image — AnalyzeImage (URL or base64)JPEG, PNG, GIF, WebP
Audio — TranscribeAudio (URL or base64)mp3, wav, ogg, flac, m4a, webm, mp4
Document — ParseDocument (URL or base64)pdf, xlsx, xls, csv, docx, txt

AI Tool Nodes

Auto-discovered by n8n's AI Agent framework. Add under Tools in an AI Agent node.

Tool NodeOperationDescription
Zihin Image ToolAnalyzeVision AI analysis with OCR support
Zihin Audio ToolTranscribeSpeech-to-text via Whisper
Zihin Document ToolParseExtract content from PDF, Excel, CSV, DOCX

API Endpoints Used

NodeEndpoint
Zihin Chat ModelPOST /api/v3/llm/public/call
Zihin Chat Model (models)GET /api/v3/llm/models
Zihin ImagePOST /api/v3/media/image/public/analyze
Zihin AudioPOST /api/v3/media/audio/public/transcribe
Zihin DocumentPOST /api/v3/media/document/public/parse

All endpoints authenticated via X-Api-Key header.


Troubleshooting

IssueSolution
"Invalid API Key"Verify the key is active at console.zihin.ai
Timeout errorsIncrease timeout in node options (default: 60s for chat, 120s for media)
Model not foundModels are loaded dynamically — check your API key has access
SSRF blockedMedia URLs must be public HTTPS. Enable "Allow Localhost" only for development