Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
T

twitter

> 编程语言
Open source

AI Agent for Twitter Personality Analysis

1.4K stars0 likes0 views
WebsiteGitHub

About

AI Agent for Twitter Personality Analysis

Twitter Personality

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.

How it works

  1. Enter a Twitter/X username (or two, for a compatibility check).
  2. The profile and ~15 recent posts are fetched via the official X API v2 (SocialData as fallback) and cached in Neon Postgres.
  3. 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.
  4. The result is cached, shareable, and rendered into dynamic OG images.

Setting up the project ️

  1. Clone the repository and run npm install.
  2. Environment variables: create .env.local based 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 (see src/lib/config.tsx).
  3. Run: npm run dev.

Architecture notes

  • 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.ts documents the shapes, which mirror the cached JSONB analyses key-for-key, so do not change keys casually.
  • Streaming contract: /api/analysis and /api/analysis/pair stream raw JSON text; the client renders partial JSON as it arrives (src/lib/parse-partial-json.ts).
  • Caching/dedupe: users/pairs rows 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 in public/brand/.

Deployed on Vercel.

GitHub Issues· 9 open

View all on GitHub
  • #31

    A viral AI-powered Twitter/X personality profiler and savage roast generator built with Python, Streamlit, and DeepSeek.

    Updated May 31, 2026
  • #29

    where is prompt of twitter personality please

    Updated Mar 12, 2025
  • #27

    :warning: Missing license file

    Updated Nov 25, 2024
  • #24

    how to retrieve tweets via x api?

    Updated Nov 15, 2024
  • #21

    Wordware AI only generates once

    Updated Oct 1, 2024
  • #20

    please make it possible to regenerate analysis

    Updated Sep 16, 2024
  • #18

    could you please tell me where is prompt of twitter personality

    Updated Aug 15, 2024
  • #13

    [feature request] make it possible for people to opt-out

    Updated Aug 12, 2024

Highlights

  • •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 (see src/lib/config.tsx).
  • •Streaming contract: /api/analysis and /api/analysis/pair stream raw JSON text; the client renders partial JSON as it arrives (src/lib/parse-partial-json.ts).
  • •Caching/dedupe: users/pairs rows carry status flags (wordware* columns — historical names kept for data compatibility) with staleness windows to dedupe concurrent generations.

> Tags

TypeScript

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言