{
  "markdown": "# AI Studio\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Built with Next.js](https://img.shields.io/badge/Built%20with-Next.js%2016-black)](https://nextjs.org/)\n[![Version](https://img.shields.io/badge/version-1.1.0-blue.svg)](https://github.com/psd401/aistudio/releases)\n\n> **Bring frontier AI to K-12 education—securely, affordably, and responsibly.**\n\nAI Studio is an open-source platform that provides K-12 educators and students with access to cutting-edge generative AI models at **90% lower cost** than individual licenses. Built with privacy-first architecture and deployed within district infrastructure, it democratizes access to AI tools that were previously cost-prohibitive for schools.\n\n## 🎬 See It In Action\n\n**Learn more**: [https://psd401.ai/aistudio](https://psd401.ai/aistudio)\n\nAI Studio is a **self-hosted platform** deployed within your district infrastructure for security and compliance. Screenshots and feature overview available on our project page.\n\n**Ready to deploy?** See the complete [Deployment Guide](./docs/DEPLOYMENT.md)\n\n## 🎯 Why AI Studio?\n\n### The Problem\n- **Cost Barriers**: Individual AI subscriptions cost $20-200/month per user—unsustainable for districts\n- **Access Inequality**: Students lack exposure to frontier models used in higher education and industry\n- **Data Privacy**: Third-party AI services raise concerns about student data protection\n- **Content Safety**: Consumer AI tools lack appropriate safeguards for K-12 environments\n- **Complexity**: Creating custom AI assistants requires coding expertise\n\n### The Solution\nAI Studio eliminates these barriers by:\n- **90% Cost Reduction**: Secure API architecture replaces expensive per-seat licenses\n- **Multi-Model Access**: Real-time switching between GPT-5, Claude Opus, and Google Gemini\n- **District-Level Security**: All data processed within your secure servers—nothing leaves your environment\n- **K-12 Content Safety**: Automatic content filtering and PII protection across all AI interactions\n- **No-Code Customization**: Design custom AI assistants using visual prompt chains\n- **Open Source**: MIT-licensed, fully self-hostable on your infrastructure\n\n## ✨ Key Features\n\n### For Educators & Students\n\n- 🤖 **Nexus Chat** - Conversational AI with multiple frontier models\n  - Real-time streaming responses\n  - Conversation history and organization\n  - Model comparison side-by-side\n\n- 🏗️ **Assistant Architect** - No-code custom AI assistant builder\n  - Visual prompt chain designer\n  - Variable substitution between prompts\n  - Knowledge repository integration\n\n- 📚 **Knowledge Repositories** - Upload and search documents\n  - PDF, DOCX, TXT support with OCR\n  - Vector embeddings for semantic search\n  - Context-aware AI responses\n\n- 📊 **Model Compare** - Side-by-side model evaluation\n  - Compare GPT-5, Claude Opus, Gemini responses\n  - Token usage and cost analysis\n  - Performance metrics\n\n### For Administrators\n\n- 🔒 **Enterprise Security**\n  - AWS Cognito authentication with Google SSO\n  - Role-based access control (RBAC)\n  - Tool-level permissions\n  - Audit logging\n\n- 🛡️ **K-12 Content Safety** - Purpose-built for educational environments\n  - **Content Filtering**: Blocks inappropriate content (violence, hate speech, sexual content) in both inputs and AI responses using Amazon Bedrock Guardrails\n  - **PII Protection**: Keeps ordinary inference byte-identical under provider zero-data-retention agreements, with detect-only refusal for Nexus memory and telemetry for published agent content\n  - **Compliance Ready**: Helps meet COPPA, FERPA, and CIPA requirements\n  - **Real-time Alerts**: SNS notifications for safety violations\n  - **Zero Configuration**: Works automatically across all AI providers\n  - See [K-12 Content Safety Documentation](./docs/features/k12-content-safety.md) for details\n\n- 💰 **Cost Control**\n  - Transparent usage tracking\n  - Per-user quotas and rate limiting\n  - Provider cost comparison\n  - Auto-pause dev environments\n\n- 📈 **Monitoring & Observability**\n  - CloudWatch dashboards\n  - OpenTelemetry tracing\n  - Circuit breaker for AI provider failures\n  - Performance metrics\n\n### Integration Platform\n\n- 🔌 **API v1** - REST API for external integrations\n  - Authenticated endpoints for assistants, decisions, and chat\n  - API key management (`sk-` prefix tokens)\n  - Rate limiting (60 req/min default)\n  - OpenAPI specification at `docs/API/v1/openapi.yaml`\n\n- 🔐 **OAuth2/OIDC Provider** - JWT-based auth for external apps\n  - Authorization Code Flow with PKCE\n  - Access tokens (15min), refresh tokens (24hr), ID tokens\n  - Granular scopes for API, MCP, and OIDC\n  - Admin UI for client registration at `/admin/oauth-clients`\n\n- 🤖 **MCP Server** - Model Context Protocol for AI tool integrations\n  - 5 tools: search decisions, capture decisions, list assistants, execute assistants, get context\n  - Works with Claude Code, Cursor, and custom MCP clients\n  - Authenticated via API key or OAuth token\n\n- 🧭 **Decision Framework** - Structured decision capture & graph\n  - Capture decisions with context, alternatives, and outcomes\n  - Graph-based decision relationships\n  - Search and retrieve past decisions for organizational knowledge\n\n## 🏗️ Architecture\n\nBuilt on AWS with production-ready infrastructure:\n\n- **Frontend**: Next.js 16 (App Router) with React 19 Server Components\n- **Backend**: ECS Fargate containers with Application Load Balancer\n- **Database**: Aurora Serverless v2 (PostgreSQL) with Drizzle ORM and postgres.js driver\n- **Authentication**: AWS Cognito + NextAuth v5\n- **AI Providers**: OpenAI (GPT-5), Anthropic (Claude), Google (Gemini), AWS Bedrock via AI SDK v6\n- **Infrastructure**: AWS CDK (TypeScript) following Well-Architected Framework\n- **Streaming**: Server-Sent Events (SSE) over HTTP/2 for real-time responses\n\nSee [Architecture Diagrams](./docs/diagrams/README.md) for detailed visualizations.\n\n## 🚀 Quick Start\n\n### Prerequisites\n\n- Node.js 20.x and npm\n- AWS CLI configured with appropriate credentials\n- AWS CDK CLI (`npm install -g aws-cdk`)\n- Docker installed (for building container images)\n\n### Local Development\n\n```bash\n# Clone repository\ngit clone https://github.com/psd401/aistudio.git\ncd aistudio\n\n# Install dependencies\nnpm install\n\n# Copy environment variables\ncp .env.example .env.local\n# Edit .env.local with your configuration\n\n# Start local PostgreSQL and dev server\nnpm run db:up              # Start PostgreSQL via Docker\nnpm run db:seed            # Create test users (first time)\nnpm run dev:local          # Start Next.js with local database\n```\n\nOpen [http://localhost:3000](http://localhost:3000) to see the application.\n\n### Deployment to AWS\n\n```bash\n# Bootstrap CDK (one-time)\ncd infra\nbunx cdk bootstrap aws://ACCOUNT-ID/REGION\n\n# Deploy infrastructure stacks\nbunx cdk deploy AIStudio-DatabaseStack-Dev\nbunx cdk deploy AIStudio-AuthStack-Dev\nbunx cdk deploy AIStudio-StorageStack-Dev\nbunx cdk deploy AIStudio-DocumentProcessingStack-Dev\nbunx cdk deploy AIStudio-GuardrailsStack-Dev\nbunx cdk deploy AIStudio-FrontendStack-Dev\n\n# Or deploy all at once\nbunx cdk deploy --all\n```\n\nSee [Deployment Guide](./docs/DEPLOYMENT.md) for detailed instructions.\n\n## 📊 Cost Comparison\n\n### Traditional Approach (Per-Seat Licenses)\n```\n100 users × $20/month (ChatGPT Plus) = $2,000/month = $24,000/year\n```\n\n### AI Studio (API-Based)\n```\n100 users × average 50,000 tokens/day\n= 1.5M tokens/day × 30 days = 45M tokens/month\n= $450/month (GPT-5) + $200 infrastructure = $650/month = $7,800/year\n\nSavings: $16,200/year (67% reduction)\n```\n\nWith mixed usage (Gemini + GPT-4 mini), costs drop to ~$200/month (**90% savings**).\n\n## 🛠️ Tech Stack\n\n### Frontend\n- Next.js 16 with App Router\n- React 19 with Server Components\n- Shadcn UI component library\n- Tailwind CSS for styling\n- Vercel AI SDK v6 for streaming\n\n### Backend\n- ECS Fargate for container hosting\n- Aurora Serverless v2 (PostgreSQL)\n- Drizzle ORM with postgres.js driver\n- AWS Lambda for async processing\n- S3 for document storage\n- AWS Textract for OCR\n\n### Infrastructure\n- AWS CDK for Infrastructure as Code\n- VPC with multi-AZ subnets\n- Application Load Balancer with HTTP/2\n- CloudWatch + ADOT for observability\n- Secrets Manager for credentials\n- Cognito for authentication\n\n## 📚 Documentation\n\n### Core Documentation\n- [Architecture Overview](./docs/ARCHITECTURE.md) - Complete system architecture\n- [Deployment Guide](./docs/DEPLOYMENT.md) - Step-by-step deployment\n- [API Reference](./docs/API_REFERENCE.md) - REST endpoints and server actions\n- [Error Reference](./docs/ERROR_REFERENCE.md) - Error codes and debugging\n- [Troubleshooting](./docs/TROUBLESHOOTING.md) - Common issues and solutions\n\n### Infrastructure\n- [CDK Infrastructure](./infra/README.md) - AWS CDK stack details\n- [VPC Network Topology](./docs/diagrams/02-vpc-network-topology.md)\n- [AWS Service Architecture](./docs/diagrams/03-aws-service-architecture.md)\n\n### Visual Architecture\n- [All Diagrams (9 total)](./docs/diagrams/README.md) - 10,000+ lines of visual documentation\n- [Database ERD](./docs/diagrams/04-database-erd.md) - 54 PostgreSQL tables\n- [Authentication Flow](./docs/diagrams/05-authentication-flow.md) - OAuth 2.0 flow\n- [Streaming Architecture](./docs/diagrams/09-streaming-architecture.md) - SSE implementation\n\n### Integration\n- [API v1 Quickstart](./docs/guides/api-quickstart.md) - Getting started with the REST API\n- [OAuth2 Integration](./docs/guides/oauth-integration.md) - Authenticating external apps\n- [MCP Integration](./docs/guides/mcp-integration.md) - Connecting AI tools via MCP\n\n### Development\n- [Developer Guide](./DEVELOPER_GUIDE.md) - Development setup and workflow\n- [Library Documentation](./lib/README.md) - Core utilities and patterns\n- [CLAUDE.md](./CLAUDE.md) - AI assistant development guidelines\n\n## 🧪 Testing\n\n```bash\n# Run test suite\nnpm test\n\n# Run tests in watch mode\nnpm run test:watch\n\n# Run linting\nnpm run lint\n\n# Run type checking\nnpm run typecheck\n```\n\n## 🤝 Contributing\n\nWe welcome contributions! Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.\n\n## 📄 License\n\nMIT License - see [LICENSE](./LICENSE) file for details.\n\n## 🙏 Acknowledgments\n\nAI Studio was developed by Peninsula School District (PSD401) to bring world-class AI tools to K-12 education. Built with:\n\n- [Next.js](https://nextjs.org/) - React framework\n- [Vercel AI SDK](https://sdk.vercel.ai/) - AI streaming infrastructure\n- [AWS CDK](https://aws.amazon.com/cdk/) - Infrastructure as Code\n- [Shadcn UI](https://ui.shadcn.com/) - UI component library\n\n## 🔗 Links\n\n- **Website**: [psd401.ai/aistudio](https://psd401.ai/aistudio)\n- **Documentation**: [docs/](./docs/)\n- **Issues**: [GitHub Issues](https://github.com/psd401/aistudio/issues)\n- **Discussions**: [GitHub Discussions](https://github.com/psd401/aistudio/discussions)\n\n---\n\n**Built with ❤️ for K-12 education**\n\n*Making frontier AI accessible, secure, and affordable for every student.*\n",
  "bytes": 11020,
  "sha": "3ef51d6a4aec6b89bed3cd511a1f70fa9849d294ab1c7935d9502118bdf1e11a",
  "repo_slug": "psd401/aistudio",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/okf_psd401_aistudio_openwiki_index_md_8873adae/readme"
}