Overview

A production-ready WordPress plugin that provides a complete AI Gateway and Credit Management system for the AIBuddy VS Code Extension.


Core Features

πŸ€– AI Gateway (Main Feature)

  • Multi-Provider Support: OpenAI, Anthropic Claude, Google Gemini
  • Smart Routing: Automatically selects the fastest/best available provider
  • Auto-Failover: Switches to backup provider if primary fails
  • Token Counting: Real-time tracking and credit deduction

πŸ’³ Payment & Credits

  • Stripe Integration: Secure payment processing
  • Credit Packages: Configurable pricing tiers (Starter, Pro, Business, etc.)
  • Custom Amounts: Users can request custom credit amounts
  • Transaction History: Complete purchase and usage tracking

🎁 Rewards System

  • Reward Tasks: Admin creates tasks (social media, referrals, content)
  • Proof Submission: Users submit proof and earn credits
  • Admin Approval: Review and approve/reject submissions with notes
  • Auto-Credits: Credits added automatically upon approval
  • Email Notifications: Users notified on approval/rejection
  • Submission History: Users can view their submission status

πŸ“„ Frontend Pages (8 Shortcodes)

  1. PricingΒ – Display packages and purchase credits
  2. DashboardΒ – User account overview and statistics
  3. API KeyΒ – Generate/regenerate key for VS Code Extension
  4. RewardsΒ – View and complete reward tasks
  5. LoginΒ – Custom login page with dynamic redirects
  6. RegisterΒ – Custom registration page
  7. SuccessΒ – Payment confirmation page
  8. NavigationΒ – Menu widget with active page highlighting

βš™οΈ Admin Dashboard

  • Settings: Gateway, Stripe, Pricing, Page Management (tabbed interface)
  • Users: View all users, credits, API keys, manual credit addition
  • AI Providers: Configure OpenAI, Claude, Gemini API keys with encryption
  • Usage Logs: Real-time API usage tracking
  • Rewards Management: Tasks, submissions, analytics (tabbed)
  • Provider Health: Monitor AI provider status
  • Analytics: Usage statistics and reports

πŸ”Œ REST API (Version 2)

  • Base URL:Β https://aibuddy.life/wp-json/aibuddy-code/v2/
  • AI InferenceΒ (/inference): Unified AI requests endpoint
  • User InfoΒ (/user-info): Get credits and account data
  • Health CheckΒ (/health): Provider status monitoring
  • PaymentsΒ (/create-checkout,Β /webhook): Stripe integration
  • Custom CreditsΒ (/custom-credits-request): Custom amount requests
  • RewardsΒ (/rewards,Β /submit-proof,Β /user-rewards): Task system

πŸ—„οΈ Database

  • 6 custom tables for users, usage, transactions, health, rewards
  • Auto-fix system creates missing tables automatically
  • Pre-populated with 4 default reward tasks

🎨 Elementor Integration

  • Purchase Button Widget: Customizable credit purchase buttons
  • Navigation Widget: Menu with active page detection
  • Template Support: Pre-built Elementor templates

πŸ“š Developer Resources

  • API Documentation: Complete endpoint reference
  • Postman Collection: Ready-to-import for testing
  • Testing Guide: Step-by-step instructions
  • Quick Reference: All endpoints with examples
  • Features Overview: Concise feature list
  • Complete Documentation: Detailed setup and usage guide

Statistics

MetricCount
Total Features60+
REST API Endpoints9
Frontend Shortcodes8
Elementor Widgets2
Admin Pages6
Database Tables6
AI Providers3
Documentation Files6+

Key Benefits

βœ… All-in-One Solution: Complete AI Gateway + Credit Management βœ… Production Ready: No linter errors, follows WordPress standards βœ… Secure: API key auth, nonce verification, input sanitization βœ… Scalable: Smart routing, caching, optimized queries βœ… User-Friendly: Modern UI, responsive design, intuitive forms βœ… Well-Documented: Comprehensive documentation files for developers


For VS Code Extension Developer

The plugin provides a single API endpoint for all AI requests:

POST https://aibuddy.life/wp-json/aibuddy-code/v2/inference

Request Body:

{
  "api_key": "aibuddy_xxx...",
  "messages": [{"role": "user", "content": "Hello"}],
  "model": "gpt-4",
  "provider": "openai"
}

The extension only needs:

  1. User’s AIBuddy API key (generated from API Key page)
  2. Above endpoint URL

The backend handles:

  • Routing to OpenAI/Claude/Gemini
  • Token counting and cost calculation
  • Credit deduction
  • Automatic failover
  • Usage logging
  • Provider health monitoring

Plugin Ready For Production βœ…

AIBuddy Gateway Plugin – Features