{"id":29797638,"url":"https://github.com/helpingai/helpingai-js-sdk","last_synced_at":"2025-07-28T06:32:39.143Z","repository":{"id":304165998,"uuid":"1017972812","full_name":"HelpingAI/HelpingAI-js-sdk","owner":"HelpingAI","description":"JavaScript SDK for HelpingAI, migrated from the JS folder of the HelpingAI-python repo.","archived":false,"fork":false,"pushed_at":"2025-07-11T12:43:32.000Z","size":76,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-11T14:12:43.939Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/HelpingAI.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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}},"created_at":"2025-07-11T11:48:47.000Z","updated_at":"2025-07-11T12:43:35.000Z","dependencies_parsed_at":"2025-07-11T14:13:34.248Z","dependency_job_id":"e3ea3e17-f581-4d76-8082-e1860ea00a02","html_url":"https://github.com/HelpingAI/HelpingAI-js-sdk","commit_stats":null,"previous_names":["oevortex/helpingai-js-sdk"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/HelpingAI/HelpingAI-js-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HelpingAI%2FHelpingAI-js-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HelpingAI%2FHelpingAI-js-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HelpingAI%2FHelpingAI-js-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HelpingAI%2FHelpingAI-js-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HelpingAI","download_url":"https://codeload.github.com/HelpingAI/HelpingAI-js-sdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HelpingAI%2FHelpingAI-js-sdk/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267474669,"owners_count":24093335,"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-07-28T02:00:09.689Z","response_time":68,"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":[],"created_at":"2025-07-28T06:32:19.114Z","updated_at":"2025-07-28T06:32:39.132Z","avatar_url":"https://github.com/HelpingAI.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HelpingAI JavaScript SDK\r\n\r\nThe official JavaScript/TypeScript library for the [HelpingAI](https://helpingai.co) API - Advanced AI with Emotional Intelligence\r\n\r\n[![npm version](https://badge.fury.io/js/helpingai.svg)](https://badge.fury.io/js/helpingai)\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\r\n\r\n## 🚀 Features\r\n\r\n- **OpenAI-Compatible API**: Drop-in replacement with familiar interface\r\n- **Emotional Intelligence**: Advanced AI models with emotional understanding\r\n- **Streaming Support**: Real-time response streaming\r\n- **Comprehensive Error Handling**: Detailed error types and retry mechanisms\r\n- **TypeScript Support**: Full type definitions included\r\n- **Cross-Platform**: Works in Node.js and browsers\r\n- **Flexible Configuration**: Environment variables and direct initialization\r\n\r\n## 📦 Installation\r\n\r\n```bash\r\nnpm install helpingai\r\n# or\r\nyarn add helpingai\r\n# or\r\npnpm add helpingai\r\n```\r\n\r\n## 🔑 Authentication\r\n\r\nGet your API key from the [HelpingAI Dashboard](https://helpingai.co/dashboard).\r\n\r\n### Environment Variable (Recommended)\r\n\r\n```bash\r\nexport HAI_API_KEY='your-api-key'\r\n```\r\n\r\n### Direct Initialization\r\n\r\n```javascript\r\nimport { HAI } from 'helpingai';\r\n\r\nconst hai = new HAI({ apiKey: 'your-api-key' });\r\n```\r\n\r\n## 🎯 Quick Start\r\n\r\n### ES6/TypeScript\r\n\r\n```typescript\r\nimport { HAI } from 'helpingai';\r\n\r\n// Initialize client\r\nconst hai = new HAI();\r\n\r\n// Create a chat completion\r\nconst response = await hai.chat.completions.create({\r\n  model: \"Helpingai3-raw\",\r\n  messages: [\r\n    { role: \"system\", content: \"You are an expert in emotional intelligence.\" },\r\n    { role: \"user\", content: \"What makes a good leader?\" }\r\n  ]\r\n});\r\n\r\nconsole.log(response.choices[0].message.content);\r\n```\r\n\r\n### CommonJS/Node.js\r\n\r\n```javascript\r\nconst { HAI } = require('helpingai');\r\n\r\n// Initialize client\r\nconst hai = new HAI();\r\n\r\nasync function example() {\r\n  // Create a chat completion\r\n  const response = await hai.chat.completions.create({\r\n    model: \"Helpingai3-raw\",\r\n    messages: [\r\n      { role: \"user\", content: \"Tell me about empathy\" }\r\n    ]\r\n  });\r\n\r\n  console.log(response.choices[0].message.content);\r\n}\r\n\r\nexample();\r\n```\r\n\r\n## 🌊 Streaming Responses\r\n\r\n```typescript\r\n// Stream responses in real-time\r\nconst stream = await hai.chat.completions.create({\r\n  model: \"Helpingai3-raw\",\r\n  messages: [{ role: \"user\", content: \"Tell me about empathy\" }],\r\n  stream: true\r\n});\r\n\r\nfor await (const chunk of stream) {\r\n  if (chunk.choices[0].delta.content) {\r\n    process.stdout.write(chunk.choices[0].delta.content);\r\n  }\r\n}\r\n```\r\n\r\n## ⚙️ Advanced Configuration\r\n\r\n### Parameter Control\r\n\r\n```typescript\r\nconst response = await hai.chat.completions.create({\r\n  model: \"Dhanishtha-2.0-preview\",\r\n  messages: [{ role: \"user\", content: \"Write a story about empathy\" }],\r\n  temperature: 0.7,        // Controls randomness (0-1)\r\n  max_tokens: 500,        // Maximum length of response\r\n  top_p: 0.9,            // Nucleus sampling parameter\r\n  frequency_penalty: 0.3, // Reduces repetition\r\n  presence_penalty: 0.3,  // Encourages new topics\r\n  hideThink: true        // Filter out reasoning blocks\r\n});\r\n```\r\n\r\n### Client Configuration\r\n\r\n```typescript\r\nconst hai = new HAI({\r\n  apiKey: \"your-api-key\",\r\n  baseURL: \"https://api.helpingai.co/v1\",  // Custom base URL\r\n  timeout: 30000,                          // Request timeout (ms)\r\n  organization: \"your-org-id\"              // Organization ID\r\n});\r\n```\r\n\r\n## 🛡️ Error Handling\r\n\r\n```typescript\r\nimport { \r\n  HAI, \r\n  HAIError, \r\n  RateLimitError, \r\n  InvalidRequestError,\r\n  AuthenticationError \r\n} from 'helpingai';\r\n\r\nasync function makeCompletionWithRetry(messages: any[], maxRetries = 3) {\r\n  for (let attempt = 0; attempt \u003c maxRetries; attempt++) {\r\n    try {\r\n      return await hai.chat.completions.create({\r\n        model: \"Helpingai3-raw\",\r\n        messages\r\n      });\r\n    } catch (error) {\r\n      if (error instanceof RateLimitError) {\r\n        if (attempt === maxRetries - 1) throw error;\r\n        await new Promise(resolve =\u003e \r\n          setTimeout(resolve, (error.retryAfter || 1) * 1000)\r\n        );\r\n      } else if (error instanceof InvalidRequestError) {\r\n        console.error(`Invalid request: ${error.message}`);\r\n        throw error;\r\n      } else if (error instanceof AuthenticationError) {\r\n        console.error(`Authentication failed: ${error.message}`);\r\n        throw error;\r\n      } else if (error instanceof HAIError) {\r\n        console.error(`API error: ${error.message}`);\r\n        throw error;\r\n      } else {\r\n        throw error;\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n## 🤖 Available Models\r\n\r\n### Helpingai3-raw\r\n- **Advanced Emotional Intelligence**: Enhanced emotional understanding and contextual awareness\r\n- **Training Data**: 15M emotional dialogues, 3M therapeutic exchanges, 250K cultural conversations, 1M crisis response scenarios\r\n- **Best For**: AI companionship, emotional support, therapy guidance, personalized learning\r\n\r\n### Dhanishtha-2.0-preview\r\n- **World's First Intermediate Thinking Model**: Multi-phase reasoning with self-correction capabilities\r\n- **Unique Features**: `\u003cthink\u003e...\u003c/think\u003e` blocks for transparent reasoning, structured emotional reasoning (SER)\r\n- **Best For**: Complex problem-solving, analytical tasks, educational content, reasoning-heavy applications\r\n\r\n```typescript\r\n// List all available models\r\nconst models = await hai.models.list();\r\nmodels.forEach(model =\u003e {\r\n  console.log(`Model: ${model.id} - ${model.description}`);\r\n});\r\n\r\n// Get specific model info\r\nconst model = await hai.models.retrieve(\"Helpingai3-raw\");\r\nconsole.log(`Model: ${model.name}`);\r\n\r\n// Use Dhanishtha-2.0 for complex reasoning\r\nconst response = await hai.chat.completions.create({\r\n  model: \"Dhanishtha-2.0-preview\",\r\n  messages: [{ role: \"user\", content: \"Solve this step by step: What's 15% of 240?\" }],\r\n  hideThink: false  // Show reasoning process\r\n});\r\n```\r\n\r\n## 🌐 Browser Usage\r\n\r\nFor browser environments, you can use a CDN:\r\n\r\n```html\r\n\u003cscript type=\"module\"\u003e\r\n  import { HAI } from 'https://cdn.skypack.dev/helpingai';\r\n  \r\n  const hai = new HAI({ apiKey: 'your-api-key' });\r\n  \r\n  const response = await hai.chat.completions.create({\r\n    model: \"Helpingai3-raw\",\r\n    messages: [{ role: \"user\", content: \"Hello!\" }]\r\n  });\r\n  \r\n  console.log(response.choices[0].message.content);\r\n\u003c/script\u003e\r\n```\r\n\r\n## 🏗️ Project Structure\r\n\r\n```\r\nhelpingai-js/\r\n├── src/\r\n│   ├── index.ts          # Main entry point\r\n│   ├── client.ts         # HAI client and API classes\r\n│   ├── models.ts         # Model management\r\n│   ├── types.ts          # TypeScript type definitions\r\n│   └── errors.ts         # Error classes\r\n├── dist/                 # Compiled JavaScript\r\n├── package.json          # Package configuration\r\n├── tsconfig.json         # TypeScript configuration\r\n└── README.md            # This file\r\n```\r\n\r\n## 🔧 Requirements\r\n\r\n- **Node.js**: 14+ (for Node.js environments)\r\n- **Modern Browsers**: Chrome 63+, Firefox 57+, Safari 10.1+, Edge 79+\r\n- **Dependencies**: \r\n  - `node-fetch` (for Node.js environments without native fetch)\r\n\r\n## 📚 TypeScript Support\r\n\r\nThis library is written in TypeScript and includes full type definitions:\r\n\r\n```typescript\r\nimport { \r\n  HAI, \r\n  ChatCompletion, \r\n  ChatCompletionChunk,\r\n  Model,\r\n  HAIClientOptions \r\n} from 'helpingai';\r\n\r\n// Full type safety\r\nconst options: HAIClientOptions = {\r\n  apiKey: \"your-api-key\",\r\n  timeout: 30000\r\n};\r\n\r\nconst hai = new HAI(options);\r\n\r\nconst response: ChatCompletion = await hai.chat.completions.create({\r\n  model: \"Helpingai3-raw\",\r\n  messages: [{ role: \"user\", content: \"Hello!\" }]\r\n});\r\n```\r\n\r\n## 🤝 Contributing\r\n\r\nWe welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.\r\n\r\n1. Fork the repository\r\n2. Create a feature branch\r\n3. Make your changes\r\n4. Add tests if applicable\r\n5. Submit a pull request\r\n\r\n## 📄 License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\n\r\n## 🆘 Support \u0026 Community\r\n\r\n- **Issues**: [GitHub Issues](https://github.com/HelpingAI/HelpingAI-js/issues)\r\n- **Documentation**: [HelpingAI Docs](https://helpingai.co/docs)\r\n- **Dashboard**: [HelpingAI Dashboard](https://helpingai.co/dashboard)\r\n- **Email**: varun@helpingai.co\r\n\r\n## 🚀 What's New in v1.1.0\r\n\r\n- **Cross-Platform Support**: Works in Node.js and browsers\r\n- **Updated Models**: Support for latest models (Helpingai3-raw, Dhanishtha-2.0-preview)\r\n- **Dhanishtha-2.0 Integration**: World's first intermediate thinking model with multi-phase reasoning\r\n- **HelpingAI3 Support**: Enhanced emotional intelligence with advanced contextual awareness\r\n- **OpenAI-Compatible Interface**: Familiar API design\r\n- **Enhanced Error Handling**: Comprehensive exception types\r\n- **Streaming Support**: Real-time response streaming\r\n- **Advanced Filtering**: Hide reasoning blocks with `hideThink` parameter\r\n- **Full TypeScript Support**: Complete type definitions\r\n\r\n---\r\n\r\n**Built with ❤️ by the HelpingAI Team**\r\n\r\n*Empowering AI with Emotional Intelligence*\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelpingai%2Fhelpingai-js-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhelpingai%2Fhelpingai-js-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelpingai%2Fhelpingai-js-sdk/lists"}