{"id":34632754,"url":"https://github.com/reclast/aireclast","last_synced_at":"2026-03-12T22:31:57.179Z","repository":{"id":289547011,"uuid":"971625260","full_name":"RecLast/aireclast","owner":"RecLast","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-23T20:06:13.000Z","size":75,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-23T21:23:11.918Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RecLast.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2025-04-23T20:06:10.000Z","updated_at":"2025-04-23T20:06:15.000Z","dependencies_parsed_at":"2025-04-23T21:23:19.541Z","dependency_job_id":null,"html_url":"https://github.com/RecLast/aireclast","commit_stats":null,"previous_names":["reclast/aireclast"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/RecLast/aireclast","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RecLast%2Faireclast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RecLast%2Faireclast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RecLast%2Faireclast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RecLast%2Faireclast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RecLast","download_url":"https://codeload.github.com/RecLast/aireclast/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RecLast%2Faireclast/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30446445,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T21:31:01.033Z","status":"ssl_error","status_checked_at":"2026-03-12T21:30:43.161Z","response_time":114,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2025-12-24T16:53:59.439Z","updated_at":"2026-03-12T22:31:57.169Z","avatar_url":"https://github.com/RecLast.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":" \u003cp align=\"center\"\u003e\n  \u003cimg src=\"src/static/images/logo.png\" alt=\"ReclastAI Logo\"\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003eReclastAI - Cloudflare Workers AI API Gateway\u003c/h1\u003e\n\nA comprehensive AI API gateway built with Cloudflare Workers and Cloudflare Workers AI, featuring a modern web interface and API endpoints for text, image, and code generation. Developed by [RecLast](https://www.umiteski.com.tr/) as an open-source solution for AI API access.\n\n## Image\n\n![ReclastAI Logo](src/static/images/app.png)\n\n## Features\n\n- **Modern Web Interface**: Responsive and intuitive UI for interacting with AI models\n- **Text Generation**: Generate text using advanced LLMs like Llama 2-13B, Qwen 1.5-14B, Gemma-2B, and more\n- **Image Generation**: Create images from text prompts using Stable Diffusion XL, SDXL Lightning, DreamShaper, and Flux\n- **Code Generation**: Generate code with AI assistance using specialized models like DeepSeek Coder\n- **Secure Authentication**: Two-step authentication with email verification and username/password\n- **API Key Management**: Generate and manage your API keys for programmatic access\n- **Usage Statistics**: Track API usage and requests across different AI services\n- **API Documentation**: Built-in examples for cURL, Python, and JavaScript with your personal API key\n- **Comprehensive Error Handling**: Robust validation and error responses\n\n## Web Interface\n\nThe application includes a complete web interface with the following pages:\n\n- **Login**: Secure two-step authentication with email verification and username/password\n- **Dashboard**: Overview of usage statistics and API key management\n- **Image Generation**: Create images with customizable settings, models, and dimensions\n- **Text Generation**: Chat-like interface for text generation with multiple AI models\n- **Code Generation**: Specialized interface for code generation with programming-focused models\n\n## API Endpoints\n\n### Authentication\n\n#### POST /api/auth/check-email\nCheck if an email is allowed to access the application.\n\n**Request Body:**\n```json\n{\n  \"email\": \"test@example.com\"\n}\n```\n\n#### POST /api/auth/login\nLogin with username and password.\n\n**Request Body:**\n```json\n{\n  \"email\": \"test@example.com\",\n  \"username\": \"admin\",\n  \"password\": \"securepass123\"\n}\n```\n\n**Response:**\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"message\": \"Authentication successful\",\n    \"email\": \"test@example.com\",\n    \"username\": \"admin\",\n    \"apiKey\": \"reclast_xxxxxxxxxxxxxxxxxxxx\"\n  }\n}\n```\n\nThe API key returned in the response should be used for all subsequent API calls.\n\n### Text Generation\n\n#### POST /api/text/generate\nGenerate text using LLMs.\n\n**Request Body:**\n```json\n{\n  \"prompt\": \"Write a short story about a robot learning to paint\",\n  \"model\": \"@hf/thebloke/llama-2-13b-chat-awq\",\n  \"max_tokens\": 500,\n  \"temperature\": 0.7\n}\n```\n\n**Headers:**\n```\nContent-Type: application/json\nAuthorization: Bearer reclast_xxxxxxxxxxxxxxxxxxxx\n```\n\n**Available Models:**\n- `@hf/thebloke/llama-2-13b-chat-awq` - Llama 2 (13B)\n- `@cf/meta/llama-2-7b-chat-int8` - Llama 2 (7B)\n- `@cf/qwen/qwen1.5-14b-chat-awq` - Qwen 1.5 (14B)\n- `@cf/google/gemma-2b-it-lora` - Gemma (2B)\n- `@cf/mistral/mistral-7b-instruct-v0.1` - Mistral 7B\n- `@cf/openchat/openchat-3.5-0106` - OpenChat 3.5\n\n### Image Generation\n\n#### POST /api/image/generate\nGenerate images from text prompts.\n\n**Request Body:**\n```json\n{\n  \"prompt\": \"A cyberpunk cat in a neon city\",\n  \"model\": \"@cf/stabilityai/stable-diffusion-xl-base-1.0\",\n  \"width\": 1024,\n  \"height\": 1024,\n  \"steps\": 30\n}\n```\n\n**Headers:**\n```\nContent-Type: application/json\nAuthorization: Bearer reclast_xxxxxxxxxxxxxxxxxxxx\n```\n\n**Available Models:**\n- `@cf/stabilityai/stable-diffusion-xl-base-1.0` - Stable Diffusion XL (supports dimensions: 1024x1024, 1152x896, 896x1152, 1216x832, 832x1216)\n- `@cf/bytedance/stable-diffusion-xl-lightning` - SDXL Lightning (supports dimensions: 1024x1024, 1152x896, 896x1152, max steps: 4)\n- `@cf/lykon/dreamshaper-8-lcm` - DreamShaper (supports dimensions: 512x512, 768x512, 512x768, max steps: 10)\n- `@cf/black-forest-labs/flux-1-schnell` - Flux-1 Schnell (Premium model, requires confirmPremium: true, only supports 1024x1024, max steps: 8)\n\n**For Premium Models:**\n```json\n{\n  \"prompt\": \"A cyberpunk cat in a neon city\",\n  \"model\": \"@cf/black-forest-labs/flux-1-schnell\",\n  \"width\": 1024,\n  \"height\": 1024,\n  \"steps\": 8,\n  \"confirmPremium\": true\n}\n```\n\n### Code Generation\n\n#### POST /api/code/generate\nGenerate code with AI assistance.\n\n**Request Body:**\n```json\n{\n  \"prompt\": \"Write a function to calculate the Fibonacci sequence in JavaScript\",\n  \"model\": \"@hf/thebloke/deepseek-coder-6.7b-base-awq\",\n  \"max_tokens\": 500,\n  \"temperature\": 0.2\n}\n```\n\n**Headers:**\n```\nContent-Type: application/json\nAuthorization: Bearer reclast_xxxxxxxxxxxxxxxxxxxx\n```\n\n**Available Models:**\n- `@hf/thebloke/deepseek-coder-6.7b-base-awq` - DeepSeek Coder (6.7B)\n- `@hf/thebloke/llama-2-13b-chat-awq` - Llama 2 (13B)\n- `@cf/qwen/qwen1.5-14b-chat-awq` - Qwen 1.5 (14B)\n- `@cf/meta/llama-2-7b-chat-int8` - Llama 2 (7B)\n- `@cf/mistral/mistral-7b-instruct-v0.1` - Mistral 7B\n- `@cf/openchat/openchat-3.5-0106` - OpenChat 3.5\n\n### Statistics\n\n#### GET /api/stats\nGet usage statistics.\n\n**Headers:**\n```\nAuthorization: Bearer reclast_xxxxxxxxxxxxxxxxxxxx\n```\n\n**Response:**\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"textRequests\": 10,\n    \"imageRequests\": 5,\n    \"codeRequests\": 8,\n    \"totalRequests\": 23\n  }\n}\n```\n\n## Setup and Deployment\n\n### Prerequisites\n\n- [Node.js](https://nodejs.org/) (v16 or later)\n- [Wrangler CLI](https://developers.cloudflare.com/workers/wrangler/install-and-update/)\n- Cloudflare account with Workers and Workers AI access\n\n### Configuration\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/RecLast/aireclast.git\n   cd aireclast\n   ```\n\n2. Install dependencies:\n   ```bash\n   npm install\n   ```\n\n3. Create a `wrangler.json` file based on the example:\n   ```bash\n   cp wrangler.example.json wrangler.json\n   ```\n\n4. Update the basic configuration in `wrangler.json`:\n   ```json\n   {\n     \"compatibility_date\": \"2025-04-01\",\n     \"main\": \"src/index.ts\",\n     \"name\": \"aireclast\",\n     \"upload_source_maps\": true,\n     \"ai\": {\n       \"binding\": \"AI\"\n     },\n     \"observability\": {\n       \"enabled\": true\n     },\n     \"assets\": {\n       \"binding\": \"ASSETS\",\n       \"directory\": \"src/static\"\n     }\n   }\n   ```\n\n5. Create a KV namespace:\n   ```bash\n   npx wrangler kv namespace create AUTH_STORE\n   ```\n   Note the returned ID for the next step.\n\n6. **IMPORTANT**: Instead of adding sensitive information to `wrangler.json`, configure these settings directly in the Cloudflare Dashboard after deployment:\n\n   a. Go to Workers \u0026 Pages \u003e Your Worker \u003e Settings\n\n   b. Add KV Namespace binding:\n      - In the \"Bindings\" section, click \"+ Add\"\n      - Type: KV Namespace\n      - Variable name: AUTH_STORE\n      - KV Namespace: Select your created namespace\n\n   c. Add environment variables:\n      - In the \"Variables and secrets\" section, click \"+ Add\"\n      - Add ALLOWED_EMAILS (Plain text): Comma-separated list of emails allowed to access the application\n      - Add USER_CREDENTIALS (Plain text): Comma-separated list of username:password pairs (e.g., \"admin:password123,user:pass456\")\n      - Add JWT_SECRET (Secret): A secure secret key for JWT token generation\n\n7. **Authentication System**:\n\n   The application uses a secure authentication system:\n\n   a. **Step 1: Email Verification**\n      - User enters their email address\n      - If the email is in the allowed list (ALLOWED_EMAILS), they can proceed to the next step\n      - No verification codes or emails are sent\n\n   b. **Step 2: Username/Password Authentication**\n      - After email verification, user enters username and password\n      - Credentials are checked against the USER_CREDENTIALS environment variable\n      - If valid, user is authenticated and redirected to the dashboard\n      - A unique API key is generated for the user and displayed in the dashboard\n\n   c. **API Key Management**\n      - Users can view their API key in the dashboard\n      - Users can regenerate their API key if needed\n      - API keys are used for programmatic access to the API endpoints\n\n   This approach provides robust security:\n   - Protected pages require authentication\n   - API endpoints require a valid API key\n   - Each user has their own unique API key\n   - API keys can be regenerated if compromised\n\n   To set up the authentication:\n\n   1. Configure ALLOWED_EMAILS with comma-separated list of allowed email addresses\n   2. Configure USER_CREDENTIALS with comma-separated list of username:password pairs\n   3. Set a secure JWT_SECRET for token generation\n\n   Example configuration:\n   ```\n   ALLOWED_EMAILS: \"admin@example.com,user@example.com\"\n   USER_CREDENTIALS: \"admin:securepass123,user:userpass456\"\n   JWT_SECRET: \"your-secure-random-string-here\"\n   ```\n\n### Development\n\nRun the application locally:\n```bash\nnpm run dev\n```\n\n### Deployment\n\nDeploy to Cloudflare Workers:\n```bash\nnpm run deploy\n```\n\n## Project Structure\n\n```\naireclast/\n├── src/\n│   ├── api/                     # API handlers\n│   │   ├── auth.ts              # Authentication API\n│   │   ├── text.ts              # Text generation API\n│   │   ├── image.ts             # Image generation API\n│   │   ├── code.ts              # Code generation API\n│   │   └── stats.ts             # Statistics API\n│   ├── middleware/              # Middleware functions\n│   │   ├── auth.ts              # Authentication middleware\n│   │   └── validation.ts        # Request validation\n│   ├── utils/                   # Utility functions\n│   │   ├── response.ts          # Response formatting\n│   │   ├── jwt.ts               # JWT handling\n│   │   └── email.ts             # Email utilities\n│   ├── static/                  # Static assets\n│   │   ├── css/                 # CSS styles\n│   │   ├── js/                  # JavaScript files\n│   │   └── images/              # Image assets\n│   ├── templates/               # HTML templates\n│   ├── types.ts                 # TypeScript type definitions\n│   └── index.ts                 # Main application entry point\n├── wrangler.json                # Cloudflare Workers configuration\n├── package.json                 # Project dependencies\n└── README.md                    # Project documentation\n```\n\n## Model Compatibility and Limitations\n\n### Text and Code Generation Models\n- Each model has different capabilities and performance characteristics\n- Some models are better suited for specific tasks (e.g., DeepSeek Coder for programming)\n- Models have token limits that vary by model\n- Temperature and other parameters can be adjusted to control creativity vs. precision\n\n### Image Generation Models\n- Each model has specific dimension requirements:\n  - **Stable Diffusion XL**: 1024x1024, 1152x896, 896x1152, 1216x832, 832x1216\n  - **SDXL Lightning**: 1024x1024, 1152x896, 896x1152 (max steps: 4)\n  - **DreamShaper**: 512x512, 768x512, 512x768 (max steps: 10)\n  - **Flux-1 Schnell**: 1024x1024 only (max steps: 8, requires confirmPremium: true)\n- The application automatically adjusts dimensions and steps to match model requirements\n- Premium models require explicit confirmation via the confirmPremium parameter\n\nFor a complete list of available models and their parameters, refer to the [Cloudflare Workers AI documentation](https://developers.cloudflare.com/workers-ai/models/).\n\n## Troubleshooting\n\n### Authentication Issues\n- Ensure your email is in the ALLOWED_EMAILS list\n- Verify your username and password match the USER_CREDENTIALS configuration\n- Check that JWT_SECRET is properly set in the Cloudflare Dashboard\n- Clear browser cookies and try logging in again\n\n### API Issues\n- Ensure you're using a valid API key in the Authorization header\n- Check that your request format matches the examples\n- Verify that model parameters (dimensions, steps) are within allowed ranges\n- For premium models, include the confirmPremium: true parameter\n\n### Deployment Issues\n- Verify that all environment variables are correctly set in the Cloudflare Dashboard\n- Ensure the KV namespace is properly bound to AUTH_STORE\n- Check Cloudflare Workers logs for detailed error messages\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n## Credits\n\nDeveloped by [RecLast](https://www.umiteski.com.tr/) using Cloudflare Workers and Cloudflare Workers AI.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freclast%2Faireclast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freclast%2Faireclast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freclast%2Faireclast/lists"}