{"id":32845357,"url":"https://github.com/keyless-app/keyless-backend","last_synced_at":"2025-11-08T07:02:56.842Z","repository":{"id":321020605,"uuid":"1084120895","full_name":"keyless-app/keyless-backend","owner":"keyless-app","description":"Train AI models. Earn points. Generate without limits.","archived":false,"fork":false,"pushed_at":"2025-11-05T05:09:43.000Z","size":65,"stargazers_count":61,"open_issues_count":0,"forks_count":12,"subscribers_count":74,"default_branch":"main","last_synced_at":"2025-11-05T07:08:00.501Z","etag":null,"topics":["ai","airdrop","automation","blockchain","solana"],"latest_commit_sha":null,"homepage":"https://www.keylessai.app/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/keyless-app.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-27T08:52:31.000Z","updated_at":"2025-11-05T05:41:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"c2275cb3-9e75-4029-b786-71e855b728f3","html_url":"https://github.com/keyless-app/keyless-backend","commit_stats":null,"previous_names":["keyless-app/keyless-backend"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/keyless-app/keyless-backend","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keyless-app%2Fkeyless-backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keyless-app%2Fkeyless-backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keyless-app%2Fkeyless-backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keyless-app%2Fkeyless-backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/keyless-app","download_url":"https://codeload.github.com/keyless-app/keyless-backend/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keyless-app%2Fkeyless-backend/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":283313443,"owners_count":26815359,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-08T02:00:06.281Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","airdrop","automation","blockchain","solana"],"created_at":"2025-11-08T07:01:11.600Z","updated_at":"2025-11-08T07:02:52.209Z","avatar_url":"https://github.com/keyless-app.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Keyless - AI Generation Platform (Solana-based)\n\n[![npm version](https://img.shields.io/npm/v/@keyless-app/keyless-backend.svg)](https://www.npmjs.com/package/@keyless-app/keyless-backend)\n[![npm downloads](https://img.shields.io/npm/dm/@keyless-app/keyless-backend.svg)](https://www.npmjs.com/package/@keyless-app/keyless-backend)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n\n\u003e **Train AI models. Earn $KEY. Generate without limits. Powered by Solana.**\n\nAn AI platform powered by Solana's high-speed, low-cost blockchain. The first AI platform with a real-time, transparent buyback mechanism powered by Solana's speed.\n\n**📦 Available on npm:** [@keyless-app/keyless-backend](https://www.npmjs.com/package/@keyless-app/keyless-backend)\n\n## 🎯 What is Keyless?\n\nKeyless is an AI generation platform that democratizes access to AI content creation through a **Revenue-to-Buyback Flywheel** powered by Solana:\n\n### The Flywheel\n\n**Revenue** → **Spenders** (developers) pay in USDC (SPL) to purchase \"Points\" for API access\n\n**Buyback** → A large portion of that USDC is immediately swapped for $KEY (SPL) on a Solana DEX (Jupiter/Raydium)\n\n**Reward** → Purchased $KEY is sent to the \"Contributor Rewards Treasury\"\n\n**Distribution** → **Contributors** (users training models) earn $KEY from this treasury\n\nThis flywheel is highly efficient on Solana, as the buyback swaps are near-instant and cost fractions of a cent.\n\n### Two User Types\n\n- **Spenders**: Developers who pay USDC (SPL) to purchase \"Points\" and use the AI API\n- **Contributors**: Users who train models and earn $KEY tokens from the Rewards Treasury\n\n### Key Features\n\n- **Solana Wallet Authentication**: Connect your Phantom, Solflare, or any Solana wallet\n- **Pay-as-you-go**: No credit cards, no monthly subscriptions—just USDC\n- **Transparent Buyback**: All buyback transactions are on-chain and visible\n- **Fast \u0026 Cheap**: Powered by Solana's speed and low fees\n\n## 🚀 Key Features\n\n### For Spenders: Pay-as-you-go AI API\n\nPurchase Points with USDC (SPL) and use them to generate AI content:\n\n- **Text Generation** (5 points): Create articles, stories, summaries, and more\n- **Image Generation** (8 points): Generate images from text descriptions\n- **Code Generation** (6 points): Generate code snippets, functions, and programs\n- **Audio Generation** (10 points): Create audio content and speech synthesis\n- **Data Analysis** (6 points): Analyze data and generate insights\n- **Search \u0026 Research** (6 points): Search and research topics with AI\n\n**Price**: 1 Point = $0.001 USDC (e.g., 1000 points = $1 USDC)\n\n### For Contributors: Train AI \u0026 Earn $KEY\n\nEarn $KEY tokens by contributing to improve AI models:\n\n- Provide training data (prompt/response pairs)\n- Submit feedback on AI outputs\n- Annotate data for model training\n- Evaluate model performance\n- Suggest improvements\n\n**Reward**: $KEY tokens are paid out from the Rewards Treasury (funded by buyback)\n\n### Core Infrastructure\n\n- **REST API**: Comprehensive HTTP endpoints for all operations\n- **Wallet Authentication**: Secure access using wallet address\n- **Rate Limiting**: Protection against abuse\n- **Points Management**: Track earnings, spending, and balance\n- **Generation History**: Keep track of all AI generations\n- **Platform Statistics**: Monitor usage and contributions\n\n## 🏗️ Architecture\n\n### Current Directory Structure\n\n```\nkeyless/\n├── src/                    # Main TypeScript Application\n│   ├── core/              # Core business logic (Keyless, PointsManager, etc.)\n│   ├── routes/            # API routes (generation, contributions, points, stats)\n│   ├── middleware/        # Express middleware\n│   ├── utils/             # Utilities\n│   ├── types/             # TypeScript types\n│   └── config.ts          # Configuration\n│\n├── ai-services/           # Python AI Services (FastAPI)\n│   ├── text_generation/   # Text generation service\n│   └── shared/            # Shared Python modules\n│\n├── blockchain/            # Blockchain integration\n│   └── services/          # Blockchain services\n│\n├── shared/                # Shared TypeScript types\n│   └── types/\n│\n├── docs/                  # Documentation\n└── examples/             # Example code\n```\n\n### Architecture Layers\n\n#### 1. **Backend Layer (TypeScript)**\n\n- **Express.js REST API** for HTTP requests\n- **Authentication \u0026 Authorization** via JWT + Wallet ID\n- **Points Management** and transaction tracking\n- **Request routing** to Python AI services\n- **Business logic** orchestration\n\n#### 2. **AI Services Layer (Python)**\n\n- **FastAPI** microservices for each AI capability\n- **Text Generation**: GPT-4, Claude integration\n- **Image Generation**: DALL-E, Stable Diffusion\n- **Code Generation**: Codex, Copilot\n- **Audio Generation**: Whisper, ElevenLabs\n- **Data Analysis**: Custom ML models\n- **Model Training**: Retraining with contributions\n\n#### 3. **Solana Blockchain Layer**\n\n- **Solana Program** for payment/buyback automation\n- **$KEY SPL Token** on Solana mainnet\n- **USDC (SPL)** payments from Spenders\n- **Jupiter/Raydium** for USDC → $KEY swaps\n- **Transparent buyback** transactions on-chain\n- **Solana wallet** authentication (Phantom, Solflare, etc.)\n\n#### 4. **Database Layer**\n\n- **PostgreSQL** for structured data\n- **Redis** for caching\n- **Migrations** for schema management\n\nFor complete structure details, see [PROJECT_STRUCTURE.md](PROJECT_STRUCTURE.md) and [docs/architecture.md](docs/architecture.md).\n\n## 📦 Installation\n\n### Install from npm (Recommended)\n\nThe package is available on npm: **[@keyless-app/keyless-backend](https://www.npmjs.com/package/@keyless-app/keyless-backend)**\n\n```bash\nnpm install @keyless-app/keyless-backend\n```\n\n### Install from source\n\n```bash\ngit clone https://github.com/keyless-app/keyless-backend.git\ncd keyless-backend\nnpm install\n```\n\n## 🔧 Quick Start\n\n### 1. Environment Setup\n\n```bash\ncp env.example .env\n# Edit .env with your configuration\n```\n\nRequired environment variables:\n\n```env\nJWT_SECRET=your-secret-key-change-in-production\nJWT_EXPIRES_IN=24h\nPORT=3000\nNODE_ENV=production\nCORS_ORIGIN=*\n\n# Solana Configuration\nSOLANA_RPC_URL=https://api.mainnet-beta.solana.com\nSOLANA_NETWORK=mainnet-beta\nKEY_TOKEN_MINT=your-key-token-mint-address\nUSDC_MINT=usd-key-here\nREWARDS_TREASURY_WALLET=your-rewards-treasury-wallet\nJUPITER_API_URL=https://quote-api.jup.ag/v6\nPOINTS_PRICE_USDC=0.001\n\n# Optional: AI service configurations\nTEXT_GENERATION_MODEL=gpt-4\nIMAGE_GENERATION_MODEL=dall-e-3\nCODE_GENERATION_MODEL=gpt-4\nAUDIO_GENERATION_MODEL=whisper\n```\n\n### 2. Start the Server\n\n```bash\n# Development mode\nnpm run dev\n\n# Production mode\nnpm run build\nnpm start\n```\n\n### 3. Solana Wallet Authentication\n\nAll API endpoints require a valid Solana wallet address in the `X-Wallet-Address` header:\n\n```bash\ncurl -H \"X-Wallet-Address: {SOLANA_WALLET_ADDRESS}\" \\\n     https://{BASE_URL}/health\n```\n\n**Supported Wallets**: Phantom, Solflare, or any Solana wallet\n\n## 🔑 API Endpoints\n\n### Health Check\n\n- `GET /health` - Service health status (no auth required)\n\n### AI Generation\n\n- `POST /api/generation/text` - Generate text content\n- `POST /api/generation/image` - Generate image content\n- `POST /api/generation/code` - Generate code content\n- `POST /api/generation/audio` - Generate audio content\n- `POST /api/generation/analysis` - Analyze data\n- `POST /api/generation/search` - Search and research\n- `GET /api/generation/history` - Get generation history\n\n### Contributions\n\n- `POST /api/contributions` - Add a contribution to earn points\n- `GET /api/contributions` - Get user contributions\n\n### Points\n\n- `GET /api/points/balance` - Get points balance\n- `GET /api/points/transactions` - Get points transaction history\n\n### Statistics\n\n- `GET /api/stats/user` - Get user statistics\n- `GET /api/stats/platform` - Get platform statistics\n\n## 📊 Points System\n\n### Points Costs by AI Tool\n\n| AI Tool           | Points Cost |\n| ----------------- | ----------- |\n| Text Generation   | 5 points    |\n| Image Generation  | 8 points    |\n| Code Generation   | 6 points    |\n| Audio Generation  | 10 points   |\n| Data Analysis     | 6 points    |\n| Search \u0026 Research | 6 points    |\n\n### Earning Points\n\nEarn points by contributing to improve AI models:\n\n- **Training Data**: 10-50 points depending on quality and quantity\n- **Feedback**: 5-20 points per submission\n- **Annotations**: 15-30 points per data point\n- **Evaluations**: 10-25 points per evaluation\n- **Improvements**: 20-50 points for significant contributions\n\n## 📋 Example API Calls\n\n### Purchase Points (Spenders)\n\n```bash\ncurl -X POST \\\n  -H \"X-Wallet-Address: {SOLANA_WALLET_ADDRESS}\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"usdcAmount\": 10.0\n  }' \\\n  https://{BASE_URL}/api/payment/purchase\n```\n\nThis will:\n1. Accept USDC payment from your wallet\n2. Credit your account with Points (1 Point = $0.001 USDC)\n3. Trigger automatic buyback: swap ~80% of USDC for $KEY\n4. Send $KEY to Rewards Treasury\n\n### Generate Text Content\n\n```bash\ncurl -X POST \\\n  -H \"X-Wallet-Address: {SOLANA_WALLET_ADDRESS}\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"prompt\": \"Write a short story about an AI assistant\",\n    \"config\": {\n      \"maxTokens\": 1000,\n      \"temperature\": 0.7\n    }\n  }' \\\n  https://{BASE_URL}/api/generation/text\n```\n\n### Generate Image\n\n```bash\ncurl -X POST \\\n  -H \"X-Wallet-ID: {WALLET_ID}\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"prompt\": \"A futuristic AI city at sunset\",\n    \"config\": {\n      \"width\": 1024,\n      \"height\": 1024\n    }\n  }' \\\n  https://{BASE_URL}/api/generation/image\n```\n\n### Generate Code\n\n```bash\ncurl -X POST \\\n  -H \"X-Wallet-ID: {WALLET_ID}\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"prompt\": \"Create a REST API endpoint in TypeScript\",\n    \"config\": {\n      \"language\": \"typescript\"\n    }\n  }' \\\n  https://{BASE_URL}/api/generation/code\n```\n\n### Add Contribution (Contributors)\n\n```bash\ncurl -X POST \\\n  -H \"X-Wallet-Address: {SOLANA_WALLET_ADDRESS}\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"type\": \"training_data\",\n    \"modelId\": \"model_001\",\n    \"data\": {\n      \"prompt\": \"Sample prompt\",\n      \"response\": \"Sample response\"\n    },\n    \"keyEarned\": 50\n  }' \\\n  https://{BASE_URL}/api/contributions\n```\n\nContributors earn $KEY tokens (not points). $KEY tokens are paid out from the Rewards Treasury.\n\n### Get Points Balance (Spenders)\n\n```bash\ncurl -H \"X-Wallet-Address: {SOLANA_WALLET_ADDRESS}\" \\\n     https://{BASE_URL}/api/points/balance\n```\n\n### Get $KEY Balance (Contributors)\n\n```bash\ncurl -H \"X-Wallet-Address: {SOLANA_WALLET_ADDRESS}\" \\\n     https://{BASE_URL}/api/key/balance\n```\n\n### Get User Statistics\n\n```bash\ncurl -H \"X-Wallet-ID: {WALLET_ID}\" \\\n     https://{BASE_URL}/api/stats/user\n```\n\n## 🔐 Security Features\n\n- **Wallet Authentication**: Secure access using wallet addresses\n- **Rate Limiting**: Protection against abuse\n- **CORS Protection**: Cross-origin request security\n- **Input Validation**: Request parameter validation\n- **Error Handling**: Secure error responses\n- **Helmet**: Security headers for Express\n- **HTTPS Support**: Encrypted connections\n- **Request Validation**: Zod schema validation\n\n## 💡 Technology Stack\n\n### Backend (TypeScript)\n\n- **Runtime**: Node.js 18+\n- **Framework**: Express.js + TypeScript\n- **Authentication**: JWT + Wallet ID\n- **Database**: PostgreSQL + Redis\n\n### AI Services (Python)\n\n- **Framework**: FastAPI\n- **Models**: GPT-4, DALL-E, Claude, Stable Diffusion\n- **Training**: PyTorch + Transformers\n\n### Blockchain (Solana)\n\n- **Smart Contracts**: Solana Programs (Rust/Anchor)\n- **Integration**: @solana/web3.js, @solana/spl-token\n- **DEX Integration**: Jupiter Aggregator API\n- **Token Standards**: SPL Token\n\n## 🤝 Contributing\n\nWe welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.\n\n### Development Guidelines\n\n- Follow TypeScript best practices\n- Write comprehensive tests\n- Maintain API documentation\n- Follow REST API design principles\n- Test new endpoints thoroughly\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n**Keyless**: The first AI platform with a real-time, transparent buyback mechanism, powered by Solana's speed and low fees.\n\n## 🎯 The Revenue-to-Buyback Flywheel\n\n1. **Spenders** pay USDC (SPL) → Purchase Points → Use API\n2. **Buyback** automatically swaps USDC → $KEY via Jupiter/Raydium\n3. **$KEY** goes to Rewards Treasury\n4. **Contributors** earn $KEY for training models\n\nAll powered by Solana's near-instant, low-cost transactions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeyless-app%2Fkeyless-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkeyless-app%2Fkeyless-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeyless-app%2Fkeyless-backend/lists"}