n8n-nodes-caedral 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/README.md +92 -46
  2. package/dist/nodes/Caedral/Caedral.node.d.ts +0 -31
  3. package/dist/nodes/Caedral/Caedral.node.js +280 -98
  4. package/dist/nodes/Caedral/Caedral.node.js.map +1 -1
  5. package/dist/nodes/Caedral/Caedral.node.json +5 -2
  6. package/dist/nodes/Caedral/helpers.d.ts +1 -0
  7. package/dist/nodes/Caedral/helpers.js +3 -0
  8. package/dist/nodes/Caedral/helpers.js.map +1 -1
  9. package/dist/nodes/CaedralChatModel/CaedralChatModel.node.d.ts +10 -0
  10. package/dist/nodes/CaedralChatModel/CaedralChatModel.node.js +182 -0
  11. package/dist/nodes/CaedralChatModel/CaedralChatModel.node.js.map +1 -0
  12. package/dist/nodes/CaedralChatModel/CaedralChatModel.node.json +16 -0
  13. package/dist/nodes/CaedralEmbeddings/CaedralEmbeddings.node.d.ts +10 -0
  14. package/dist/nodes/CaedralEmbeddings/CaedralEmbeddings.node.js +114 -0
  15. package/dist/nodes/CaedralEmbeddings/CaedralEmbeddings.node.js.map +1 -0
  16. package/dist/nodes/CaedralEmbeddings/CaedralEmbeddings.node.json +16 -0
  17. package/dist/nodes/CaedralReranker/CaedralReranker.node.d.ts +10 -0
  18. package/dist/nodes/CaedralReranker/CaedralReranker.node.js +126 -0
  19. package/dist/nodes/CaedralReranker/CaedralReranker.node.js.map +1 -0
  20. package/dist/nodes/CaedralReranker/CaedralReranker.node.json +16 -0
  21. package/dist/nodes/CaedralTrigger/CaedralTrigger.node.d.ts +9 -0
  22. package/dist/nodes/CaedralTrigger/CaedralTrigger.node.js +145 -0
  23. package/dist/nodes/CaedralTrigger/CaedralTrigger.node.js.map +1 -0
  24. package/dist/nodes/CaedralTrigger/CaedralTrigger.node.json +13 -0
  25. package/package.json +15 -4
package/README.md CHANGED
@@ -1,92 +1,138 @@
1
1
  # n8n-nodes-caedral
2
2
 
