The living Q&A encyclopedia. Every good AI conversation becomes a persistent, searchable article that the next person can find — and keep asking. Built on conversations with Claude, GPT-4o, and Gemini, in 15 languages.
Wikipedia can't answer your question — it requires expert editors and only covers what's already written. ChatGPT can answer, but the answer vanishes when the session ends. GPTwiki closes the loop: ask AI a question, get an article that persists, and let anyone pick up the conversation where you left off.
- Ask a question in any of 15 languages — the AI answers with citations
- Publish the conversation as a structured wiki article
- Grow — every article carries its conversation; anyone can ask a follow-up thread, and good follow-ups become part of the article
- Knowledge compounds over time instead of disappearing
- Multi-Model AI - Choose between Claude (Anthropic), GPT-4o (OpenAI), or Gemini 2.0 Flash (Google)
- Bring Your Own Key - Add your own API keys in your profile; they're encrypted at rest (AES-256-GCM)
- Optional Free Tier - Self-hosters can grant users free platform-keyed messages per day (
FREE_DAILY_MESSAGES, off by default) - Citations - AI-generated articles include a References section with supporting sources
- Conversation Threads - Every article carries its conversation; readers ask follow-ups that grow the article
- Wikipedia Attribution - Mirrored Wikipedia content carries CC BY-SA attribution and links to the original
- Conversation to Wiki - Publish AI conversations as structured, searchable wiki articles
- 15 Languages - Built-in i18n with auto browser detection: EN, ZH, JA, KO, ES, FR, DE, PT, RU, AR, HI, IT, TR, VI, TH
- 100K+ Articles - Pre-seeded with Wikipedia content across all supported languages
- Smart Search - Full-text search across all published wiki articles by keywords and tags
- Category Browse - Explore articles organized by topic: science, history, technology, arts, and more
- Contributor Leaderboard - Track top contributors and their impact
- OAuth Login - Sign in with Google or GitHub
- Open Source - MIT license, fully self-hostable
- PayPal Donations - Support the project directly
| Layer | Technology |
|---|---|
| Framework | Next.js 16 (App Router, TypeScript) |
| Styling | Tailwind CSS |
| Database | Google Cloud Firestore |
| Auth | NextAuth.js (Google + GitHub OAuth) |
| AI | Anthropic Claude, OpenAI GPT-4o, Google Gemini 2.0 Flash |
| Deployment | Google Cloud Run (Docker) |
| CI/CD | Google Cloud Build |
| Analytics | Google Analytics 4 |
| Payments | PayPal SDK v6 |
# Clone the repo
git clone https://github.com/oratis/GPTwiki.git
cd GPTwiki
# Install dependencies
npm install
# Configure environment variables
cp .env.example .env.local
# Edit .env.local with your API keys
# Run development server
npm run devOpen http://localhost:3000.
| Variable | Required | Description |
|---|---|---|
AUTH_SECRET |
Yes | NextAuth encryption secret (openssl rand -base64 32) |
AUTH_GOOGLE_ID |
Yes | Google OAuth Client ID |
AUTH_GOOGLE_SECRET |
Yes | Google OAuth Client Secret |
AUTH_GITHUB_ID |
Yes | GitHub OAuth Client ID |
AUTH_GITHUB_SECRET |
Yes | GitHub OAuth Client Secret |
FIREBASE_PROJECT_ID |
Yes | Google Cloud project ID |
FIREBASE_CLIENT_EMAIL |
Yes | Service account email |
FIREBASE_PRIVATE_KEY |
Yes | Service account private key |
ANTHROPIC_API_KEY |
Optional | Anthropic API key (Claude) |
OPENAI_API_KEY |
Optional | OpenAI API key (GPT-4o) |
GOOGLE_AI_API_KEY |
Optional | Google AI API key (Gemini) |
FREE_DAILY_MESSAGES |
Optional | Free platform-keyed messages per user per day (default 0 = BYOK-only) |
PLATFORM_OWNER_EMAIL |
Optional | Account exempt from the free-tier metering |
TYPESENSE_HOST / TYPESENSE_API_KEY |
Optional | Self-hosted Typesense search backend (see docs/typesense.md); falls back to Firestore keyword search when unset |
NEXT_PUBLIC_PAYPAL_CLIENT_ID |
Optional | PayPal Client ID for donations |
PAYPAL_CLIENT_SECRET |
Optional | PayPal Client Secret |
You only need API keys for the AI models you want to support. Users can also bring their own keys.
# Build and deploy via Cloud Build
gcloud builds submit --config cloudbuild.yaml
# Set environment variables
gcloud run services update gptwiki \
--region us-central1 \
--set-env-vars "AUTH_SECRET=xxx,ANTHROPIC_API_KEY=xxx,..."
# Map custom domain
gcloud beta run domain-mappings create \
--service gptwiki \
--domain your-domain.com \
--region us-central1docker build -t gptwiki .
docker run -p 3000:3000 --env-file .env.local gptwikisrc/
app/ # Next.js App Router pages
api/ # API routes (chat, wiki, search, seed, paypal)
browse/ # Category browsing page
chat/ # AI conversation page
donate/ # PayPal donation page
wiki/ # Wiki list and detail pages
login/ # OAuth login page
profile/ # User profile with API key management
components/
chat/ # Chat UI (messages, model selector, publish)
wiki/ # Wiki UI (cards, content, search, suggestions)
layout/ # Header, providers, language switcher, analytics
profile/ # API key management component
lib/
ai/ # Multi-model AI provider (Claude, GPT, Gemini)
i18n/ # 15-language internationalization system
auth.ts # NextAuth configuration
firebase.ts # Firestore client
search.ts # Search and CRUD operations
types/ # TypeScript type definitions
- Ask - User asks a question via the chat interface, choosing an AI model
- Generate - AI responds with a detailed answer in real-time (streaming)
- Discover - Existing wikis are suggested if similar content already exists
- Publish - User publishes the conversation as a wiki with auto-generated title, summary, and tags
- Grow - Future users find the article, continue the conversation, and enrich the content
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Built with Claude Code