feat: Add OpenRouter API support for cloud-based AI models#43
Open
konard wants to merge 3 commits intoivansglazunov:mainfrom
Open
feat: Add OpenRouter API support for cloud-based AI models#43konard wants to merge 3 commits intoivansglazunov:mainfrom
konard wants to merge 3 commits intoivansglazunov:mainfrom
Conversation
Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: undefined
|
@konard is attempting to deploy a commit to the ivansglazunov's projects Team on Vercel. A member of the Team first needs to authorize it. |
Add comprehensive exports to lib/server.ts for the complete AI module,
enabling public access to OpenRouter and other AI providers.
Exported components:
- Core: AI, Dialog, DialogParser, Tool, Tooler
- Providers: OllamaProvider, OpenRouterProvider, ApiRouteProvider
- Tools: ExecJSTool, ExecTsxTool, TerminalTool
- Utilities: createSystemPrompt, printConsole, terminal/telegram helpers
- Handlers: api-dialog
This allows applications to import and use the AI functionality:
```typescript
import { Dialog, OpenRouterProvider } from 'hasyx/lib/server';
```
Part of implementing OpenRouter API support for issue ivansglazunov#22.
Related to issue ivansglazunov#19 (AI module umbrella).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Remove CLAUDE.md that was accidentally included in the initial commit. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Author
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 📎 Log file uploaded as GitHub Gist (391KB) Now working session is ended, feel free to review and add any feedback on the solution draft. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements OpenRouter API support for Hasyx, enabling access to a wide variety of cloud-based AI models from different providers (Google, Anthropic, Mistral AI, etc.) through a single unified API.
Closes #22
Problem
Issue #22 requested OpenRouter API support as part of the broader AI integration (issue #19). The OpenRouter provider implementation was already present in the codebase but was not exported from the main library, making it impossible for applications to import and use this functionality.
Solution
Added comprehensive exports to
lib/server.tsfor the complete AI module, enabling public access to OpenRouter and other AI providers.Changes
AI Module Exports (
lib/server.ts):AI,Dialog,DialogParser,Tool,ToolerOllamaProvider,OpenRouterProvider,ApiRouteProviderExecJSTool,ExecTsxTool,TerminalToolcreateSystemPrompt,printConsole, terminal/telegram helpersapi-dialogCleanup:
CLAUDE.mdtemporary fileImplementation Details
OpenRouter Provider Features
The OpenRouter provider (
lib/ai/providers/openrouter.ts) includes:deepseek/deepseek-chat-v3-0324:free)CLI Integration
The
askcommand (lib/ask.ts) already supports OpenRouter:Programmatic Usage
Applications can now import and use the AI module:
Testing
The OpenRouter provider includes comprehensive tests:
Test file:
lib/ai/providers/openrouter.test.tsDocumentation
Complete documentation is available:
Configuration
To use OpenRouter, configure via
npx hasyx config:npx hasyx configOPENROUTER_API_KEYwith your OpenRouter API key.envfile is auto-generated (do not edit manually)Impact
This change enables:
Related Issues
🤖 Generated with Claude Code