Jump to content

Squad (formerly AiWire) — one AI gateway for ProcessWire: 14 providers, embeddings, images & tool-use


Recommended Posts

Posted

Hi everyone!

AiWire is now Squad — same module, same author, cleaner name, and a lot more under the hood. Squad is a provider-independent AI gateway for ProcessWire: write your code once and switch model or provider with a single option — no provider-specific glue in your templates.

GitHub: https://github.com/mxmsmnv/Squad (old AiWire links redirect)

Squad AI

What it does

$squad = $modules->get('Squad');

// Simple call
echo $squad->chat('What is ProcessWire?');

// Full structured result (content, usage, raw)
$res = $squad->ask('Summarize this page', ['provider' => 'openai']);

// Generate multiple fields at once, cached
$squad->generate($page, [
    ['field' => 'ai_overview', 'prompt' => 'Write an overview...'],
    ['field' => 'ai_seo_meta', 'prompt' => 'Generate meta...'],
], ['cache' => 'W']);

14 providers, one API

Anthropic, OpenAI, Google, xAI, OpenRouter — plus direct Chinese providers: DeepSeek, Qwen (Alibaba), Moonshot/Kimi, Zhipu/GLM, MiniMax, 01.AI/Yi, Doubao, Ernie (Baidu), Hunyuan (Tencent). Switch with ['provider' => '...'].

More than text

$squad->embed('text to vectorize');           // embeddings (OpenAI / Google / Qwen / Zhipu)
$squad->image('a mountain at sunrise');        // images (xAI Grok Imagine, OpenAI gpt-image-1)
$squad->run([ 'message' => '...', 'tools' => [...], 'onTool' => fn($n,$i)=>... ]); // agentic tool-use

Built-in niceties: encrypted key storage (libsodium — a DB dump shows only ciphertext; or reference an env var with env:MY_KEY), prompt caching, multi-key fallback/rotation, per-page file caching, save-to-field, and a current model catalog (Opus 4.8, Fable 5, latest GPT/Gemini/Grok).

Upgrading from AiWire (order matters)

  1. Install Squad first — it auto-migrates your key table and settings (your encrypted keys are preserved).
  2. Then uninstall AiWire.

⚠️ Do it in that order — uninstalling AiWire first drops the old key table, so you'd have to re-enter your keys.

Requirements: ProcessWire 3.0.210+, PHP 8.1+ · MIT, by Maxim Semenov — smnv.org

Feedback and issues welcome 🚀

  • Like 14
Posted

What a coincidence! I’d just released a big update to my PromptAI module when I saw your post 🤯 As far as I can tell from your examples, our use cases differ slightly. Looks really good!

  • Like 2
Posted

Yeah, yours feels more like an admin-focused tool for one-shot operations, while mine went in a slightly different direction. Same tree trunk, just one has deeper roots and the other has wilder branches 😄

Honestly, it all started because they gave me $50 in credits for Claude Opus 4.6 and I wanted to test what it could actually build. My very first prompt to it was roughly:

“Create a plugin that connects AI to a ProcessWire website, something like the TeleWire you made for Telegram. Use the standard approach, add support for Anthropic, xAI, OpenAI, OpenRouter — so you can add multiple API keys and it clearly shows whether each one is working or not.”

…and then, well — «And then Ostap was off» 😂 (That famous line from Ilf & Petrov’s The Twelve Chairs when Ostap Bender gets carried away and can’t stop spinning taller and taller tales.)

From that one simple request it just snowballed into the full AiWire module you see now.

  • Like 2
Posted

Haha, yeah, those $50 in Opus credits pushed me quite a bit further too while writing this update … It’s really fascinating how fast you can move with a single prompt sometimes – only to suddenly going in circles for 30 minutes for a simple bug. Wild times 😅

  • Like 2
Posted

Thanks for an awesome module. This one is going to be super useful!

I've deployed this today to generate descriptions for Audio Visual brands using OpenAI and got it working without major issues.

I noticed a couple of things worth looking at:

1) I couldn't get the Test Chat to work with GPT-5 Nano - a response was received but the content was empty. Switching to GPT 4.1 worked fine.
2) If using OpenAI as a single provider I had to use the 'provider' option or I got an error in the response saying 'no key for Anthropic' or similar. It would be useful here if, be default, it would use whichever provider was found with an active key perhaps? That way the 'provider' option wouldn't be needed unless for a specific call to a specific provider.
3) It would be useful if the number of total used tokens and / or tokens still available information from the provider was presented in the module. I'm not sure if that information is even possible from their API though?

Thanks again. I look forward to using this module more in future!

  • maximus changed the title to Squad (formerly AiWire) — one AI gateway for ProcessWire: 14 providers, embeddings, images & tool-use
Posted

Hi all 👋

AiWire is now Squad. Same module, same author, cleaner name — and a lot more under the hood since the last release. If you were using AiWire, this is your upgrade-and-rename notice; if you're new, here's the short version.

What Squad is

A provider-independent AI gateway for ProcessWire. You write your code once against a simple API ($squad->ask(...)) and switch model/provider with a single option — no provider-specific glue in your templates.

What's new since AiWire

  • 14 providers through one API — Anthropic, OpenAI, Google, xAI, OpenRouter, plus direct Chinese providers: DeepSeek, Qwen (Alibaba), Moonshot/Kimi, Zhipu/GLM, MiniMax, 01.AI/Yi, Doubao, Ernie (Baidu), Hunyuan (Tencent).
  • Embeddingsembed() for vectors (OpenAI / Google / Qwen / Zhipu), single or batched.
  • Imagesimage() (xAI Grok Imagine, OpenAI gpt-image-1).
  • Agentic tool-userun() runs the full tool-calling loop for you (OpenAI/Anthropic differences normalized).
  • Encrypted key storage — keys live encrypted at rest (libsodium); a DB dump shows only ciphertext. You can also reference an env var with env:MY_KEY so nothing secret hits the database.
  • Prompt caching, adaptive-aware model handling, and a refreshed model catalog (Opus 4.8 default, Fable 5, current GPT/Gemini/Grok).
  • Familiar helpers kept: chat(), ask(), fallback chains, multi-key rotation, per-page file caching, save-to-field.

Migrating from AiWire (order matters)

  1. Install Squad first — it auto-migrates your key table and settings (your encrypted keys are preserved).
  2. Then uninstall AiWire.

⚠️ Do it in that order. Uninstalling AiWire first drops the old key table, so you'd have to re-enter keys.

Links & requirements

Feedback and issues welcome. Thanks to everyone who tried AiWire — Squad is where it grows from here. 🚀

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...