Question: Is this project intended only for desktop OS (Windows/macOS/Linux PC), or can it also run on Android Termux (Debian)?
Hello, and thank you for your work on this project.
I would like to ask for clarification regarding the supported environments. I am trying to run this project on an Android smartphone using Termux with a Debian (proot-distro) environment, not on a desktop PC.
Environment:
· Device: Android smartphone · Terminal: Termux · Linux environment: Debian via proot-distro · Project execution: WAA_BACKEND=go ./aistudio2api · Admin page access: mobile browser at http://127.0.0.1:2048
Issue: After starting the server, I opened the admin page in the mobile browser and tried to add an account. However, when I click the account-add button, a Windows-related error bubble/popup appears and I cannot proceed.
Question: Is this project designed primarily for desktop operating systems such as Windows, macOS, and Linux PC? If so, is Android Termux / Debian (proot) officially unsupported? If there is any known workaround or recommended setup for Termux, I would greatly appreciate your guidance.
I understand that Termux is not a standard desktop environment, so I am asking to confirm whether this is an unsupported environment rather than a bug. Thank you for your time.
Termux is a normal environment for this project: run the Linux arm64 package inside proot-distro Debian and it should work.
There are two separate problems:
- “Import from Chrome” reads Chrome on the machine running the service, so it only works when the service runs on Windows (not macOS, Linux or Termux).
- For the other methods, the oversized error popup is a frontend issue that the next version fixes.
Also, WAA_BACKEND=go is the old name of what is now spidermonkey; v0.2.19 does not accept go and falls back to the Camoufox backend, so set WAA_BACKEND=spidermonkey (the default in the next version).
Thank you for the clarification. Based on your advice, I have done additional testing and would like to report the results and ask a few follow-up questions.
Environment
- Device: Android smartphone
- Terminal: Termux (host)
- Linux environment: Debian (proot-distro), arm64 / glibc (Debian trixie)
- Go: 1.27.0 (arm64)
- Admin access: mobile browser at http://127.0.0.1:2048
What I tried and what happened
1. WAA_BACKEND=spidermonkey in v0.2.19
Running the existing v0.2.19 binary with WAA_BACKEND=spidermonkey returns:
AIStudio2API 启动失败
error: WAA_BACKEND 必须是 camoufox 或 go
So the v0.2.19 binary rejects spidermonkey and only accepts camoufox or go. This seems to contradict your advice. Could you confirm:
- Is the
go->spidermonkeyrename already included in the latest release tag, or only inmain? - For v0.2.19, which value should actually be used:
goorspidermonkey?
2. Building from latest main
After git fetch + git reset --hard origin/main, the source now contains spidermonkey (confirmed via grep). However, go build fails with:
mozjs.cpp:13:10: fatal error: jsapi.h: No such file or directory
The apt package libmozjs-140-dev / libmozjs-102-dev does not exist in Debian trixie, so I downloaded the prebuilt SpiderMonkey static library from Mag1cFall/firefox Releases:
spidermonkey-v152.0.4-aistudio2api.1-linux-arm64.tar.gz
3. Linker error after using the prebuilt library
After extracting it into ./spidermonkey/ and setting CGO_CXXFLAGS / CGO_LDFLAGS, go build fails at link time:
/usr/bin/ld: hidden symbol `_ZNSt3__122__libcpp_verbose_abortEPKcz' isn't defined
/usr/bin/ld: final link failed: bad value
Also several undefined references to JS::NewArrayBufferWithContents, JS::RestoreMicroTaskQueue, etc.
I tried the following, but the same linker error persists:
- Installed
libc++-dev libc++abi-dev - Added
-lc++ -lc++abi - Added
-lstdc++ - Defined
-D_LIBCPP_AVAILABILITY_HAS_VERBOSE_ABORT=0 - Verified the symbol exists in
/usr/lib/aarch64-linux-gnu/libc++.so.1(nm -Dshows it)
4. Root cause (as far as I can tell)
From the Mag1cFall/firefox release notes:
"linux-amd64 与 linux-arm64 为 musl, linux-amd64-gnu 为 glibc."
So the linux-arm64 build I downloaded is musl-based, but Debian (proot-distro) is glibc-based. This ABI mismatch is likely why the libc++ symbols and SpiderMonkey API references cannot be resolved, and why libc++-dev / -lstdc++ did not help.
There is a linux-amd64-gnu (glibc) build, but no linux-arm64-gnu (glibc) build exists in the release assets.
Questions
- Is there a plan to publish a
linux-arm64-gnu(glibc) SpiderMonkey static library, so that Debian arm64 / proot-distro Debian users can build withspidermonkey? - Alternatively, is there a recommended build path for Debian arm64 / glibc other than using the musl
linux-arm64asset (e.g. a Zig-based build, or a specific set ofCGO_*FLAGS)? - For the current release, should Android Termux users stay on
WAA_BACKEND=go? If so, doesgoin v0.2.19 really run the pure-Go backend, or does it silently fall back to Camoufox as you mentioned? - If
godoes fall back to Camoufox in v0.2.19, is there any way to add accounts on Termux without the Camoufox/browser path (e.g. importing auth files from a PC), given that "Import from Chrome" is Windows-only?
Additional context
- I already tried copying
auth-*.jsonfrom a Windows PC into/root/.config/AIStudio2API/auth/, and the server still reported账户=0. setup --loginfails withexit status 1(likely no GUI/Camoufox in proot).- The admin page's "Browser Login" also fails with
exit status 1.
I understand Termux + proot Debian is not a mainstream target, so I am asking mainly to confirm the officially supported path and whether an arm64-gnu build is planned. Thank you for your time.
That error comes from v0.2.17 or older; since v0.2.18 WAA_BACKEND accepts camoufox and spidermonkey (go was the goja backend of those older builds).
- You don’t need to build anything: aistudio2api-v0.2.19-linux-arm64.tar.gz from the Release is a static musl binary with SpiderMonkey built in, so it runs on glibc Debian as is. Start it with WAA_BACKEND=spidermonkey ./aistudio2api.
- To build from source, follow Linux and macOS Source Build: it links the linux-arm64 library with zig cc -target aarch64-linux-musl. Linking it with the system gcc is what fails, so no arm64-gnu build is needed.
- The command-line build reads auth/ in the directory you start it from (~/.config/AIStudio2API is only for the AppImage and deb). Each account is a folder, auth/
/ with account.json and storage-state.json; copy the whole folder from your PC. Accounts added with “Sign in with browser” keep working on another device, while accounts imported from Chrome expire after about 2 hours there. “Paste cookies” in the admin page also works. - setup --login needs a desktop display. In Termux, run apt-get update && apt-get satisfy -y "libgtk-3-0, libasound2t64 | libasound2, libx11-xcb1, xvfb" and then use “Sign in with browser” in the admin page.
Just wanted to follow up and say a big thank you — everything is working now! 🎉
Your quick and precise replies made all the difference. The notes about the release binary and the auth/ path were spot on, and I really appreciate you taking the time to explain things so clearly.
Thanks again for all your work on this project — it's greatly appreciated!