n8n-nodes-ocr-ai 1.0.3

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 (27) hide show
  1. package/README.md +116 -0
  2. package/dist/credentials/OcrAiClaudeApi.credentials.d.ts +10 -0
  3. package/dist/credentials/OcrAiClaudeApi.credentials.d.ts.map +1 -0
  4. package/dist/credentials/OcrAiClaudeApi.credentials.js +39 -0
  5. package/dist/credentials/OcrAiClaudeApi.credentials.js.map +1 -0
  6. package/dist/credentials/OcrAiGeminiApi.credentials.d.ts +10 -0
  7. package/dist/credentials/OcrAiGeminiApi.credentials.d.ts.map +1 -0
  8. package/dist/credentials/OcrAiGeminiApi.credentials.js +37 -0
  9. package/dist/credentials/OcrAiGeminiApi.credentials.js.map +1 -0
  10. package/dist/credentials/OcrAiGrokApi.credentials.d.ts +10 -0
  11. package/dist/credentials/OcrAiGrokApi.credentials.d.ts.map +1 -0
  12. package/dist/credentials/OcrAiGrokApi.credentials.js +37 -0
  13. package/dist/credentials/OcrAiGrokApi.credentials.js.map +1 -0
  14. package/dist/credentials/OcrAiOpenAiApi.credentials.d.ts +10 -0
  15. package/dist/credentials/OcrAiOpenAiApi.credentials.d.ts.map +1 -0
  16. package/dist/credentials/OcrAiOpenAiApi.credentials.js +37 -0
  17. package/dist/credentials/OcrAiOpenAiApi.credentials.js.map +1 -0
  18. package/dist/credentials/OcrAiVertexApi.credentials.d.ts +8 -0
  19. package/dist/credentials/OcrAiVertexApi.credentials.d.ts.map +1 -0
  20. package/dist/credentials/OcrAiVertexApi.credentials.js +28 -0
  21. package/dist/credentials/OcrAiVertexApi.credentials.js.map +1 -0
  22. package/dist/nodes/OcrAi/OcrAi.node.d.ts +6 -0
  23. package/dist/nodes/OcrAi/OcrAi.node.d.ts.map +1 -0
  24. package/dist/nodes/OcrAi/OcrAi.node.js +382 -0
  25. package/dist/nodes/OcrAi/OcrAi.node.js.map +1 -0
  26. package/dist/nodes/OcrAi/ocrAi.svg +9 -0
  27. package/package.json +73 -0
