Calculate and compare costs across all major AI providers
Input Tokens
Approximate count
๐ก Tip: 100 tokens โ 75 words
Customer Support Agent
๐ค AI Agents
You are a customer support agent for an e-commerce platform. Analyze this customer message and: 1. Categorize it (billing, technical, general, complaint) 2. Determine urgency (low, medium, high, critical) 3. Suggest a response template 4. Recommend if human escalation is needed Customer message: "I've been charged twice this month for my subscription. This is the third time this has happened. I want a full refund and to cancel my account immediately!"
Multi-Step Research Agent
You are a research agent. Task: Research "What are the latest advancements in quantum computing for drug discovery?" Break this down into: 1. 3-4 sub-questions to research 2. Recommended databases/sources for each 3. Search query keywords 4. How to synthesize findings 5. Expected timeline for each step Provide a structured research plan in JSON format.
Code Review Agent
You are a senior code reviewer. Review this pull request and provide: 1. Security vulnerabilities 2. Performance issues 3. Code quality concerns 4. Best practice violations 5. Suggested improvements ```python def process_user_data(data): results = [] for item in data: user = db.query("SELECT * FROM users WHERE id = " + str(item['user_id'])) if user: results.append(user) return results ``` Provide detailed feedback with severity levels and code fixes.
Document QA with Context
๐ RAG Systems
You are a document QA assistant. Use these context documents to answer the question. Context: [Doc 1] Return Policy: Items returnable within 30 days with receipt. Refunds in 5-7 business days. Electronics have 15-day return window. [Doc 2] Shipping: Free shipping over $50. Standard 3-5 days, Express 1-2 days. International available. [Doc 3] Warranty: 1-year manufacturer warranty. Extended warranty available for purchase at checkout. Question: "I bought a laptop 2 weeks ago and it's defective. Can I return it? How long until I get my money back? Will I have to pay for return shipping if my order was $75?" Provide detailed answer citing specific documents. If information is missing, clearly state that.
Semantic Search Query Generation
Given this user question, generate optimal search queries for a vector database: User question: "How do I troubleshoot my printer not connecting to WiFi?" Generate: 1. 3 semantic search queries (for embedding search) 2. 2 keyword queries (for traditional search) 3. Expected document types to prioritize 4. Filters to apply (product model, date, etc.) Format as JSON with reasoning for each query.
REST API with Authentication
๐จโ๐ป Code Generation
Create a production-ready REST API endpoint in Node.js/Express for user registration with: Requirements: - Input validation (email, password strength) - Password hashing (bcrypt) - JWT token generation - Rate limiting (5 attempts per IP per hour) - Error handling with proper HTTP codes - SQL injection prevention - Email verification flow - Logging Include complete code with comments, error handling, and unit test examples using Jest.
React Component with Hooks
Create a production-ready React component for an infinite scroll feed with: Features: - Fetch data from API endpoint - Virtual scrolling for performance - Loading states (skeleton screens) - Error handling with retry - Pull-to-refresh - Optimistic updates - TypeScript types - Accessibility (ARIA labels) Include full component code, custom hooks, API service, and tests using React Testing Library.
Database Migration Script
Create a database migration script (PostgreSQL) that: 1. Adds new "subscriptions" table with: - id, user_id, plan_id, status, start_date, end_date, created_at 2. Migrates existing user subscription data from "users" table 3. Handles foreign key constraints 4. Creates indexes for performance 5. Has rollback capability 6. Validates data integrity after migration Include both UP and DOWN migration with detailed comments and error handling.
ETL Pipeline Design
๐ Data Processing
Design a data pipeline using Python and Apache Airflow that: Sources: - PostgreSQL database (customer data) - REST API (transaction data, paginated) - CSV files in S3 (product catalog, daily) Transformations: - Clean nulls and duplicates - Join customer + transaction + product data - Calculate metrics: LTV, churn risk, purchase frequency - Aggregate by customer segment Load: - Target: Snowflake data warehouse - Incremental updates only - Data validation rules Include: - DAG definition with task dependencies - Error handling and retries - Monitoring/alerting hooks - Idempotency for reruns - Performance optimization tips Provide complete Airflow DAG code with explanations.
Real-time Stream Processing
Create a real-time stream processor using Python + Kafka that: Input: User clickstream events (100k events/minute) Process: - Filter bot traffic - Sessionize user activity (30min timeout) - Calculate real-time metrics (page views, conversions) - Detect anomalies (sudden traffic spikes) - Enrich with user profile data Output: - Aggregated metrics to Redis - Anomaly alerts to Slack - Raw events to S3 for batch processing Include producer/consumer code, error handling, exactly-once processing, and monitoring.
CI/CD Pipeline Configuration
โ๏ธ DevOps
Create a GitHub Actions CI/CD pipeline for a Node.js microservice that: Stages: 1. Lint and code quality (ESLint, Prettier) 2. Run tests (unit + integration) with coverage 3. Build Docker image 4. Security scan (vulnerabilities, secrets) 5. Deploy to staging (auto) 6. Run smoke tests 7. Deploy to production (manual approval) 8. Rollback capability Include: - Complete .github/workflows/deploy.yml - Environment variables management - Secrets handling - Notifications (Slack) - Deployment strategies (blue-green or canary) Provide full YAML configuration with explanations.
Kubernetes Deployment
Create Kubernetes manifests for a production web application with: Components: - Frontend (React): 3 replicas, autoscaling - Backend API (Node.js): 5 replicas, autoscaling - Redis cache: StatefulSet - PostgreSQL: External (RDS) Include: - Deployments, Services, ConfigMaps, Secrets - Ingress with SSL/TLS (cert-manager) - Health checks (liveness/readiness probes) - Resource limits and requests - HPA (Horizontal Pod Autoscaler) - Network policies - Monitoring (Prometheus annotations) Provide all YAML files with best practices and security considerations.
Microservices Architecture
๐๏ธ System Design
Design a microservices architecture for an e-commerce platform handling 100K daily users: Services needed: - User management & authentication - Product catalog - Shopping cart (real-time) - Order processing - Payment processing - Inventory management - Notification service (email/SMS) - Search & recommendations For each service provide: 1. Responsibilities and boundaries 2. Communication patterns (sync/async) 3. Database strategy (per-service) 4. API contracts 5. Event-driven flows (message queue) 6. Caching strategy 7. Scalability considerations Include: - Architecture diagram (Mermaid syntax) - Technology recommendations - Data consistency strategies - Monitoring approach
Rate Limiting System
Design a distributed rate limiting system that: Requirements: - Support multiple limit tiers (free: 100/hr, pro: 1000/hr, enterprise: custom) - Per-user and per-API-key limits - Global rate limits (protect infrastructure) - Handle 10K requests/second - Low latency (<10ms overhead) - Accurate across distributed servers - Graceful degradation if Redis fails Design: 1. Algorithm choice (token bucket, sliding window, etc.) 2. Data structures and storage (Redis) 3. Synchronization across servers 4. Response headers (X-RateLimit-*) 5. Error handling and fallbacks Provide architecture diagram and pseudocode for implementation.
Model Deployment Pipeline
๐ง ML Engineering
Design an MLOps pipeline for deploying a recommendation model to production: Requirements: - Model training on new data weekly - A/B testing (challenger vs. champion) - Feature store integration - Model versioning and rollback - Monitoring (accuracy, latency, drift) - Auto-scaling based on traffic - Low latency inference (<100ms) Components: 1. Training pipeline (orchestration) 2. Model registry and versioning 3. Feature engineering and storage 4. Model serving architecture 5. Monitoring and alerting 6. CI/CD for model updates Provide architecture diagram, technology stack recommendations, and deployment strategy.
Multi-turn Conversation Handler
๐ฌ Chatbots
Create a conversation state manager for a restaurant booking chatbot: Conversation flow: 1. Greeting 2. Ask for date/time 3. Ask for party size 4. Ask for dietary restrictions 5. Show available tables 6. Confirm booking 7. Send confirmation Handle: - Context retention across turns - Input validation (date format, party size limits) - Error recovery ("I didn't understand") - Context switching (user changes mind) - Slot filling (missing information) - Natural language understanding - Fallback to human handoff Provide: - State machine diagram - Python/Node.js implementation - Example conversation flows - Error handling strategies
Function Calling Orchestration
Design a function calling system for an AI assistant with access to: Functions: - get_weather(location, date) - book_flight(origin, destination, date, passengers) - search_hotels(location, check_in, check_out, guests) - get_calendar_events(date_range) - send_email(to, subject, body) - create_reminder(text, datetime) User query: "I need to fly to New York next Friday, book a hotel for 2 nights, and schedule a meeting with John about the merger." Create: 1. Function selection logic 2. Parameter extraction 3. Execution order (dependencies) 4. Error handling (API failures) 5. Confirmation before actions 6. Response synthesis Provide complete orchestration code with state management.
E2E Test Suite Generation
๐งช Testing
Generate comprehensive E2E tests for a user authentication flow using Playwright: Flow to test: 1. Visit homepage 2. Click "Sign Up" 3. Fill registration form (email, password, confirm password) 4. Submit form 5. Verify email sent 6. Click verification link 7. Login with new credentials 8. Verify dashboard loads Tests must cover: - Happy path - Validation errors (weak password, email format, mismatched passwords) - Edge cases (already registered email) - Network failures - Timeout handling - Cross-browser compatibility - Mobile responsive Include: - Complete test suite code - Page Object Models - Utility functions - Test data fixtures - CI/CD integration
Security Audit Checklist
๐ Security
Perform a security audit on this Express.js API endpoint and provide: ```javascript app.post('/api/users/update', (req, res) => { const { userId, email, role } = req.body; const query = `UPDATE users SET email = '${email}', role = '${role}' WHERE id = ${userId}`; db.query(query, (err, result) => { if (err) return res.status(500).send(err); res.json({ success: true, user: result }); }); }); ``` Identify: 1. Security vulnerabilities (with severity: critical/high/medium/low) 2. Attack vectors (SQL injection, privilege escalation, etc.) 3. Missing security controls 4. Compliance issues (OWASP Top 10) 5. Data exposure risks Provide: - Detailed vulnerability report - Exploit examples - Secure code rewrite - Additional security measures needed
Regex Pattern for Email Validation
โก Quick Tasks
Create a comprehensive regex pattern for email validation that: - Supports international domains - Allows plus addressing (user+tag@domain.com) - Handles subdomains - Rejects common fake patterns - Follows RFC 5322 standard Provide regex pattern and test cases for valid/invalid emails.
SQL Query - Complex Join
Write a SQL query to find customers who: - Made purchases in the last 30 days - Have NOT made purchases in the last 7 days (at-risk) - Have lifetime value > $500 - Are in the "premium" segment Include customer name, last purchase date, total spent, and days since last purchase.
Debounced Search Implementation
Write a React hook for debounced search with: - 300ms delay - Cancel on unmount - Loading state - TypeScript types - Error handling Include complete useDebounce hook and usage example.
Enter a prompt above and click "Calculate Costs" to see results