{"id":25149289,"url":"https://github.com/jawherkl/ai-models-integration","last_synced_at":"2026-03-07T11:01:23.243Z","repository":{"id":275774176,"uuid":"927141635","full_name":"JawherKl/ai-models-integration","owner":"JawherKl","description":"Node.js backend that unifies multiple AI models into one API featuring rate limiting, caching, input validation, streaming, and monitoring.","archived":false,"fork":false,"pushed_at":"2026-02-06T21:51:43.000Z","size":884,"stargazers_count":32,"open_issues_count":0,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-02-07T08:49:39.191Z","etag":null,"topics":["artificial-intelligence","chatgpt","claude","deepseek","express","gemini","llm","meta-llama","mistralai","nodejs","openai","openrouter","redis"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/JawherKl.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-04T13:28:05.000Z","updated_at":"2026-02-06T21:51:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"6a0a7fad-851d-41d6-aaa5-7a8c6548557d","html_url":"https://github.com/JawherKl/ai-models-integration","commit_stats":null,"previous_names":["jawherkl/ai-models-integration"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JawherKl/ai-models-integration","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JawherKl%2Fai-models-integration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JawherKl%2Fai-models-integration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JawherKl%2Fai-models-integration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JawherKl%2Fai-models-integration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JawherKl","download_url":"https://codeload.github.com/JawherKl/ai-models-integration/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JawherKl%2Fai-models-integration/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30212103,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T09:02:10.694Z","status":"ssl_error","status_checked_at":"2026-03-07T09:02:08.429Z","response_time":53,"last_error":"SSL_read: 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":["artificial-intelligence","chatgpt","claude","deepseek","express","gemini","llm","meta-llama","mistralai","nodejs","openai","openrouter","redis"],"created_at":"2025-02-08T21:20:20.820Z","updated_at":"2026-03-07T11:01:23.234Z","avatar_url":"https://github.com/JawherKl.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AI Models Integration with Node.js\n\n![openrouter-nodejs](https://github.com/JawherKl/ai-models-integration/blob/main/simple_code/open-node.png)\n\nWelcome to the **AI Models Integration** repository! This project provides seamless integration with various state-of-the-art AI models, offering a unified API for efficient interaction.\n\n## 🚀 Features\n\n- **Unified API**: Interact with multiple AI models through a single, streamlined interface.\n- **Extensibility**: Easily add and integrate new AI models as they become available.\n- **Scalability**: Designed to handle multiple requests efficiently, ensuring optimal performance.\n- **Rate Limiting**: Exponential backoff retries to prevent abuse and ensure fair usage.\n- **Caching**: Redis is used to cache frequent queries for improved performance and reduced latency.\n- **Validation**: All user inputs are validated with Zod to guarantee secure and structured API interactions.\n- **Streaming**: Real-time streaming of responses for long-running AI processes.\n- **Monitoring**: Integrated Prometheus metrics to track API usage, errors, and system performance.\n\n## 🧠 Integrated AI Models\n\n- **Anthropic Claude 3.5 Sonnet**\n- **Google Gemini Flash 1.5**\n- **DeepSeek R1**\n- **OpenAI GPT-4o Mini**\n- **Meta LLaMA 3.2 3B Instruct**\n- **Mistral Small**\n\n## 🛠️ Technologies Used\n\n- *Node.js*: JavaScript runtime environment.\n- *Express*: Fast, unopinionated, minimalist web framework for Node.js.\n- *OpenAI SDK*: Integration with OpenAI's API for AI model interaction.\n- *Redis*: In-memory data structure store used for caching and rate limiting.\n- *ioredis*: Redis client library for Node.js.\n- *Zod*: Input validation library for secure and reliable data handling.\n- *Prometheus*: Monitoring system for tracking API metrics and health.\n\n## 📦 Installation\n\n### Step 1: Clone the Repository\n```bash\ngit clone https://github.com/JawherKl/ai-models-integration.git\ncd ai-models-integration\n````\n\n### Step 2: Install Dependencies\n\n```bash\nnpm install\n```\n\n### Step 3: Set up Redis\n\n* Make sure Redis is installed and running locally or remotely.\n* If you don't have Redis installed, follow the [Redis installation guide](https://redis.io/docs/getting-started/installation/).\n* Alternatively, run Redis using Docker:\n\n```bash\ndocker run -d --name redis -p 6379:6379 redis\n```\n\n* The app connects to Redis by default at `redis://127.0.0.1:6379`.\n\n### Step 4: Configure Environment Variables\n\n* Create a `.env` file in the root directory.\n* Add your API keys created from openrouter and other service configurations:\n\n```bash\nAPI_KEY=your_api_key_here\nBASE_URL=https://openrouter.ai/api/v1\nREDIS_HOST=127.0.0.1\nREDIS_PORT=6379\n```\n\n## 🚀 Usage\n\n### Start the Server\n\n```bash\nnpm start\n```\n\n### API Access\n\n* Server runs by default at `http://localhost:3000`.\n* Use the endpoints below to interact with integrated AI models.\n\n### Example Requests\n\n#### Search Endpoint\n\n```bash\ncurl -X POST http://localhost:3000/search \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"model\": \"chatgpt\", \"query\": \"Latest advancements in renewable energy 2025\"}'\n```\n\n#### Analyze Endpoint\n\n```bash\ncurl -X POST http://localhost:3000/analyze \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"model\": \"deepseek\", \"text\": \"Tesla announced new solar roof technology with 25% improved efficiency in Q4 2023.\"}'\n```\n\n#### List Supported Models\n\n```bash\ncurl -X GET http://localhost:3000/models\n```\n\n## 🔒 Best Practices Implemented\n\n* **Rate Limiting:** Implements exponential backoff retries using Redis to prevent abuse and control request rates.\n* **Caching:** Frequently requested queries are cached in Redis to reduce redundant API calls and improve response times.\n* **Input Validation:** User inputs are rigorously validated with **Zod**, ensuring API robustness and security.\n* **Streaming:** Supports streaming AI responses in real-time for better user experience with long-running operations.\n* **Monitoring:** Prometheus metrics integration tracks API usage, errors, and performance for observability and alerting.\n\n## 🤝 Contributing\n\nContributions are welcome! Please open issues or submit pull requests for suggestions, improvements, or bug fixes.\n\n## 📄 License\n\nThis project is licensed under the **MIT License**. See the [LICENSE](./LICENSE) file for details.\n\n## 🙏 Acknowledgments\n\n* Thanks to all contributors and the open-source community.\n* Gratitude to maintainers of all utilized libraries and tools.\n\n---\n\n### Additional Notes\n\n* **Rate Limiting** uses Redis to count requests and apply exponential backoff delays when limits are exceeded.\n* **Caching** minimizes calls to external AI services by storing frequent query results in Redis with expiration.\n* **Zod Validation** enforces strict input schemas preventing malformed or malicious data.\n* **Streaming** capability enhances user experience by pushing partial AI completions as they are generated.\n* **Prometheus Monitoring** enables tracking of detailed API metrics facilitating proactive maintenance and scaling.\n* **Error Handling** is robust, ensuring that all exceptions are caught and logged for debugging and analysis.\n\n[![Stargazers over time](https://starchart.cc/JawherKl/ai-models-integration.svg?variant=adaptive)](https://starchart.cc/JawherKl/ai-models-integration)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjawherkl%2Fai-models-integration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjawherkl%2Fai-models-integration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjawherkl%2Fai-models-integration/lists"}