package/README.md ADDED
@@ -0,0 +1,116 @@
1
+ # n8n-nodes-ocr-ai
2
+
3
+ This is an n8n community node for document extraction using AI. It wraps the [ocr-ai](https://www.npmjs.com/package/ocr-ai) library (v1.0.3) to provide OCR and structured data extraction capabilities.
4
+
5
+ ## Features
6
+
7
+ - **Multi-provider support**: Gemini, OpenAI, Claude, Grok, and Vertex AI
8
+ - **Text extraction**: Extract plain text from documents
9
+ - **JSON extraction**: Extract structured data matching a custom schema
10
+ - **Multiple input types**: Binary data, URL, or Base64
11
+ - **Supported formats**: PDF, images (jpg, png, gif, webp, bmp, tiff), text files
12
+
13
+ ## Installation
14
+
15
+ ### Community Nodes (Recommended)
16
+
17
+ 1. Go to **Settings** > **Community Nodes**
18
+ 2. Select **Install**
19
+ 3. Enter `n8n-nodes-ocr-ai` in the package name field
20
+ 4. Accept the risks and click **Install**
21
+
22
+ ### Manual Installation
23
+
24
+ ```bash
25
+ cd ~/.n8n/nodes
26
+ pnpm install n8n-nodes-ocr-ai
27
+ ```
28
+
29
+ ## Credentials
30
+
31
+ Configure credentials based on the provider you want to use:
32
+
33
+ | Provider | Credential Type | Required Fields |
34
+ |----------|----------------|-----------------|
35
+ | Gemini | OCR AI Gemini API | API Key |
36
+ | OpenAI | OCR AI OpenAI API | API Key |
37
+ | Claude | OCR AI Claude API | API Key |
38
+ | Grok | OCR AI Grok API | API Key |
39
+ | Vertex AI | OCR AI Vertex AI | Project ID, Location |
40
+
41
+ ## Usage
42
+
43
+ ### Extract Text
44
+
45
+ 1. Add the **OCR AI** node to your workflow
46
+ 2. Select a provider and configure credentials
47
+ 3. Choose **Extract Text** operation
48
+ 4. Select input type (Binary, URL, or Base64)
49
+ 5. Configure the input source
50
+ 6. Run the workflow
51
+
52
+ ### Extract JSON
53
+
54
+ 1. Add the **OCR AI** node
55
+ 2. Choose **Extract JSON** operation
56
+ 3. Define a JSON schema describing the structure you want to extract
57
+ 4. The node will return structured data matching your schema
58
+
59
+ #### Example Schema
60
+
61
+ ```json
62
+ {
63
+ "invoice_number": "string",
64
+ "date": "string",
65
+ "total": "number",
66
+ "items": [{
67
+ "description": "string",
68
+ "quantity": "number",
69
+ "price": "number"
70
+ }]
71
+ }
72
+ ```
73
+
74
+ ## Options
75
+
76
+ | Option | Description |
77
+ |--------|-------------|
78
+ | Custom Prompt | Guide the extraction with a custom prompt |
79
+ | Language | Set extraction language (default: auto) |
80
+ | Model | Override the default model for the provider |
81
+ | Temperature | Control randomness (0-2) |
82
+ | Max Tokens | Maximum tokens in response |
83
+
84
+ ## Default Models
85
+
86
+ | Provider | Default Model |
87
+ |----------|--------------|
88
+ | Gemini | gemini-1.5-flash |
89
+ | OpenAI | gpt-4o |
90
+ | Claude | claude-sonnet-4-20250514 |
91
+ | Grok | grok-2-vision-1212 |
92
+ | Vertex AI | gemini-2.0-flash |
93
+
94
+ ## Development
95
+
96
+ ```bash
97
+ # Install dependencies
98
+ pnpm install
99
+
100
+ # Build
101
+ pnpm build
102
+
103
+ # Development mode
104
+ pnpm dev
105
+
106
+ # Lint
107
+ pnpm lint
108
+ ```
109
+
110
+ ## License
111
+
112
+ MIT
113
+
114
+ ## Dependencies
115
+
116
+ - [ocr-ai](https://www.npmjs.com/package/ocr-ai) v1.0.3
@@ -0,0 +1,10 @@
1
+ import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class OcrAiClaudeApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ documentationUrl: string;
6
+ properties: INodeProperties[];
7
+ authenticate: IAuthenticateGeneric;
8
+ test: ICredentialTestRequest;
9
+ }
10
+ //# sourceMappingURL=OcrAiClaudeApi.credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OcrAiClaudeApi.credentials.d.ts","sourceRoot":"","sources":["../../credentials/OcrAiClaudeApi.credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,MAAM,cAAc,CAAC;AAEtB,qBAAa,cAAe,YAAW,eAAe;IACrD,IAAI,SAAoB;IACxB,WAAW,SAAuB;IAClC,gBAAgB,SAAgC;IAChD,UAAU,EAAE,eAAe,EAAE,CAY3B;IAEF,YAAY,EAAE,oBAAoB,CAQhC;IAEF,IAAI,EAAE,sBAAsB,CAM1B;CACF"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OcrAiClaudeApi = void 0;
4
+ class OcrAiClaudeApi {
5
+ name = 'ocrAiClaudeApi';
6
+ displayName = 'OCR AI Claude API';
7
+ documentationUrl = 'https://docs.anthropic.com';
8
+ properties = [
9
+ {
10
+ displayName: 'API Key',
11
+ name: 'apiKey',
12
+ type: 'string',
13
+ typeOptions: {
14
+ password: true,
15
+ },
16
+ default: '',
17
+ required: true,
18
+ description: 'Your Anthropic Claude API key',
19
+ },
20
+ ];
21
+ authenticate = {
22
+ type: 'generic',
23
+ properties: {
24
+ headers: {
25
+ 'x-api-key': '={{$credentials.apiKey}}',
26
+ 'anthropic-version': '2023-06-01',
27
+ },
28
+ },
29
+ };
30
+ test = {
31
+ request: {
32
+ baseURL: 'https://api.anthropic.com/v1',
33
+ url: '/models',
34
+ method: 'GET',
35
+ },
36
+ };
37
+ }
38
+ exports.OcrAiClaudeApi = OcrAiClaudeApi;
39
+ //# sourceMappingURL=OcrAiClaudeApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OcrAiClaudeApi.credentials.js","sourceRoot":"","sources":["../../credentials/OcrAiClaudeApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,cAAc;IAC1B,IAAI,GAAG,gBAAgB,CAAC;IACxB,WAAW,GAAG,mBAAmB,CAAC;IAClC,gBAAgB,GAAG,4BAA4B,CAAC;IAChD,UAAU,GAAsB;QAC/B;YACC,WAAW,EAAE,SAAS;YACtB,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE;gBACZ,QAAQ,EAAE,IAAI;aACd;YACD,OAAO,EAAE,EAAE;YACX,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,+BAA+B;SAC5C;KACD,CAAC;IAEF,YAAY,GAAyB;QACpC,IAAI,EAAE,SAAS;QACf,UAAU,EAAE;YACX,OAAO,EAAE;gBACR,WAAW,EAAE,0BAA0B;gBACvC,mBAAmB,EAAE,YAAY;aACjC;SACD;KACD,CAAC;IAEF,IAAI,GAA2B;QAC9B,OAAO,EAAE;YACR,OAAO,EAAE,8BAA8B;YACvC,GAAG,EAAE,SAAS;YACd,MAAM,EAAE,KAAK;SACb;KACD,CAAC;CACF;AAnCD,wCAmCC"}
@@ -0,0 +1,10 @@
1
+ import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class OcrAiGeminiApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ documentationUrl: string;
6
+ properties: INodeProperties[];
7
+ authenticate: IAuthenticateGeneric;
8
+ test: ICredentialTestRequest;
9
+ }
10
+ //# sourceMappingURL=OcrAiGeminiApi.credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OcrAiGeminiApi.credentials.d.ts","sourceRoot":"","sources":["../../credentials/OcrAiGeminiApi.credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,MAAM,cAAc,CAAC;AAEtB,qBAAa,cAAe,YAAW,eAAe;IACrD,IAAI,SAAoB;IACxB,WAAW,SAAuB;IAClC,gBAAgB,SAAgC;IAChD,UAAU,EAAE,eAAe,EAAE,CAY3B;IAEF,YAAY,EAAE,oBAAoB,CAOhC;IAEF,IAAI,EAAE,sBAAsB,CAK1B;CACF"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OcrAiGeminiApi = void 0;
4
+ class OcrAiGeminiApi {
5
+ name = 'ocrAiGeminiApi';
6
+ displayName = 'OCR AI Gemini API';
7
+ documentationUrl = 'https://ai.google.dev/docs';
8
+ properties = [
9
+ {
10
+ displayName: 'API Key',
11
+ name: 'apiKey',
12
+ type: 'string',
13
+ typeOptions: {
14
+ password: true,
15
+ },
16
+ default: '',
17
+ required: true,
18
+ description: 'Your Google AI (Gemini) API key',
19
+ },
20
+ ];
21
+ authenticate = {
22
+ type: 'generic',
23
+ properties: {
24
+ headers: {
25
+ 'x-goog-api-key': '={{$credentials.apiKey}}',
26
+ },
27
+ },
28
+ };
29
+ test = {
30
+ request: {
31
+ baseURL: 'https://generativelanguage.googleapis.com/v1beta',
32
+ url: '/models',
33
+ },
34
+ };
35
+ }
36
+ exports.OcrAiGeminiApi = OcrAiGeminiApi;
37
+ //# sourceMappingURL=OcrAiGeminiApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OcrAiGeminiApi.credentials.js","sourceRoot":"","sources":["../../credentials/OcrAiGeminiApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,cAAc;IAC1B,IAAI,GAAG,gBAAgB,CAAC;IACxB,WAAW,GAAG,mBAAmB,CAAC;IAClC,gBAAgB,GAAG,4BAA4B,CAAC;IAChD,UAAU,GAAsB;QAC/B;YACC,WAAW,EAAE,SAAS;YACtB,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE;gBACZ,QAAQ,EAAE,IAAI;aACd;YACD,OAAO,EAAE,EAAE;YACX,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,iCAAiC;SAC9C;KACD,CAAC;IAEF,YAAY,GAAyB;QACpC,IAAI,EAAE,SAAS;QACf,UAAU,EAAE;YACX,OAAO,EAAE;gBACR,gBAAgB,EAAE,0BAA0B;aAC5C;SACD;KACD,CAAC;IAEF,IAAI,GAA2B;QAC9B,OAAO,EAAE;YACR,OAAO,EAAE,kDAAkD;YAC3D,GAAG,EAAE,SAAS;SACd;KACD,CAAC;CACF;AAjCD,wCAiCC"}
@@ -0,0 +1,10 @@
1
+ import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class OcrAiGrokApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ documentationUrl: string;
6
+ properties: INodeProperties[];
7
+ authenticate: IAuthenticateGeneric;
8
+ test: ICredentialTestRequest;
9
+ }
10
+ //# sourceMappingURL=OcrAiGrokApi.credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OcrAiGrokApi.credentials.d.ts","sourceRoot":"","sources":["../../credentials/OcrAiGrokApi.credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,MAAM,cAAc,CAAC;AAEtB,qBAAa,YAAa,YAAW,eAAe;IACnD,IAAI,SAAkB;IACtB,WAAW,SAAqB;IAChC,gBAAgB,SAAuB;IACvC,UAAU,EAAE,eAAe,EAAE,CAY3B;IAEF,YAAY,EAAE,oBAAoB,CAOhC;IAEF,IAAI,EAAE,sBAAsB,CAK1B;CACF"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OcrAiGrokApi = void 0;
4
+ class OcrAiGrokApi {
5
+ name = 'ocrAiGrokApi';
6
+ displayName = 'OCR AI Grok API';
7
+ documentationUrl = 'https://docs.x.ai';
8
+ properties = [
9
+ {
10
+ displayName: 'API Key',
11
+ name: 'apiKey',
12
+ type: 'string',
13
+ typeOptions: {
14
+ password: true,
15
+ },
16
+ default: '',
17
+ required: true,
18
+ description: 'Your xAI Grok API key',
19
+ },
20
+ ];
21
+ authenticate = {
22
+ type: 'generic',
23
+ properties: {
24
+ headers: {
25
+ Authorization: '=Bearer {{$credentials.apiKey}}',
26
+ },
27
+ },
28
+ };
29
+ test = {
30
+ request: {
31
+ baseURL: 'https://api.x.ai/v1',
32
+ url: '/models',
33
+ },
34
+ };
35
+ }
36
+ exports.OcrAiGrokApi = OcrAiGrokApi;
37
+ //# sourceMappingURL=OcrAiGrokApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OcrAiGrokApi.credentials.js","sourceRoot":"","sources":["../../credentials/OcrAiGrokApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,YAAY;IACxB,IAAI,GAAG,cAAc,CAAC;IACtB,WAAW,GAAG,iBAAiB,CAAC;IAChC,gBAAgB,GAAG,mBAAmB,CAAC;IACvC,UAAU,GAAsB;QAC/B;YACC,WAAW,EAAE,SAAS;YACtB,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE;gBACZ,QAAQ,EAAE,IAAI;aACd;YACD,OAAO,EAAE,EAAE;YACX,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,uBAAuB;SACpC;KACD,CAAC;IAEF,YAAY,GAAyB;QACpC,IAAI,EAAE,SAAS;QACf,UAAU,EAAE;YACX,OAAO,EAAE;gBACR,aAAa,EAAE,iCAAiC;aAChD;SACD;KACD,CAAC;IAEF,IAAI,GAA2B;QAC9B,OAAO,EAAE;YACR,OAAO,EAAE,qBAAqB;YAC9B,GAAG,EAAE,SAAS;SACd;KACD,CAAC;CACF;AAjCD,oCAiCC"}
@@ -0,0 +1,10 @@
1
+ import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class OcrAiOpenAiApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ documentationUrl: string;
6
+ properties: INodeProperties[];
7
+ authenticate: IAuthenticateGeneric;
8
+ test: ICredentialTestRequest;
9
+ }
10
+ //# sourceMappingURL=OcrAiOpenAiApi.credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OcrAiOpenAiApi.credentials.d.ts","sourceRoot":"","sources":["../../credentials/OcrAiOpenAiApi.credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,MAAM,cAAc,CAAC;AAEtB,qBAAa,cAAe,YAAW,eAAe;IACrD,IAAI,SAAoB;IACxB,WAAW,SAAuB;IAClC,gBAAgB,SAAsC;IACtD,UAAU,EAAE,eAAe,EAAE,CAY3B;IAEF,YAAY,EAAE,oBAAoB,CAOhC;IAEF,IAAI,EAAE,sBAAsB,CAK1B;CACF"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OcrAiOpenAiApi = void 0;
4
+ class OcrAiOpenAiApi {
5
+ name = 'ocrAiOpenAiApi';
6
+ displayName = 'OCR AI OpenAI API';
7
+ documentationUrl = 'https://platform.openai.com/docs';
8
+ properties = [
9
+ {
10
+ displayName: 'API Key',
11
+ name: 'apiKey',
12
+ type: 'string',
13
+ typeOptions: {
14
+ password: true,
15
+ },
16
+ default: '',
17
+ required: true,
18
+ description: 'Your OpenAI API key',
19
+ },
20
+ ];
21
+ authenticate = {
22
+ type: 'generic',
23
+ properties: {
24
+ headers: {
25
+ Authorization: '=Bearer {{$credentials.apiKey}}',
26
+ },
27
+ },
28
+ };
29
+ test = {
30
+ request: {
31
+ baseURL: 'https://api.openai.com/v1',
32
+ url: '/models',
33
+ },
34
+ };
35
+ }
36
+ exports.OcrAiOpenAiApi = OcrAiOpenAiApi;
37
+ //# sourceMappingURL=OcrAiOpenAiApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OcrAiOpenAiApi.credentials.js","sourceRoot":"","sources":["../../credentials/OcrAiOpenAiApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,cAAc;IAC1B,IAAI,GAAG,gBAAgB,CAAC;IACxB,WAAW,GAAG,mBAAmB,CAAC;IAClC,gBAAgB,GAAG,kCAAkC,CAAC;IACtD,UAAU,GAAsB;QAC/B;YACC,WAAW,EAAE,SAAS;YACtB,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE;gBACZ,QAAQ,EAAE,IAAI;aACd;YACD,OAAO,EAAE,EAAE;YACX,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,qBAAqB;SAClC;KACD,CAAC;IAEF,YAAY,GAAyB;QACpC,IAAI,EAAE,SAAS;QACf,UAAU,EAAE;YACX,OAAO,EAAE;gBACR,aAAa,EAAE,iCAAiC;aAChD;SACD;KACD,CAAC;IAEF,IAAI,GAA2B;QAC9B,OAAO,EAAE;YACR,OAAO,EAAE,2BAA2B;YACpC,GAAG,EAAE,SAAS;SACd;KACD,CAAC;CACF;AAjCD,wCAiCC"}
@@ -0,0 +1,8 @@
1
+ import { ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class OcrAiVertexApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ documentationUrl: string;
6
+ properties: INodeProperties[];
7
+ }
8
+ //# sourceMappingURL=OcrAiVertexApi.credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OcrAiVertexApi.credentials.d.ts","sourceRoot":"","sources":["../../credentials/OcrAiVertexApi.credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEhE,qBAAa,cAAe,YAAW,eAAe;IACrD,IAAI,SAAoB;IACxB,WAAW,SAAsB;IACjC,gBAAgB,SAA6C;IAC7D,UAAU,EAAE,eAAe,EAAE,CAiB3B;CACF"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OcrAiVertexApi = void 0;
4
+ class OcrAiVertexApi {
5
+ name = 'ocrAiVertexApi';
6
+ displayName = 'OCR AI Vertex AI';
7
+ documentationUrl = 'https://cloud.google.com/vertex-ai/docs';
8
+ properties = [
9
+ {
10
+ displayName: 'Project ID',
11
+ name: 'project',
12
+ type: 'string',
13
+ default: '',
14
+ required: true,
15
+ description: 'Your Google Cloud project ID',
16
+ },
17
+ {
18
+ displayName: 'Location',
19
+ name: 'location',
20
+ type: 'string',
21
+ default: 'us-central1',
22
+ required: true,
23
+ description: 'The Google Cloud region (e.g., us-central1, europe-west1)',
24
+ },
25
+ ];
26
+ }
27
+ exports.OcrAiVertexApi = OcrAiVertexApi;
28
+ //# sourceMappingURL=OcrAiVertexApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OcrAiVertexApi.credentials.js","sourceRoot":"","sources":["../../credentials/OcrAiVertexApi.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAa,cAAc;IAC1B,IAAI,GAAG,gBAAgB,CAAC;IACxB,WAAW,GAAG,kBAAkB,CAAC;IACjC,gBAAgB,GAAG,yCAAyC,CAAC;IAC7D,UAAU,GAAsB;QAC/B;YACC,WAAW,EAAE,YAAY;YACzB,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE;YACX,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,8BAA8B;SAC3C;QACD;YACC,WAAW,EAAE,UAAU;YACvB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,aAAa;YACtB,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,2DAA2D;SACxE;KACD,CAAC;CACF;AAtBD,wCAsBC"}
@@ -0,0 +1,6 @@
1
+ import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class OcrAi implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ }
6
+ //# sourceMappingURL=OcrAi.node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OcrAi.node.d.ts","sourceRoot":"","sources":["../../../nodes/OcrAi/OcrAi.node.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,oBAAoB,EAGpB,MAAM,cAAc,CAAC;AAGtB,qBAAa,KAAM,YAAW,SAAS;IACtC,WAAW,EAAE,oBAAoB,CAwQ/B;IAEI,OAAO,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC;CAmIvE"}
@@ -0,0 +1,382 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OcrAi = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const ocr_ai_1 = require("ocr-ai");
6
+ class OcrAi {
7
+ description = {
8
+ displayName: 'OCR AI',
9
+ name: 'ocrAi',
10
+ icon: 'file:ocrAi.svg',
11
+ group: ['transform'],
12
+ version: 1,
13
+ subtitle: '={{$parameter["operation"] + ": " + $parameter["provider"]}}',
14
+ description: 'Extract text or structured data from documents using AI (ocr-ai v1.0.3)',
15
+ defaults: {
16
+ name: 'OCR AI',
17
+ },
18
+ inputs: ["main" /* NodeConnectionType.Main */],
19
+ outputs: ["main" /* NodeConnectionType.Main */],
20
+ credentials: [
21
+ {
22
+ name: 'ocrAiGeminiApi',
23
+ required: true,
24
+ displayOptions: {
25
+ show: {
26
+ provider: ['gemini'],
27
+ },
28
+ },
29
+ },
30
+ {
31
+ name: 'ocrAiOpenAiApi',
32
+ required: true,
33
+ displayOptions: {
34
+ show: {
35
+ provider: ['openai'],
36
+ },
37
+ },
38
+ },
39
+ {
40
+ name: 'ocrAiClaudeApi',
41
+ required: true,
42
+ displayOptions: {
43
+ show: {
44
+ provider: ['claude'],
45
+ },
46
+ },
47
+ },
48
+ {
49
+ name: 'ocrAiGrokApi',
50
+ required: true,
51
+ displayOptions: {
52
+ show: {
53
+ provider: ['grok'],
54
+ },
55
+ },
56
+ },
57
+ {
58
+ name: 'ocrAiVertexApi',
59
+ required: true,
60
+ displayOptions: {
61
+ show: {
62
+ provider: ['vertex'],
63
+ },
64
+ },
65
+ },
66
+ ],
67
+ properties: [
68
+ {
69
+ displayName: 'Provider',
70
+ name: 'provider',
71
+ type: 'options',
72
+ noDataExpression: true,
73
+ options: [
74
+ {
75
+ name: 'Gemini',
76
+ value: 'gemini',
77
+ description: 'Google Generative AI (Gemini)',
78
+ },
79
+ {
80
+ name: 'OpenAI',
81
+ value: 'openai',
82
+ description: 'OpenAI GPT models',
83
+ },
84
+ {
85
+ name: 'Claude',
86
+ value: 'claude',
87
+ description: 'Anthropic Claude',
88
+ },
89
+ {
90
+ name: 'Grok',
91
+ value: 'grok',
92
+ description: 'xAI Grok',
93
+ },
94
+ {
95
+ name: 'Vertex AI',
96
+ value: 'vertex',
97
+ description: 'Google Cloud Vertex AI',
98
+ },
99
+ ],
100
+ default: 'gemini',
101
+ description: 'The AI provider to use for extraction',
102
+ },
103
+ {
104
+ displayName: 'Operation',
105
+ name: 'operation',
106
+ type: 'options',
107
+ noDataExpression: true,
108
+ options: [
109
+ {
110
+ name: 'Extract Text',
111
+ value: 'extractText',
112
+ description: 'Extract plain text from a document',
113
+ action: 'Extract text from a document',
114
+ },
115
+ {
116
+ name: 'Extract JSON',
117
+ value: 'extractJson',
118
+ description: 'Extract structured JSON data from a document',
119
+ action: 'Extract JSON from a document',
120
+ },
121
+ ],
122
+ default: 'extractText',
123
+ },
124
+ {
125
+ displayName: 'Input Type',
126
+ name: 'inputType',
127
+ type: 'options',
128
+ options: [
129
+ {
130
+ name: 'Binary Data',
131
+ value: 'binary',
132
+ description: 'Use binary data from previous node',
133
+ },
134
+ {
135
+ name: 'URL',
136
+ value: 'url',
137
+ description: 'Fetch document from URL',
138
+ },
139
+ {
140
+ name: 'Base64',
141
+ value: 'base64',
142
+ description: 'Use base64 encoded string',
143
+ },
144
+ ],
145
+ default: 'binary',
146
+ description: 'How to provide the document',
147
+ },
148
+ {
149
+ displayName: 'Binary Property',
150
+ name: 'binaryPropertyName',
151
+ type: 'string',
152
+ default: 'data',
153
+ required: true,
154
+ displayOptions: {
155
+ show: {
156
+ inputType: ['binary'],
157
+ },
158
+ },
159
+ description: 'Name of the binary property containing the document',
160
+ },
161
+ {
162
+ displayName: 'URL',
163
+ name: 'url',
164
+ type: 'string',
165
+ default: '',
166
+ required: true,
167
+ displayOptions: {
168
+ show: {
169
+ inputType: ['url'],
170
+ },
171
+ },
172
+ placeholder: 'https://example.com/document.pdf',
173
+ description: 'URL of the document to extract from',
174
+ },
175
+ {
176
+ displayName: 'Base64 Content',
177
+ name: 'base64Content',
178
+ type: 'string',
179
+ default: '',
180
+ required: true,
181
+ displayOptions: {
182
+ show: {
183
+ inputType: ['base64'],
184
+ },
185
+ },
186
+ description: 'Base64 encoded document content',
187
+ },
188
+ {
189
+ displayName: 'File Name',
190
+ name: 'fileName',
191
+ type: 'string',
192
+ default: 'document.pdf',
193
+ required: true,
194
+ displayOptions: {
195
+ show: {
196
+ inputType: ['base64'],
197
+ },
198
+ },
199
+ description: 'File name with extension (needed to determine file type)',
200
+ },
201
+ {
202
+ displayName: 'JSON Schema',
203
+ name: 'jsonSchema',
204
+ type: 'json',
205
+ default: '{\n "invoice_number": "string",\n "date": "string",\n "total": "number",\n "items": [{\n "description": "string",\n "quantity": "number",\n "price": "number"\n }]\n}',
206
+ required: true,
207
+ displayOptions: {
208
+ show: {
209
+ operation: ['extractJson'],
210
+ },
211
+ },
212
+ description: 'JSON schema describing the structure of data to extract',
213
+ },
214
+ {
215
+ displayName: 'Options',
216
+ name: 'options',
217
+ type: 'collection',
218
+ placeholder: 'Add Option',
219
+ default: {},
220
+ options: [
221
+ {
222
+ displayName: 'Custom Prompt',
223
+ name: 'prompt',
224
+ type: 'string',
225
+ typeOptions: {
226
+ rows: 4,
227
+ },
228
+ default: '',
229
+ description: 'Custom prompt to guide the extraction',
230
+ },
231
+ {
232
+ displayName: 'Language',
233
+ name: 'language',
234
+ type: 'string',
235
+ default: 'auto',
236
+ description: 'Language for extraction (e.g., "en", "es", "auto")',
237
+ },
238
+ {
239
+ displayName: 'Model',
240
+ name: 'model',
241
+ type: 'string',
242
+ default: '',
243
+ description: 'Override the default model. Leave empty to use provider defaults (gemini-1.5-flash, gpt-4o, claude-sonnet-4-20250514, grok-2-vision-1212, gemini-2.0-flash).',
244
+ },
245
+ {
246
+ displayName: 'Temperature',
247
+ name: 'temperature',
248
+ type: 'number',
249
+ typeOptions: {
250
+ minValue: 0,
251
+ maxValue: 2,
252
+ numberStepSize: 0.1,
253
+ },
254
+ default: 0,
255
+ description: 'Controls randomness (0 = deterministic, higher = more random)',
256
+ },
257
+ {
258
+ displayName: 'Max Tokens',
259
+ name: 'maxTokens',
260
+ type: 'number',
261
+ typeOptions: {
262
+ minValue: 1,
263
+ },
264
+ default: 4096,
265
+ description: 'Maximum tokens to generate in the response',
266
+ },
267
+ ],
268
+ },
269
+ ],
270
+ };
271
+ async execute() {
272
+ const items = this.getInputData();
273
+ const returnData = [];
274
+ for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
275
+ try {
276
+ const provider = this.getNodeParameter('provider', itemIndex);
277
+ const operation = this.getNodeParameter('operation', itemIndex);
278
+ const inputType = this.getNodeParameter('inputType', itemIndex);
279
+ const options = this.getNodeParameter('options', itemIndex);
280
+ // Get credentials based on provider
281
+ let apiKey = '';
282
+ let vertexConfig;
283
+ if (provider === 'vertex') {
284
+ const credentials = await this.getCredentials('ocrAiVertexApi');
285
+ vertexConfig = {
286
+ project: credentials.project,
287
+ location: credentials.location,
288
+ };
289
+ }
290
+ else {
291
+ const credentialName = `ocrAi${provider.charAt(0).toUpperCase() + provider.slice(1)}Api`;
292
+ const credentials = await this.getCredentials(credentialName);
293
+ apiKey = credentials.apiKey;
294
+ }
295
+ // Initialize OcrAI
296
+ const ocr = new ocr_ai_1.OcrAI({
297
+ provider,
298
+ apiKey,
299
+ model: options.model || undefined,
300
+ vertexConfig,
301
+ });
302
+ // Build extraction options
303
+ const extractionOptions = {
304
+ format: operation === 'extractJson' ? 'json' : 'text',
305
+ prompt: options.prompt || undefined,
306
+ language: options.language || undefined,
307
+ modelConfig: {
308
+ temperature: options.temperature,
309
+ maxTokens: options.maxTokens,
310
+ },
311
+ };
312
+ // Add schema for JSON extraction
313
+ if (operation === 'extractJson') {
314
+ const schemaString = this.getNodeParameter('jsonSchema', itemIndex);
315
+ try {
316
+ extractionOptions.schema = JSON.parse(schemaString);
317
+ }
318
+ catch (e) {
319
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Invalid JSON schema. Please provide valid JSON.', { itemIndex });
320
+ }
321
+ }
322
+ // Execute extraction based on input type
323
+ let result;
324
+ if (inputType === 'binary') {
325
+ const binaryPropertyName = this.getNodeParameter('binaryPropertyName', itemIndex);
326
+ const binaryData = this.helpers.assertBinaryData(itemIndex, binaryPropertyName);
327
+ const buffer = await this.helpers.getBinaryDataBuffer(itemIndex, binaryPropertyName);
328
+ result = await ocr.extractFromBuffer(buffer, binaryData.fileName || 'document');
329
+ }
330
+ else if (inputType === 'url') {
331
+ const url = this.getNodeParameter('url', itemIndex);
332
+ result = await ocr.extract(url);
333
+ }
334
+ else if (inputType === 'base64') {
335
+ const base64Content = this.getNodeParameter('base64Content', itemIndex);
336
+ const fileName = this.getNodeParameter('fileName', itemIndex);
337
+ result = await ocr.extractFromBase64(base64Content, fileName, extractionOptions);
338
+ }
339
+ if (!result) {
340
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'No result returned from extraction', {
341
+ itemIndex,
342
+ });
343
+ }
344
+ if (!result.success) {
345
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Extraction failed: ${result.error} (${result.code})`, { itemIndex });
346
+ }
347
+ // Build output
348
+ const outputData = {
349
+ success: true,
350
+ format: result.format,
351
+ metadata: result.metadata,
352
+ };
353
+ if (result.format === 'json') {
354
+ outputData.data = result.data;
355
+ }
356
+ else {
357
+ outputData.content = result.content;
358
+ }
359
+ returnData.push({
360
+ json: outputData,
361
+ pairedItem: itemIndex,
362
+ });
363
+ }
364
+ catch (error) {
365
+ if (this.continueOnFail()) {
366
+ returnData.push({
367
+ json: {
368
+ success: false,
369
+ error: error instanceof Error ? error.message : String(error),
370
+ },
371
+ pairedItem: itemIndex,
372
+ });
373
+ continue;
374
+ }
375
+ throw error;
376
+ }
377
+ }
378
+ return [returnData];
379
+ }
380
+ }
381
+ exports.OcrAi = OcrAi;
382
+ //# sourceMappingURL=OcrAi.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OcrAi.node.js","sourceRoot":"","sources":["../../../nodes/OcrAi/OcrAi.node.ts"],"names":[],"mappings":";;;AAAA,+CAQsB;AACtB,mCAAwE;AAExE,MAAa,KAAK;IACjB,WAAW,GAAyB;QACnC,WAAW,EAAE,QAAQ;QACrB,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,gBAAgB;QACtB,KAAK,EAAE,CAAC,WAAW,CAAC;QACpB,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,8DAA8D;QACxE,WAAW,EAAE,yEAAyE;QACtF,QAAQ,EAAE;YACT,IAAI,EAAE,QAAQ;SACd;QACD,MAAM,EAAE,sCAAyB;QACjC,OAAO,EAAE,sCAAyB;QAClC,WAAW,EAAE;YACZ;gBACC,IAAI,EAAE,gBAAgB;gBACtB,QAAQ,EAAE,IAAI;gBACd,cAAc,EAAE;oBACf,IAAI,EAAE;wBACL,QAAQ,EAAE,CAAC,QAAQ,CAAC;qBACpB;iBACD;aACD;YACD;gBACC,IAAI,EAAE,gBAAgB;gBACtB,QAAQ,EAAE,IAAI;gBACd,cAAc,EAAE;oBACf,IAAI,EAAE;wBACL,QAAQ,EAAE,CAAC,QAAQ,CAAC;qBACpB;iBACD;aACD;YACD;gBACC,IAAI,EAAE,gBAAgB;gBACtB,QAAQ,EAAE,IAAI;gBACd,cAAc,EAAE;oBACf,IAAI,EAAE;wBACL,QAAQ,EAAE,CAAC,QAAQ,CAAC;qBACpB;iBACD;aACD;YACD;gBACC,IAAI,EAAE,cAAc;gBACpB,QAAQ,EAAE,IAAI;gBACd,cAAc,EAAE;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/>
3
+ <path d="M16 20h32v4H16v-4z" fill="white"/>
4
+ <path d="M16 28h24v3H16v-3z" fill="white" opacity="0.8"/>
5
+ <path d="M16 35h28v3H16v-3z" fill="white" opacity="0.6"/>
6
+ <path d="M16 42h20v3H16v-3z" fill="white" opacity="0.4"/>
7
+ <circle cx="46" cy="42" r="10" fill="#10B981"/>
8
+ <path d="M42 42l3 3 6-6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
9
+ </svg>
package/package.json ADDED
@@ -0,0 +1,73 @@
1
+ {
2
+ "name": "n8n-nodes-ocr-ai",
3
+ "version": "1.0.3",
4
+ "description": "n8n community node for OCR and document extraction using multiple AI providers (Gemini, OpenAI, Claude, Grok, Vertex)",
5
+ "keywords": [
6
+ "n8n-community-node-package",
7
+ "ocr",
8
+ "document-extraction",
9
+ "ai",
10
+ "gemini",
11
+ "openai",
12
+ "claude",
13
+ "grok",
14
+ "vertex"
15
+ ],
16
+ "license": "MIT",
17
+ "homepage": "https://github.com/yourusername/n8n-nodes-ocr-ai",
18
+ "author": {
19
+ "name": "Rafael E. Maldonado",
20
+ "email": "remdph@gmail.com"
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "https://github.com/yourusername/n8n-nodes-ocr-ai.git"
25
+ },
26
+ "engines": {
27
+ "node": ">=18.10",
28
+ "pnpm": ">=9.1"
29
+ },
30
+ "packageManager": "pnpm@9.1.4",
31
+ "main": "dist/nodes/OcrAi/OcrAi.node.js",
32
+ "scripts": {
33
+ "preinstall": "npx only-allow pnpm",
34
+ "build": "tsc && gulp build:icons",
35
+ "dev": "tsc --watch",
36
+ "format": "prettier nodes credentials --write",
37
+ "lint": "eslint nodes credentials package.json",
38
+ "lintfix": "eslint nodes credentials package.json --fix",
39
+ "prepublishOnly": "npx pnpm build"
40
+ },
41
+ "files": [
42
+ "dist"
43
+ ],
44
+ "n8n": {
45
+ "n8nNodesApiVersion": 1,
46
+ "credentials": [
47
+ "dist/credentials/OcrAiGeminiApi.credentials.js",
48
+ "dist/credentials/OcrAiOpenAiApi.credentials.js",
49
+ "dist/credentials/OcrAiClaudeApi.credentials.js",
50
+ "dist/credentials/OcrAiGrokApi.credentials.js",
51
+ "dist/credentials/OcrAiVertexApi.credentials.js"
52
+ ],
53
+ "nodes": [
54
+ "dist/nodes/OcrAi/OcrAi.node.js"
55
+ ]
56
+ },
57
+ "devDependencies": {
58
+ "@types/node": "^20.10.0",
59
+ "@typescript-eslint/parser": "~7.18.0",
60
+ "eslint": "~8.57.0",
61
+ "eslint-plugin-n8n-nodes-base": "~1.16.2",
62
+ "gulp": "~4.0.2",
63
+ "n8n-workflow": "~1.62.0",
64
+ "prettier": "~3.3.3",
65
+ "typescript": "~5.6.0"
66
+ },
67
+ "peerDependencies": {
68
+ "n8n-workflow": "~1.62.0"
69
+ },
70
+ "dependencies": {
71
+ "ocr-ai": "1.0.3"
72
+ }
73
+ }