{"_id":"@djanghao/provider-hub","name":"@djanghao/provider-hub","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@djanghao/provider-hub","version":"0.1.0","description":"Unified LLM provider interface for React applications","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc","dev":"tsc --watch","test":"jest","prepublishOnly":"npm run build"},"keywords":["llm","openai","deepseek","qwen","doubao","react","ai","multi-agent"],"author":{"name":"Djanghao"},"license":"MIT","dependencies":{"dotenv":"^17.2.2","node-fetch":"^3.3.0","openai":"^4.0.0"},"devDependencies":{"@types/jest":"^29.0.0","@types/node":"^20.0.0","@types/node-fetch":"^2.6.0","jest":"^29.0.0","ts-jest":"^29.0.0","typescript":"^5.0.0"},"peerDependencies":{"react":">=16.8.0"},"engines":{"node":">=16.0.0"},"_id":"@djanghao/provider-hub@0.1.0","gitHead":"f3781f50ed97339f491c83c503dfe64d67f677f3","_nodeVersion":"22.17.0","_npmVersion":"11.5.2","dist":{"integrity":"sha512-ml5MMa66wAKywnoSiNDrpYHSHUQPbY6IOtrmqToMubderGW5UFyh9fCbJ1N0OkqXNQyzIx9e/HGA5y6XRTOjQg==","shasum":"7e85d6ef5e588872f5b6f93c72ae4cf4411466e6","tarball":"https://registry.npmjs.org/@djanghao/provider-hub/-/provider-hub-0.1.0.tgz","fileCount":27,"unpackedSize":40599,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDMhz91eKMdxrHpnCZ3eumqUGjvDn+tmQ3Vu0PAEtZujQIgag4TuojzBUqe+M0J+bienmcvNcYdixKs2F2LZDBzTAs="}]},"_npmUser":{"name":"djanghao","email":"hstnzhang@gmail.com"},"directories":{},"maintainers":[{"name":"djanghao","email":"hstnzhang@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/provider-hub_0.1.0_1757709185945_0.8761423628534626"},"_hasShrinkwrap":false}},"time":{"created":"2025-09-12T20:33:05.841Z","0.1.0":"2025-09-12T20:33:06.132Z","modified":"2025-09-12T20:33:06.382Z"},"maintainers":[{"name":"djanghao","email":"hstnzhang@gmail.com"}],"description":"Unified LLM provider interface for React applications","keywords":["llm","openai","deepseek","qwen","doubao","react","ai","multi-agent"],"author":{"name":"Djanghao"},"license":"MIT","readme":"# Provider Hub JS\n\nUnified LLM provider interface for React applications and Node.js projects.\n\n## Installation\n\n```bash\nnpm install @djanghao/provider-hub\n```\n\n## Quick Start\n\n### 1. Environment Setup\n\nCreate a `.env` file in your project root:\n\n```bash\nOPENAI_API_KEY=your-openai-api-key\nDEEPSEEK_API_KEY=your-deepseek-api-key  \nDASHSCOPE_API_KEY=your-qwen-api-key\nARK_API_KEY=your-doubao-api-key\n```\n\n### 2. Basic Usage\n\n```typescript\nimport { LLM } from '@djanghao/provider-hub';\n\n// Simple text chat\nconst llm = new LLM({\n  model: 'doubao-seed-1-6-250615',\n  temperature: 0.7,\n  topP: 0.9,\n  maxTokens: 100,\n  timeout: 30\n});\n\nconst response = await llm.chat('Hello, how are you?');\nconsole.log(response.content);\n```\n\n## Core Features\n\n### 📝 Text Processing\n\nAll models support standard text chat functionality with configurable parameters.\n\n```typescript\nimport { LLM } from '@djanghao/provider-hub';\n\nconst llm = new LLM({\n  model: 'qwen-plus',\n  temperature: 0.7,\n  topP: 0.9,\n  maxTokens: 100,\n  timeout: 30\n});\n\nconst response = await llm.chat('Explain quantum computing');\nconsole.log(response.content);\n```\n\n### 🖼️ Vision Processing\n\nProcess both local images and URLs with vision-capable models.\n\n```typescript\nimport { LLM, ChatMessage, prepareImageContent } from '@djanghao/provider-hub';\n\n// Vision model setup\nconst visionLlm = new LLM({\n  model: 'qwen-vl-plus',\n  temperature: 0.5,\n  maxTokens: 150,\n  timeout: 60\n});\n\n// Process local image\nconst imageContent = prepareImageContent('path/to/your/image.jpg');\n\n// Or process image URL\n// const imageContent = prepareImageContent('https://example.com/image.jpg');\n\nconst messages: ChatMessage[] = [{\n  role: 'user',\n  content: [\n    { type: 'text', text: 'What do you see in this image?' },\n    imageContent\n  ]\n}];\n\nconst response = await visionLlm.chat(messages);\nconsole.log(response.content);\n```\n\n### 🧠 Reasoning Mode\n\nEnable step-by-step reasoning for complex problem solving.\n\n```typescript\nimport { LLM } from '@djanghao/provider-hub';\n\n// DeepSeek reasoning\nconst deepseekReasoning = new LLM({\n  model: 'deepseek-reasoner',\n  thinking: true,\n  temperature: 0.3,\n  maxTokens: 200,\n  timeout: 60\n});\n\n// Qwen reasoning  \nconst qwenReasoning = new LLM({\n  model: 'qwen3-max-preview',\n  thinking: true,\n  temperature: 0.5,\n  maxTokens: 180,\n  timeout: 50\n});\n\n// Doubao reasoning\nconst doubaoReasoning = new LLM({\n  model: 'doubao-seed-1-6-250615',\n  thinking: { type: 'enabled' },\n  temperature: 0.4,\n  maxTokens: 200,\n  timeout: 45\n});\n\nconst response = await qwenReasoning.chat('Calculate 15 * 23 step by step');\nconsole.log(response.content);\n```\n\n### ⚡ OpenAI GPT-5 Reasoning Effort\n\nGPT-5 models support adjustable reasoning intensity through the chat method.\n\n```typescript\nimport { LLM } from '@djanghao/provider-hub';\n\nconst gpt5Reasoning = new LLM({\n  model: 'gpt-5',\n  maxTokens: 200,\n  timeout: 40\n});\n\nconst response = await gpt5Reasoning.chat(\n  'Solve this complex problem step by step',\n  { reasoningEffort: 'high' } // Options: 'low', 'medium', 'high'\n);\nconsole.log(response.content);\n```\n\n## API Reference\n\n### LLM Class\n\nMain interface for all LLM providers.\n\n```typescript\nconst llm = new LLM({\n  model: 'model-name',\n  temperature: 0.7,\n  maxTokens: 100,\n  // ... other parameters\n});\n```\n\n**Constructor Options:**\n\n| Parameter | Type | Description | Range/Options |\n|-----------|------|-------------|---------------|\n| `model` | string | Model identifier | See Supported Models |\n| `temperature` | number | Controls randomness | 0.0-2.0 (0=deterministic, 2=very creative) |\n| `topP` | number | Nucleus sampling threshold | 0.0-1.0 |\n| `maxTokens` | number | Maximum response length | Positive integer |\n| `timeout` | number | Request timeout | Seconds (default: 30) |\n| `thinking` | boolean/object | Enable reasoning mode | Provider-specific format |\n\n**Methods:**\n- `chat(messages, options?)` → `Promise<ChatResponse>`: Send messages and get response\n  - `reasoningEffort` (OpenAI GPT-5 only): 'low', 'medium', 'high'\n\n### Types\n\n```typescript\ninterface ChatMessage {\n  role: 'user' | 'assistant' | 'system';\n  content: string | Array<{\n    type: 'text' | 'image_url';\n    text?: string;\n    image_url?: { url: string };\n  }>;\n}\n\ninterface ChatResponse {\n  content: string;\n  model: string;\n  usage?: {\n    promptTokens: number;\n    completionTokens: number;\n    totalTokens: number;\n  };\n  finishReason?: string;\n}\n```\n\n### Utility Functions\n\n```typescript\nimport { prepareImageContent, testConnection } from '@djanghao/provider-hub';\n\n// Prepare image content for vision models\nconst imageContent = prepareImageContent('./image.jpg');\nconst urlImageContent = prepareImageContent('https://example.com/image.jpg');\n\n// Test connectivity\nawait testConnection();\n```\n\n## Supported Models\n\n### OpenAI\n- `gpt-5`\n- `gpt-5-mini`\n- `gpt-5-nano`\n- `gpt-4.1`\n\n### DeepSeek  \n- `deepseek-chat`\n- `deepseek-reasoner`\n\n### Qwen\n- `qwen3-max-preview`\n- `qwen-plus`\n- `qwen-flash`\n- `qwen3-coder-plus`\n- `qwen3-coder-flash`\n- `qwen-vl-max`\n- `qwen-vl-plus`\n\n### Doubao\n- `doubao-seed-1-6-250615`\n- `doubao-seed-1-6-vision-250815`\n- `doubao-seed-1-6-flash-250828`\n\n## Testing\n\n### Quick Test\n\nTest connectivity to available models:\n\n```typescript\nimport { testConnection } from '@djanghao/provider-hub';\n\nawait testConnection();\n```\n\n## License\n\nMIT License - see LICENSE file for details.","readmeFilename":"README.md","_rev":"1-e1058f71fd2824bd730dbd919f254c22"}