Wappler All in One AI (node.js) Version 2 - Custom Server extension

Wappler All in one AI version 2

Introduction

The original All In One AI was a merging of separate, previously released, AI modules for Gemini, GPT and Claude. Later Deepseek was added and then finally DeepL translation.
Breaking changes in the parameters of GTPT 5 based models highlighted how the code was unnecessarily complex and was in need to a tidy up.
So here is Version 2 with full GTP 5 support (as well as Claude, Gemini and Deepseek). A complete rewrite. which will also allow updates to be made more easily.
I have also added limited file upload and analysis functionality.
Deepl will remain a version 1 only option.

Installing

The extension can be installed via the project manager in the usual way.

or direct from npm via npm install @hyperbytes/wappler-all-in-one-ai-v2

https://www.npmjs.com/package/@hyperbytes/wappler-all-in-one-ai-v2

Using the extension

API Keys

The relevant API keys should be stored as Environment variables in the Server Connect options in the Environment tab. Don't forget these are target specific..

the required keys are:
OPENAI_API_KEY
GEMINI_API_KEY
ANTHROPIC_API_KEY

Once installed the extension will appear in the Ai modules group named "Multi AI Module V2"

Add it to an API action

The Options

Training Info

Optional parameter. If you have training text then this field is provided for the convenience of adding it. If you training is in a file then use my "@hyperbytes/wappler-file-to-binary-raw-text" extension to read the file contents before passing them. This text is simple appended to mandatory "AI Question" input.

AI Question

This is the main Ai Question and is mandatory

Maximum Tokens

This is the maximum tokens which should be expended on the query and response.
NOTE GPT 5 models calculate tokens in a different way and this value may need to be significantly higher.
While the underlying method of breaking text into sub-words (tokenization) remains similar (Byte Pair Encoding), tokens are effectively calculated and used differently in GPT-5 models compared to previous versions, leading to variations in actual token counts for the same text.

The key differences are:

Varying Token Counts: The same exact prompt can result in a significantly different number of tokens used in GPT-5 models versus GPT-4.1, sometimes an order of magnitude more, depending on the model variant and specific task.

"Reasoning Tokens": GPT-5 models, especially the more powerful versions, are "reasoning models" that may use additional internal "reasoning tokens" to process complex queries, which are billed as output tokens. This contrasts with older models where internal processing was less visible in token usage.

Tool Usage Costs: When using tools like web search, the billing structure has changed. For GPT-5, the content retrieved from web searches is billed as tokens at the model's rate, whereas for some GPT-4.1 models, there was a flat fee per web query.
Model Optimization: The way you prompt the model (e.g., setting the "reasoning effort" to "minimal") can heavily influence the number of tokens consumed in GPT-5, which was less pronounced in older models.

Temperature

This defines the reasoning levels from factual to Creative using values between -0 and 2

Engine

Select the AI engine to be used.

Upload File

Through this option you can pass a file from the server to AI as a reference for a question.
This parameter is optional. You can pass an image, text file or xlsx sheet.

NOTE: Not all AI engines support images/ files. It is for the user to ensure a suitable AI engine in selected when images/ files are attached.

Examples

In this example i pass this simple image, a clip of a simple spreadsheet.

Like this:

and get a response.

{"multiAI1":{"result":"24"}}

I then pass the actual .XLSX file to the extension.

I get the same result.

{"multiAI1":{"result":"24"}}

I am looking into adding pdf analysis to this extension however I remain undecided if using a separate "extract text from pdf" extension and doing so as text may be a more flexible option.

Remember this is an initial release, any bugs found -please let me know asap for a quick fix

2 Likes

I just installed this so I could use gpt5x and I’m getting the following 500 error Module multiaiv2 doesn't exist As far as I can see the module is installed correctly, and in the correct place. I tried V1 using GPT4.1 and it was working fine.

Sounds like a missing node module. Message is the false flag message i reported as a bug.

Can you check the following are installed in node_modules.
@google/generative-ai
@anthropic-ai
fs
path
xlsx
pdf
pdf.js-extract
sharp
open-ai

Looking at the package.json, may have missed pdf.js-extract from the dependencies list.
If so, will update when i get 5 mins. You can manually install via npm.

npm install pdf.js-extract

1 Like

Looks like it was the pdf.js-extract that did it Brian, thanks for that fast reply - it seems to be working perfectly now, I’m testing this extensively as its part of a complex routine - I’ll post back any findings …

I didn’t see that bug report, would’ve saved me a bit if head scratching if I’d known - I really must spend a bit more time surfing this forum..

1 Like

Package dependencies updated , that should fix for future.

1 Like

Great work Brian, just finished a lot of testing it and it’s all working perfectly.

1 Like

I just tried to install this into another project and am getting the same error message:
Module multiaiv2 doesn't exist

I know this is a bug (which hasnt been fixed) so it’s impossible for me to see what the actual missing component is. I can confirm I have all the above modules installed, they also appear in the package.json file.

Any ideas where else I need to be looking? I’ve tried multiple re-installations and Wappler hard restarts every time to no avail. It’d be a massive help if I could see where the problem was, rather than a generic ‘module doesn’t exist’

Will definitely be a missing dependency somewhere.
Is this on local server or production?
FTP or Docker?

Think i still missed "pdf.js-extract" from dependencies, give me 5 to update npm

that already exists on the local sever . Im running on local server and FTP (never use Docker, its a nightmare har har har)

i think it is a dependency of a dependency which is the issue.
can you
npm install @napi-rs/canvas

installed it, hard restarted Wappler and re-tested, issue persists.

what you have in the console, that cleared the error for me

I’m getting this still:

"status": "500",
    "message": "Module multiaiv2 doesn't exist",
    "stack": "Error: Module multiaiv2 doesn't exist"

the last npm install removed the not found error for me but introduced others related to the image libraries.
Not going to be 5 minute job by the look of it. I will come back to you asap

1 Like

No great rush Brian, I can revert to the original extension and gpt4

it works perfectly on my original development testbed but i have installed on another project and it fails.
100% sure it is dependency related, just need to find which one!

1 Like

V 1.0.8 working on my new project test, can you try at your convenience?

1 Like

I can ojnly see 1.0.6 here: https://www.npmjs.com/package/@hyperbytes/wappler-all-in-one-ai-v2

sorry, 1.0.7