Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

feat(zauth): add /api/zauth-status diagnostic endpoint

nirholas8bdedd9c5df0
diff --git a/.env.example b/.env.example
index 7c36a313e..ed055f076 100644
--- a/.env.example
+++ b/.env.example
@@ -155,8 +155,10 @@ X402_FACILITATOR_TOKEN_SOLANA=
X402_FACILITATOR_TOKEN_BASE=
# zauthx402 — telemetry + monitoring for x402 endpoints. Optional; when unset
-# the SDK is not invoked. Get a key at https://zauthx402.com.
+# the SDK is not invoked. Get a key at https://zauth.inc/provider-hub.
ZAUTH_API_KEY=
+# Set to "1" to enable verbose [zauthSDK:*] logs in Vercel.
+ZAUTH_DEBUG=
# ── GitHub OAuth (social memory seeding) ─────────────────────────────────────
# Create an OAuth App at https://github.com/settings/developers.
diff --git a/api/_lib/zauth.js b/api/_lib/zauth.js
index 792189ff0..6e9d000c9 100644
--- a/api/_lib/zauth.js
+++ b/api/_lib/zauth.js
@@ -58,6 +58,21 @@ function getMiddleware() {
return cached;
}
+/**
+ * Diagnostic snapshot — does not invoke the middleware. Returns whether the
+ * SDK initialized successfully and a key prefix safe to surface in responses.
+ */
+export function status() {
+ const apiKey = env.ZAUTH_API_KEY;
+ const initialized = getMiddleware() != null;
+ return {
+ initialized,
+ hasKey: Boolean(apiKey),
+ keyPrefix: apiKey ? apiKey.slice(0, 14) : null,
+ debug: env.ZAUTH_DEBUG === '1',
+ };
+}
+
function shimResponse(res) {
// The Express middleware does `res.json.bind(res)` / `res.send.bind(res)`
// up-front, even if the handler never calls them. Provide Express-shaped
diff --git a/api/zauth-status.js b/api/zauth-status.js
new file mode 100644
index 000000000..7e57fd157
--- /dev/null
+++ b/api/zauth-status.js
@@ -0,0 +1,8 @@
+import { cors, json, method, wrap } from './_lib/http.js';
+import { status } from './_lib/zauth.js';
+
+export default wrap(async (req, res) => {
+ if (cors(req, res, { methods: 'GET,OPTIONS' })) return;
+ if (!method(req, res, ['GET'])) return;
+ return json(res, 200, { data: status() });
+});