Skip to content

Conversation

frauniki
Copy link
Contributor

Summary

This PR introduces OpenRouter as a new AI provider, granting access to over 300 diverse AI models through a unified API. This integration significantly expands the range of models available for generating commit messages.

Key Changes

  • Implemented OpenRouter Engine (src/engine/openrouter.ts)

    • Created a new OpenRouterEngine class to communicate with the OpenRouter API.
    • It handles authentication using an API key and sends requests with the appropriate headers (HTTP-Referer, X-Title).
    • Implemented error handling, which now clearly displays error messages from OpenRouter, especially for authentication failures (401).
  • Updated Configuration (src/commands/config.ts)

    • Added OPENROUTER to the OCO_AI_PROVIDER_ENUM, making it a selectable provider.
    • Included a comprehensive list of available models from OpenRouter in MODEL_LIST, with openai/gpt-4o-mini set as the default.
    • Updated configValidators to recognize openrouter as a valid provider.
  • Updated Engine Selection Logic (src/utils/engine.ts)

    • Modified the getEngine factory function to return an instance of OpenRouterEngine when the openrouter provider is specified.

Background

The goal is to provide users with access to a wider array of models beyond the currently supported AI providers, allowing them to choose the one that best fits their needs. The integration of OpenRouter significantly enhances the flexibility and extensibility of this tool.

Add OpenRouterEngine class and integrate it into the configuration
system. OpenRouter provides access to 300+ AI models through a
unified API, expanding model availability for commit message
generation beyond existing providers.
@di-sukharev di-sukharev merged commit 15ac076 into di-sukharev:master Jun 15, 2025
4 checks passed
@di-sukharev
Copy link
Owner

thank you @frauniki 🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: openrouter request
2 participants