3
- Official [n8n](https://n8n.io) community node for the [Caedral API](https://caedral.com). Send chat completions and check prepaid API usage from your workflows.
3
+ Community node for [n8n](https://n8n.io/) that integrates with [Caedral AI](https://caedral.com) unified access to frontier and proprietary AI models through one API.
4
4
 
5
5
  ## Installation
6
6
 
7
- ### npm (recommended for self-hosted n8n)
7
+ In your n8n instance:
8
+
9
+ 1. Go to **Settings → Community Nodes**
10
+ 2. Enter `n8n-nodes-caedral`
11
+ 3. Click **Install**
12
+
13
+ Or via CLI:
8
14
 
9
15
  ```bash
10
- cd ~/.n8n/custom
16
+ cd ~/.n8n
11
17
  npm install n8n-nodes-caedral
12
- # Restart n8n
13
18
  ```
14
19
 
15
- ### Local development (monorepo)
20
+ ## Nodes
16
21
 
17
- ```bash
18
- cd n8n-nodes-caedral
19
- npm install && npm run build
20
- npm link
21
- cd ~/.n8n/custom && npm link n8n-nodes-caedral
22
- ```
22
+ ### Caedral (Main Node)
23
23
 
24
- ## Credentials
24
+ Full-featured node with 8 operations covering all Caedral API capabilities:
25
25
 
26
- Create **Caedral API** credentials in n8n:
26
+ | Operation | Description |
27
+ |-----------|-------------|
28
+ | **Chat Completion** | Send messages to any Caedral model tier (Base, Titan, Olympus, Primordial) with system prompts, temperature, and max tokens |
29
+ | **Generate Image** | Create images from text prompts using Caedral Vision (1024×1024, 1792×1024, 1024×1792) |
30
+ | **Create Embedding** | Generate vector embeddings for text or arrays of texts using Caedral Embed |
31
+ | **Generate Audio** | Convert text to speech with voice selection (alloy, echo, fable, onyx, nova, shimmer) |
32
+ | **Rerank** | Semantically rerank documents by relevance to a query using Caedral Rerank |
33
+ | **List Models** | Retrieve all available models (chat + specialized) |
34
+ | **Get Usage** | Check pool balance, weekly usage, and overage status |
35
+ | **Get Account Info** | View account status, plan details, and billing information |
27
36
 
28
- | Field | Description |
29
- |-------|-------------|
30
- | API Key | Your `cd_live_...` key from [Dashboard → API Keys](https://caedral.com/dashboard/api-keys) |
31
- | Base URL | `https://api.caedral.com` (production) or `http://localhost:5001` (local gateway) |
37
+ ### Caedral Chat Model (AI Sub-Node)
32
38
 
33
- Connection test calls `GET /v1/usage`.
39
+ An AI Language Model node that plugs directly into n8n's native **AI Agent** and **Chain** nodes. Connect it as the language model input to instantly power your AI workflows with Caedral.
34
40
 
35
- ## Operations
41
+ - Select model tier (Base/Titan/Olympus/Primordial)
42
+ - Configure temperature and max tokens
43
+ - Compatible with all n8n AI Agent patterns
36
44
 
37
- ### Chat Completion
45
+ ### Caedral Trigger (Polling)
38
46
 
39
- Send a chat completion to any Caedral model tier (`caedral-base`, `caedral-titan`, `caedral-olympus`, `caedral-primordial`).
47
+ Automatically trigger workflows based on account conditions:
40
48
 
41
- Configure:
49
+ - **Balance Below Threshold** — fires when your balance in cents drops below a configured amount
50
+ - **Pool Usage Above Percentage** — fires when weekly pool usage exceeds a percentage threshold
42
51
 
43
- - **Model** dropdown of available tiers
44
- - **Messages** — JSON array or individual role/content fields
45
- - **Temperature**, **Max Tokens** — optional generation parameters
52
+ Polling interval configurable in n8n's trigger settings.
46
53
 
47
- Returns parsed `content`, `model`, `finishReason`, and `usage` fields.
54
+ ## Credentials
48
55
 
49
- ### Get Usage
56
+ Create a **Caedral API** credential with:
50
57
 
51
- Returns prepaid API balance, weekly pool (for Caedral Chat), plan info, and account status via `GET /v1/usage`.
58
+ | Field | Description |
59
+ |-------|-------------|
60
+ | **API Key** | Your `cd_live_...` key from the [Caedral dashboard](https://caedral.com/dashboard/api-keys) |
61
+ | **Base URL** | Default: `https://api.caedral.com`. Use `http://localhost:5001` for local development |
52
62
 
53
- ## Example workflow
63
+ The credential is validated by calling `GET /v1/usage` on save.
54
64
 
55
- 1. **Get Usage** — check `balanceCents` before a paid-tier call
56
- 2. **IF** — continue only if balance is sufficient
57
- 3. **Chat Completion** — run inference with `caedral-olympus`
58
- 4. Send output to Slack, email, or downstream nodes
65
+ ## Models
59
66
 
60
- See [Example n8n workflow](https://caedral.com/docs/n8n-example) in the Caedral docs.
67
+ ### Chat Models (for Chat Completion & AI Agent)
61
68
 
62
- ## HTTP details
69
+ | Model ID | Tier | Use Case |
70
+ |----------|------|----------|
71
+ | `caedral-base` | Free | Prototyping, everyday tasks |
72
+ | `caedral-titan` | Efficient | High-volume production |
73
+ | `caedral-olympus` | Balanced | Complex agentic applications |
74
+ | `caedral-primordial` | Frontier | Research, mission-critical |
63
75
 
64
- The node calls the Caedral API gateway directly:
76
+ ### Specialized Models
65
77
 
66
- - `POST /v1/chat/completions` chat completion
67
- - `GET /v1/usage` — usage summary
78
+ | Model ID | Modality | Pricing |
79
+ |----------|----------|---------|
80
+ | `caedral-vision` | Image generation | ~$3.50/M tokens |
81
+ | `caedral-embed` | Text embeddings | ~$0.18/M tokens |
82
+ | `caedral-voice` | Audio/speech | ~$0.84/M tokens |
83
+ | `caedral-rerank` | Semantic reranking | ~$0.35/request |
68
84
 
69
- Authentication: `Authorization: Bearer <apiKey>`.
85
+ ## Example Workflows
86
+
87
+ ### AI Agent with Caedral
88
+
89
+ 1. Add an **AI Agent** node
90
+ 2. Connect a **Caedral Chat Model** node as the Language Model input
91
+ 3. Select your preferred model tier (e.g., Olympus for balanced performance)
92
+ 4. Add tools (HTTP Request, Code, etc.) to the agent
93
+
94
+ ### Low Balance Alert
95
+
96
+ 1. Add a **Caedral Trigger** node
97
+ 2. Set condition to "Balance Below Threshold"
98
+ 3. Set threshold to 1000 (= $10.00)
99
+ 4. Connect to a Slack/Email notification node
100
+
101
+ ### Document Embedding Pipeline
102
+
103
+ 1. Trigger: new documents arrive
104
+ 2. **Caedral** node → Create Embedding operation
105
+ 3. Store embeddings in your vector database
70
106
 
71
107
  ## Development
72
108
 
73
109
  ```bash
110
+ git clone https://github.com/caedral/n8n-nodes-caedral.git
111
+ cd n8n-nodes-caedral
74
112
  npm install
75
113
  npm run build
76
114
  npm test
77
115
  ```
78
116
 
79
- Integration tests require a running local gateway on port **5001** and `DATABASE_URL` in the repo root `.env`.
80
-
81
- ## Publishing
117
+ ### Project Structure
82
118
 
83
- See [PUBLISHING.md](./PUBLISHING.md) for npm publish and n8n Creator Portal submission steps.
119
+ ```
120
+ ├── credentials/ # API credential type
121
+ ├── nodes/
122
+ │ ├── Caedral/ # Main multi-operation node
123
+ │ ├── CaedralChatModel/ # AI Agent sub-node
124
+ │ └── CaedralTrigger/ # Polling trigger node
125
+ ├── shared/ # Constants and utilities
126
+ ├── tests/ # Integration tests
127
+ └── icons/ # Node icons (light + dark)
128
+ ```
84
129
 
85
130
  ## Links
86
131
 
87
- - [Caedral docs — n8n overview](https://caedral.com/docs/n8n-overview)
88
- - [npm package](https://www.npmjs.com/package/n8n-nodes-caedral)
89
- - [GitHub](https://github.com/caedral/n8n-nodes-caedral)
132
+ - [Caedral Documentation](https://caedral.com/docs)
133
+ - [API Reference](https://caedral.com/docs/api-reference)
134
+ - [n8n Integration Guide](https://caedral.com/docs/n8n-overview)
135
+ - [Report Issues](https://github.com/caedral/n8n-nodes-caedral/issues)
90
136
 
91
137
  ## License
92
138
 
@@ -1,36 +1,5 @@
1
1
  import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from "n8n-workflow";
2
- /**
3
- * n8n node exposing the Caedral API.
4
- *
5
- * Supports two operations:
6
- * - `chatCompletion` — send a chat completion request to a Caedral
7
- * model, either with a single simple message or a full JSON
8
- * messages array.
9
- * - `getUsage` — fetch the account's current pool, balance, and
10
- * overage status.
11
- *
12
- * Requests are authenticated using the `caedralApi` credentials
13
- * (API key + optional base URL override).
14
- */
15
2
  export declare class Caedral implements INodeType {
16
3
  description: INodeTypeDescription;
17
- /**
18
- * Execute the node for every input item.
19
- *
20
- * For each item, resolves the selected `operation` and dispatches
21
- * the corresponding Caedral API call. On success, the response is
22
- * normalized into a flat JSON object and pushed to the output.
23
- *
24
- * When "Continue On Fail" is enabled, per-item errors are captured
25
- * as `{ error: string }` entries in the output; otherwise the
26
- * error is re-thrown (wrapped in `NodeOperationError` if it is not
27
- * already a node error).
28
- *
29
- * @returns A single-branch array of output items, one per input.
30
- * @throws {NodeApiError} If the Caedral API returns a non-2xx
31
- * status and "Continue On Fail" is disabled.
32
- * @throws {NodeOperationError} For validation or unknown-operation
33
- * errors, or when wrapping an unexpected runtime error.
34
- */
35
4
  execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
36
5
  }