Twitter Personality is a web application that analyzes your Twitter/X handle to create a personalized personality profile using an AI agent — built by the team behind Sauna, your AI coworker.
The site went viral in 2024. This is the relaunched version: official X API for data, Vercel AI SDK + AI Gateway for generation (model swappable via one env var), Next.js 15, and Sauna branding. All previously generated analyses remain cached in the database and keep rendering.
- Enter a Twitter/X username (or two, for a compatibility check).
- The profile and ~15 recent posts are fetched via the official X API v2 (SocialData as fallback) and cached in Neon Postgres.
- An LLM (default
xai/grok-4.20-non-reasoning, via the Vercel AI Gateway) streams a structured analysis — roast, strengths, love life, spirit animal, pickup lines and more — straight into the page. - The result is cached, shareable, and rendered into dynamic OG images.
- Clone the repository and run
npm install. - Environment variables: create
.env.localbased on.env.example:DATABASE_URL: Neon Postgres connection string.AI_GATEWAY_API_KEY: Vercel AI Gateway key (omit on Vercel — OIDC is automatic).AI_MODEL(optional): any Gateway model string, e.g.xai/grok-4.20-non-reasoning,zai/glm-5.2,openai/gpt-5.2. Swapping models is just changing this var.X_API_BEARER_TOKEN: official X API v2 bearer token (pay-per-use; buy credits in the X developer console).SOCIALDATA_API_KEY: fallback scraper.NEXT_PUBLIC_BASE_URL: base URL of the deployment — share links derive from it.NEXT_PUBLIC_POSTHOG_KEY,NEXT_PUBLIC_POSTHOG_HOST: analytics (optional).STRIPE_*: paywall plumbing — the paywall is off by default (seesrc/lib/config.tsx).
- Run:
npm run dev.
- Prompts live in
src/lib/prompts.ts(the original viral prompts, ported from Wordware). Prompts enumerate the exact output keys (structured-output mode is deliberately avoided — constrained decoding flattens the voice);src/lib/schemas.tsdocuments the shapes, which mirror the cached JSONB analyses key-for-key, so do not change keys casually. - Streaming contract:
/api/analysisand/api/analysis/pairstream raw JSON text; the client renders partial JSON as it arrives (src/lib/parse-partial-json.ts). - Caching/dedupe:
users/pairsrows carry status flags (wordware*columns — historical names kept for data compatibility) with staleness windows to dedupe concurrent generations. - Brand: Sauna tokens are defined in
tailwind.config.ts+src/app/globals.css; official logo SVGs inpublic/brand/.
Deployed on Vercel.