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.

18.2 KB
Raw Blame
<!DOCTYPE html>
<html lang="en">
<head>
	<script>/* three.ws theme boot — no-flash; runtime in /theme-switcher.js */(function(){try{var m=localStorage.getItem('twx_theme');var l=m==='auto'?(window.matchMedia&&window.matchMedia('(prefers-color-scheme: light)').matches):m==='light';document.documentElement.setAttribute('data-theme',l?'light':'dark');}catch(e){document.documentElement.setAttribute('data-theme','dark');}})();</script>
	<meta charset="UTF-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<title data-i18n="tutor.meta_title">Pay-As-You-Learn Tutor — three.ws</title>
	<meta name="description" content="Ask anything and pay a cent per answer. A pay-as-you-learn AI tutor settled in USDC over x402 on Base or Solana."  data-i18n-attr="content:tutor.meta_description"/>
	<link rel="icon" href="/favicon.ico" />
	<link rel="stylesheet" href="/nav.css" />
	<style>
		:root {
			--bg: #0d0d0d;
			--surface: #141414;
			--surface-2: #1a1a1a;
			--border: #282828;
			--text: #e7e9f2;
			--text-dim: #99a0b8;
			--text-faint: #6a7088;
			--accent: #7c5cff;
			--accent-2: #38e0c8;
			--user: #272727;
			--ok: #38d39f;
			--radius: 14px;
			--shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
			--font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, Helvetica, Arial, sans-serif;
			--mono: 'SF Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
		}
		* { box-sizing: border-box; }
		html, body { height: 100%; }
		body {
			margin: 0;
			font-family: var(--font);
			background: radial-gradient(1200px 600px at 80% -10%, rgba(124, 92, 255, 0.12), transparent 60%), var(--bg);
			color: var(--text);
			-webkit-font-smoothing: antialiased;
			display: flex;
			flex-direction: column;
			min-height: 100vh;
			min-height: 100dvh;
		}
		a { color: var(--accent-2); }

		header.top {
			display: flex; align-items: center; gap: 14px;
			padding: 12px 22px; border-bottom: 1px solid var(--border);
			position: sticky; top: 57px; backdrop-filter: blur(8px);
			background: rgba(11, 13, 20, 0.7); z-index: 9;
		}
		/* The page heading lives in the sticky bar so it survives the empty state
		   being replaced by the thread; the empty state's own heading is an h2. */
		h1.top-title { font-weight: 600; font-size: 14px; letter-spacing: -0.01em; color: var(--text-dim); margin: 0; }
		.spacer { flex: 1; }

		/* Keyboard users get the same affordance mouse users get from :hover. */
		:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
		.btn:focus-visible, .suggestion:focus-visible,
		.notice-retry:focus-visible, .followup button:focus-visible { border-color: var(--accent); }
		/* select#level and textarea#q clear the UA outline, and those id+element
		   selectors outrank the bare :focus-visible rule above, so they restate it. */
		select#level:focus-visible, textarea#q:focus-visible {
			outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--accent);
		}

		.tab {
			display: flex; align-items: center; gap: 10px;
			background: var(--surface-2); border: 1px solid var(--border);
			border-radius: 999px; padding: 7px 14px; font-size: 13px;
		}
		.tab .label { color: var(--text-dim); }
		.tab .amount { font-family: var(--mono); font-weight: 700; color: var(--accent-2); }
		.tab .count { color: var(--text-faint); }

		.btn {
			border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
			border-radius: 10px; padding: 9px 14px; font-size: 13px; font-weight: 600;
			cursor: pointer; transition: border-color var(--duration-fast), background var(--duration-fast), transform var(--duration-instant);
		}
		.btn:hover:not(:disabled) { border-color: var(--accent); }
		.btn:active:not(:disabled) { transform: translateY(1px); }
		.btn:disabled { opacity: .45; cursor: not-allowed; }
		.btn.primary { background: linear-gradient(135deg, var(--accent), #6a4cff); border-color: transparent; }
		.btn.ghost { background: transparent; }

		main {
			flex: 1; width: 100%; max-width: 820px; margin: 0 auto;
			display: flex; flex-direction: column; padding: 0 18px;
		}
		.thread { flex: 1; display: flex; flex-direction: column; gap: 16px; padding: 26px 0 18px; }

		.empty {
			margin: auto; text-align: center; max-width: 520px; padding: 40px 0;
		}
		.empty h2 { font-size: 30px; letter-spacing: -0.02em; margin: 0 0 10px; font-weight: 600; }
		.empty p { color: var(--text-dim); line-height: 1.6; margin: 0 0 26px; }
		.suggestions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
		.suggestion {
			text-align: left; background: var(--surface); border: 1px solid var(--border);
			border-radius: 12px; padding: 14px 16px; cursor: pointer; color: var(--text-dim);
			font-size: 13.5px; line-height: 1.45; transition: border-color var(--duration-fast), color var(--duration-fast), transform var(--duration-instant);
		}
		.suggestion:hover { border-color: var(--accent); color: var(--text); }
		.suggestion:active { transform: translateY(1px); }

		.msg { display: flex; flex-direction: column; gap: 6px; animation: rise .25s ease both; }
		@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
		.msg .who { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); }
		.bubble {
			border-radius: var(--radius); padding: 14px 16px; line-height: 1.6; font-size: 15px;
			border: 1px solid var(--border); white-space: pre-wrap; word-wrap: break-word;
		}
		.msg.user { align-items: flex-end; }
		.msg.user .bubble { background: var(--user); border-color: #363636; max-width: 86%; }
		.msg.tutor .bubble { background: var(--surface); }
		.msg.error .bubble { background: #2a1620; border-color: #5a2a3a; color: #ffb4c4; }
		.msg.notice .bubble { background: #1c1a26; border-color: #3a3550; color: var(--text-dim); }
		/* Answer-pending skeleton: an LLM explanation takes seconds, so the thread
		   shows the shape of the reply that is coming instead of an empty gap. */
		.msg.pending .bubble { background: var(--surface); }
		.sk { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 25%, #232330 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: sheen 1.4s ease infinite; }
		.sk + .sk { margin-top: 10px; }
		.sk.w80 { width: 80%; }
		.sk.w60 { width: 60%; }
		@keyframes sheen { from { background-position: 100% 50%; } to { background-position: 0 50%; } }
		@media (prefers-reduced-motion: reduce) {
			.sk { animation: none; }
			.msg { animation: none; }
		}

		.notice-retry {
			display: inline-block; margin-top: 10px; background: transparent; color: var(--accent-2);
			border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; font: inherit;
			font-size: 13px; font-weight: 600; cursor: pointer; transition: border-color var(--duration-fast), color var(--duration-fast);
		}
		.notice-retry:hover { border-color: var(--accent); color: var(--text); }

		.kp { margin: 12px 0 0; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
		.kp h4 { margin: 0 0 8px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); }
		.kp ul { margin: 0; padding-left: 18px; color: var(--text-dim); }
		.kp li { margin: 3px 0; }
		.ex { margin-top: 12px; }
		.ex pre {
			margin: 0; background: #0c0c0c; border: 1px solid var(--border); border-radius: 10px;
			padding: 13px 14px; overflow-x: auto; font-family: var(--mono); font-size: 13px; color: #cdd3e6;
		}
		.followup { margin-top: 10px; font-size: 13px; color: var(--text-faint); }
		.followup button {
			background: none; border: none; color: var(--accent-2); cursor: pointer; padding: 0; font: inherit;
			text-decoration: underline; text-underline-offset: 2px;
		}
		.meta { display: flex; gap: 12px; align-items: center; font-size: 11.5px; color: var(--text-faint); }
		.meta .cost { font-family: var(--mono); color: var(--accent-2); }
		.pill { padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }

		form.composer {
			position: sticky; bottom: 0; padding: 14px 0 22px;
			background: linear-gradient(transparent, var(--bg) 22%);
			/* On mobile, the soft keyboard can overlay a sticky bottom bar without
			   shrinking the layout viewport. --kb-offset (set from the VisualViewport
			   API in tutor.js) lifts the composer above the keyboard when focused. */
			transform: translateY(calc(-1 * var(--kb-offset, 0px)));
			transition: transform var(--duration-fast) var(--ease-standard);
			padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
			will-change: transform;
		}
		.composer-inner {
			display: flex; gap: 10px; align-items: flex-end;
			background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
			padding: 10px 10px 10px 14px; box-shadow: var(--shadow);
		}
		.composer-inner:focus-within { border-color: var(--accent); }
		textarea#q {
			flex: 1; resize: none; border: none; outline: none; background: transparent; color: var(--text);
			font: inherit; font-size: 15px; line-height: 1.5; max-height: 180px; padding: 6px 0;
		}
		.controls { display: flex; align-items: center; gap: 8px; }
		.q-count { font-family: var(--mono); font-size: 11px; color: var(--text-faint); min-width: 62px; text-align: right; font-variant-numeric: tabular-nums; transition: color var(--duration-fast); }
		.q-count.warn { color: #f1c21b; }
		.q-count.max { color: #fa4d56; }
		select#level {
			background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--border);
			border-radius: 9px; padding: 8px 10px; font-size: 12.5px; outline: none;
		}
		.send { width: 42px; height: 42px; padding: 0; display: grid; place-items: center; border-radius: 10px; }
		.send svg { width: 18px; height: 18px; }
		.price-note { text-align: center; font-size: 11.5px; color: var(--text-faint); margin: 9px 0 0; }
		.spin { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
		@keyframes spin { to { transform: rotate(360deg); } }

		/* Invoice modal */
		.scrim { position: fixed; inset: 0; background: rgba(4, 5, 9, .66); display: none; place-items: center; padding: 20px; z-index: 50; backdrop-filter: blur(3px); }
		.scrim.open { display: grid; }
		.invoice { width: 100%; max-width: 520px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
		.invoice header { display: flex; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--border); }
		.invoice header h3 { margin: 0; font-size: 16px; }
		.invoice .body { padding: 6px 20px 16px; max-height: 50vh; overflow-y: auto; }
		.line { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
		.line .n { color: var(--text-faint); width: 22px; flex: none; }
		.line .q { flex: 1; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; }
		.line .c { font-family: var(--mono); color: var(--accent-2); flex: none; }
		.invoice .total { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-top: 1px solid var(--border); font-weight: 700; }
		.invoice .total .amt { font-family: var(--mono); color: var(--accent-2); font-size: 18px; }
		.attest { font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); word-break: break-all; padding: 0 20px 16px; }

		@media (max-width: 560px) {
			.suggestions { grid-template-columns: 1fr; }
			.tab .label { display: none; }
			header.top { padding: 14px 16px; }
		}
	</style>

	<link rel="canonical" href="https://three.ws/tutor">
	<meta property="og:type" content="website">
	<meta property="og:site_name" content="three.ws">
	<meta property="og:title" content="Pay-As-You-Learn Tutor · three.ws" data-i18n-attr="content:tutor.meta_og_title">
	<meta property="og:description" content="Ask anything and pay a cent per answer. A pay-as-you-learn AI tutor that bills $0.01 per explanation in USDC over x402, with a live itemized session invoice and signed attestation." data-i18n-attr="content:tutor.meta_og_description">
	<meta property="og:url" content="https://three.ws/tutor">
	<meta property="og:image" content="https://three.ws/api/page-og?s=crypto&amp;t=Pay-As-You-Learn+Tutor&amp;d=Ask+anything+and+pay+a+cent+per+answer.+A+pay-as-you-learn+AI+tutor+that+bills+%240.01+per+explanation+in+USDC+over+x402%2C+with+a+live+itemized+session+invoice&amp;p=%2Ftutor">
	<meta property="og:image:width" content="1200">
	<meta property="og:image:height" content="630">
	<meta name="twitter:card" content="summary_large_image">
	<meta name="twitter:title" content="Pay-As-You-Learn Tutor · three.ws" data-i18n-attr="content:tutor.meta_twitter_title">
	<meta name="twitter:description" content="Ask anything and pay a cent per answer. A pay-as-you-learn AI tutor that bills $0.01 per explanation in USDC over x402, with a live itemized session invoice and signed attestation." data-i18n-attr="content:tutor.meta_twitter_description">
	<meta name="twitter:image" content="https://three.ws/api/page-og?s=crypto&amp;t=Pay-As-You-Learn+Tutor&amp;d=Ask+anything+and+pay+a+cent+per+answer.+A+pay-as-you-learn+AI+tutor+that+bills+%240.01+per+explanation+in+USDC+over+x402%2C+with+a+live+itemized+session+invoice&amp;p=%2Ftutor">
	<script type="application/ld+json">{"@context":"https://schema.org","@type":"WebPage","name":"Pay-As-You-Learn Tutor","description":"Ask anything and pay a cent per answer. A pay-as-you-learn AI tutor that bills $0.01 per explanation in USDC over x402, with a live itemized session invoice and signed attestation.","url":"https://three.ws/tutor","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"}}</script>

	<meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1">
	<meta property="og:locale" content="en_US">
	<meta property="og:image:alt" content="Pay-As-You-Learn Tutor — three.ws">
	<meta name="twitter:site" content="@trythreews">
</head>
<body>
	<div id="nav-container"></div>
	<script src="/nav.js"></script>
	<header class="top">
		<h1 class="top-title" data-i18n="tutor.tutor">Tutor</h1>
		<div class="spacer"></div>
		<div class="tab" title="Running session total">
			<span class="label" data-i18n="tutor.session">Session</span>
			<span class="amount" id="tab-amount">$0.00</span>
			<!-- The live answer count is data, not copy: tutor.js owns the text and
			     reads its singular/plural template from these translated attributes,
			     so the i18n pass can never overwrite the running count with "0". -->
			<span
				class="count"
				id="tab-count"
				data-count-one="{n} answer"
				data-count-other="{n} answers"
				data-i18n-attr="data-count-one:tutor.count_one;data-count-other:tutor.count_other"
			>0 answers</span>
		</div>
		<button class="btn ghost" type="button" id="end-btn" disabled data-i18n="tutor.end_invoice">End &amp; invoice</button>
	</header>

	<main>
		<div class="thread" id="thread">
			<div class="empty" id="empty">
				<h2 data-i18n="tutor.pay_as_you_learn">Pay-as-you-learn.</h2>
				<p data-i18n-html="tutor.ask_anything_code_concepts_math_history_each">Ask anything — code, concepts, math, history. Each answer costs <strong>one cent</strong>, settled in USDC over x402 on Base or Solana. No subscription, no signup. You only pay for what you learn.</p>
				<div class="suggestions" id="suggestions">
					<button class="suggestion" type="button" data-i18n="tutor.explain_how_a_jwt_is_verified_step">Explain how a JWT is verified, step by step.</button>
					<button class="suggestion" type="button" data-i18n="tutor.why_does_my_recursive_function_overflow_the">Why does my recursive function overflow the stack?</button>
					<button class="suggestion" type="button" data-i18n="tutor.what_is_the_difference_between_tcp_and">What is the difference between TCP and UDP?</button>
					<button class="suggestion" type="button" data-i18n="tutor.walk_me_through_how_a_transformer_attention">Walk me through how a transformer attention head works.</button>
				</div>
			</div>
		</div>

		<form class="composer" id="composer" autocomplete="off">
			<div class="composer-inner">
				<textarea id="q" rows="1" maxlength="2000" placeholder="Ask your question…" aria-label="Your question" aria-describedby="q-count"></textarea>
				<div class="controls">
					<span class="q-count" id="q-count" aria-live="polite" aria-label="Characters used" data-i18n-attr="aria-label:tutor.characters_used_arialabel">0 / 2000</span>
					<select id="level" aria-label="Expertise level" title="Target expertise level">
						<option value="beginner" data-i18n="tutor.beginner">Beginner</option>
						<option value="intermediate" selected data-i18n="tutor.intermediate">Intermediate</option>
						<option value="expert" data-i18n="tutor.expert">Expert</option>
					</select>
					<button class="btn primary send" id="send" type="submit" aria-label="Send (pay $0.01)" title="Send · $0.01" data-i18n-attr="aria-label:tutor.send_pay_0_01_arialabel;title:tutor.send_0_01_title">
						<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="22" y1="2" x2="11" y2="13"></line><polygon points="22 2 15 22 11 13 2 9 22 2"></polygon></svg>
					</button>
				</div>
			</div>
			<p class="price-note" data-i18n-html="tutor.0_01_per_answer_paid_in_usdc">$0.01 per answer · paid in USDC via x402 · <span id="conn-note">connect a wallet when you send your first question</span></p>
		</form>
	</main>

	<div class="scrim" id="scrim">
		<div class="invoice" role="dialog" aria-modal="true" aria-label="Session invoice">
			<header><h3 data-i18n="tutor.session_invoice">Session invoice</h3><div class="spacer" style="flex:1"></div><button class="btn ghost" type="button" id="invoice-close" data-i18n="tutor.close">Close</button></header>
			<div class="body" id="invoice-lines"></div>
			<div class="total"><span data-i18n="tutor.total">Total</span><span class="amt" id="invoice-total">$0.00</span></div>
			<div class="attest" id="invoice-attest"></div>
		</div>
	</div>

	<script type="module" src="/x402.js"></script>
	<script type="module" src="/tutor.js"></script>
	<script src="/brand.js" defer></script>
	<!-- Runtime i18n: detects locale, swaps annotated copy, mounts <lang-switcher>. -->
	<script type="module" src="/i18n.js"></script>
</body>
</html>