Skip to Content
TensorPass

Web accounts, without the extension

A visitor without AI Wallet signs in with OpenRouter on any site, or with the TensorPass plan on a site that has a site key, in a popup the page opens. This page covers what works, where the credential lives, sign out and how a site turns it on.

A visitor who has not added AI Wallet can still use their own AI on your site. In any desktop or phone browser, the connect window offers the wallet's install button and two sign ins beside it:

  • Sign in with TensorPass answers with the visitor's TensorPass plan. The window shows it on a site that passes a site key.
  • Sign in with OpenRouter answers with the visitor's OpenRouter credits. It works on every site and needs no setting.

The site's chat, its tools and its guards run the same way on both paths: the modules, useAiChat, runConversation and client.fetch need no change.

What stays in the extension

The plan accounts (ChatGPT, Claude, Gemini, Grok and the others) answer through AI Wallet only. On 15 November 2026 the team tried each of them from a web page, and every one refused the page's requests at its sign in or at its chat, since their servers send no CORS headers to a site's origin. The extension calls them from its own background, where that check does not apply.

The sign in

  1. The visitor clicks Sign in with TensorPass or Sign in with OpenRouter in the connect window, or in a module's connection step.
  2. The page opens a popup on the provider's sign in page, with a PKCE challenge (S256) and a random state. A browser that blocks the popup gets the same page in the tab itself, which comes back to the site afterwards.
  3. The visitor signs in. On TensorPass, the consent step names your site's origin as the browser reports it, and the visitor authorizes it.
  4. The provider sends the popup back to your site's return page with a code. That page runs finishSignIn(): it hands the code to the page that opened the popup, by a message limited to that page's origin, by a BroadcastChannel named after the sign in's state and by a storage event, and closes itself. The second and third ways reach the page when a sign in page with a Cross-Origin-Opener-Policy, as a sign in with Google has, cut the popup from its opener. A popup the browser keeps open says the visitor can close it.
  5. The page trades the code and its PKCE verifier for the credential: a key on the visitor's credits from OpenRouter, or a plan token from TensorPass.

The connect window then says "Your OpenRouter account answers" or "Your TensorPass plan answers", and offers Sign out. A visitor who closes the popup gets the sign ins back when the page regains focus. A question asked while the sign in waits is kept and answered once the account is ready. A TensorPass account without a plan gets the plans in the chat with their monthly price, and a button for each that opens TensorPass's billing page in a new tab; the question is answered once the plan is active. The window shows the same in the five languages of the SDK: English, French, Hebrew, Arabic and simplified Chinese.

The SDK uses a web account only when it finds no wallet in the browser. A visitor who adds AI Wallet later answers through the wallet.

Where the credential lives

The credential stays in the browser, in the localStorage of your site's origin, under aiconnect:web-account. Each site the visitor signs in on keeps its own.

A site's scripts can read that storage, so your page, and any script it loads, can read a web account's credential. AI Wallet keeps credentials out of the page's reach: there, the site sends its chat to the extension and receives the answer, and the credential stays in the extension's vault. On a web account, the page calls the provider itself with the credential.

What a leaked credential allows differs by provider:

AccountCredentialWhat it allows
TensorPassA plan token of scope chat, valid 15 minutes, renewed with a refresh token that works onceChat answers only, and only from your site's origin, since TensorPass checks the Origin header of each call against the origin the token was issued to. It cannot read the visitor's email, billing or other sites. Its answers count against the visitor's own plan budget, as they do through the wallet.
OpenRouterA key OpenRouter issued on the visitor's creditsAny call the key's account allows, until the visitor deletes the key. The key stays listed on the visitor's keys page at https://openrouter.ai/settings/keys.

Load only scripts you trust on the pages that show the chat, and keep the guards on.

Sign out

Sign out in the connect window, or client.signOut() in your code, removes the credential from the site's storage. For TensorPass it also revokes the refresh token at the plan's gateway, so the sign in ends there too. OpenRouter offers no revocation to a web page: the key stops being used by the site and stays on the visitor's OpenRouter keys page, where the visitor deletes it.

Turn it on

OpenRouter is on for every site. The TensorPass sign in needs your site key, which you get in one step from your coding agent or the command line, as the site key page shows. Then pass it to the client:

import { AiConnect } from '@tensorpass/aiconnect';

const client = new AiConnect({ siteKey: process.env.NEXT_PUBLIC_TENSORPASS_SITE_KEY });
SetupWhere the key goes
Next.jsNEXT_PUBLIC_TENSORPASS_SITE_KEY in .env.local, read into new AiConnect({ siteKey })
ViteVITE_TENSORPASS_SITE_KEY in .env.local, read with import.meta.env.VITE_TENSORPASS_SITE_KEY
Web Componentssite-key on <aiconnect-chat> or <aiconnect-search>, or data-site-key on the elements script
WordPress pluginTensorPass site key, under Settings, AI Connect
Shopify app embedThe Site key setting in the theme editor

A site key is public, like a publishable key: it names your site and grants nothing by itself. It works on your domain and on http://localhost and http://127.0.0.1 at any port.

The return page

Give the sign ins a page of your site that does nothing else, so the popup does not load your whole site:

const client = new AiConnect({ siteKey, signInCallback: '/aiconnect/callback' });

In Next.js, the page is a route with a client component:

// app/aiconnect/callback/page.tsx renders <SignInReturn />, with robots set to noindex
'use client';
import { useEffect } from 'react';
import { finishSignIn } from '@tensorpass/aiconnect/callback';

export function SignInReturn() {
  useEffect(() => {
    finishSignIn();
  }, []);
  return null;
}

A site without a framework serves a static page with aiconnect-callback.js, the 2 KB script built beside the Web Components script:

<!doctype html>
<meta charset="utf-8">
<meta name="robots" content="noindex">
<title>Signing in</title>
<script src="/aiconnect-callback.js" defer></script>

The Web Components take the page as sign-in-callback on the element or data-sign-in-callback on their script tag. Without a return page, the sign in comes back to the page that started it, which finishes it as it loads. When the browser blocks the popup, the tab goes to the sign in itself, and the return page sends it back to the page it left.

Options of the client

OptionDefaultWhat it sets
siteKeyNoneYour site key. Without it the connect window offers OpenRouter only.
openRouterModelopenrouter/autoThe OpenRouter model of each answer. OpenRouter's Auto Router picks one for each prompt.
planLevelquickThe TensorPass level of each answer: quick, smart or expert. A plan that does not include the level answers with status 403.
planGatewayhttps://plan.tensorpass.appThe plan's gateway, for a test against a gateway of your own.
signInCallbackThe page itselfThe return page of the sign ins, a path or an address on your site's origin that runs finishSignIn().

client.webAccounts lists the sign ins the window offers: tensorpass with a site key, then openrouter. client.signIn(account) opens the popup and must run from the visitor's click, since browsers block a popup opened later. The client reference lists the states a sign in goes through.

On this page