Skip to content

feat(openrouter): add open router to model block#1172

Merged
waleedlatif1 merged 3 commits intostagingfrom
feat/open-router
Aug 29, 2025
Merged

feat(openrouter): add open router to model block#1172
waleedlatif1 merged 3 commits intostagingfrom
feat/open-router

Conversation

@icecrasher321
Copy link
Collaborator

@icecrasher321 icecrasher321 commented Aug 29, 2025

Summary

added openrouter models, dynamically fetch list of models and specify capabilities.

Type of Change

  • New feature

Testing

Tested many of the new models manually, added unit tests for model capabilities at the provider level.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Aug 29, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
sim Ready Ready Preview Comment Aug 29, 2025 1:51am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Aug 29, 2025 1:51am

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Summary

This PR adds OpenRouter as a new AI model provider to the Sim platform, enabling unified access to multiple AI models through OpenRouter's API gateway. The implementation follows the established provider pattern used by other providers like Ollama and OpenAI.

The changes introduce several key components:

  • API Integration: A new /api/providers/openrouter/models endpoint that fetches available models from OpenRouter's public API, applies deduplication, and prefixes model IDs with openrouter/
  • State Management: A new Zustand store (stores/openrouter/store.ts) that manages OpenRouter models with loading states, following the same pattern as the Ollama store
  • Provider Configuration: Updates to the provider system including model definitions, update functions, and integration with the existing provider utilities
  • UI Integration: Updates to the agent block to include OpenRouter models in the model selection dropdown alongside existing Ollama and base models
  • Provider Implementation: A complete provider implementation that reuses the OpenAI client with OpenRouter's base URL, supporting streaming responses, tool calls, and comprehensive error handling

The integration maintains consistency with the existing codebase architecture by using dynamic model fetching (similar to Ollama), proper state management patterns, and following the established provider interface. OpenRouter models are fetched at runtime and automatically integrated into the UI, ensuring users have access to the latest available models without manual updates.

PR Description Notes:

  • The PR description is incomplete with "IN PROG" in the summary and unchecked checkboxes
  • Missing issue reference number
  • No testing information provided
  • Type of change not selected

Confidence score: 3/5

  • This PR requires careful review due to several type safety concerns and incomplete documentation
  • Score lowered due to extensive use of any types, @ts-ignore directive, and missing model validation in the OpenRouter provider implementation
  • Pay close attention to apps/sim/providers/openrouter/index.ts for type safety issues and error handling patterns

Context used:

Context - Avoid using type assertions to 'any' in TypeScript. Instead, ensure proper type definitions are used to maintain type safety. (link)

7 files reviewed, 4 comments

Edit Code Review Bot Settings | Greptile

@vercel vercel bot temporarily deployed to Preview – docs August 29, 2025 01:46 Inactive
@waleedlatif1 waleedlatif1 merged commit 7d62c20 into staging Aug 29, 2025
3 of 4 checks passed
@waleedlatif1 waleedlatif1 deleted the feat/open-router branch August 29, 2025 01:47
arenadeveloper02 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Sep 19, 2025
* feat(openrouter): add open router to model block

* improvement(openrouter): streaming fix, temperature fix

* pr comments

---------

Co-authored-by: waleedlatif1 <walif6@gmail.com>
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.

2 participants