Skip to main content

OpenRouter AI Provider Plugin

The OpenRouter plugin is the default AI provider for Ever Works. It connects to the OpenRouter API, which aggregates hundreds of AI models from multiple providers (OpenAI, Anthropic, Google, Meta, and more) behind a single API endpoint. This gives users access to the broadest model selection through one API key.

Source: packages/plugins/openrouter/src/openrouter.plugin.ts

Overview

PropertyValue
Plugin IDopenrouter
Package@ever-works/openrouter-plugin
Categoryai-provider
Capabilitiesai-provider
Version1.0.0
Configuration Modehybrid
Provider Typeopenrouter
Auto-enableYes
Built-inYes
System PluginYes
Default Forai-provider
Visibilitypublic

OpenRouter is unique among AI provider plugins because it is a system plugin with autoEnable: true and defaultForCapabilities: ['ai-provider']. This means it is automatically enabled and selected as the default AI provider for new works.

Architecture

OpenRouter's API is OpenAI-compatible, so the plugin uses the same LangChain OpenAI provider with baseURL set to https://openrouter.ai/api/v1.

Configuration

Settings Schema

SettingTypeRequiredDefaultScopeWidgetDescription
apiKeystringYes--user--OpenRouter API key. Secret. Env: PLUGIN_OPENROUTER_API_KEY
defaultModelstringYesopenai/gpt-5.1globalmodel-selectDefault model for all AI tasks.
simpleModelstringNoopenai/gpt-5-nanoglobalmodel-selectModel for tags, descriptions, classifications.
mediumModelstringNoopenai/gpt-4oglobalmodel-selectModel for listings, summaries, reformatting.
complexModelstringNoopenai/gpt-5.1globalmodel-selectModel for full page generation, multi-step analysis.
temperaturenumberNo0.7----Sampling temperature (0--2). Hidden.
maxTokensnumberNo4096----Max tokens per response. Hidden.
baseUrlstringNohttps://openrouter.ai/api/v1----API endpoint. Hidden.

Model Naming Convention

OpenRouter uses a provider/model naming convention. Model IDs include the provider prefix:

ProviderExample Model IDs
OpenAIopenai/gpt-5.1, openai/gpt-4o, openai/gpt-5-nano
Anthropicanthropic/claude-sonnet-4, anthropic/claude-haiku-3.5
Googlegoogle/gemini-2.5-pro, google/gemini-2.5-flash
Metameta-llama/llama-4-scout, meta-llama/llama-4-maverick

Model Tiers

Users can mix and match models from different providers across tiers. For example, using anthropic/claude-haiku-3.5 for simple tasks and google/gemini-2.5-pro for complex tasks.

Environment Variables

VariableDescription
PLUGIN_OPENROUTER_API_KEYOpenRouter API key
PLUGIN_OPENROUTER_DEFAULT_MODELDefault model ID
PLUGIN_OPENROUTER_SIMPLE_MODELSimple tier model ID
PLUGIN_OPENROUTER_MEDIUM_MODELMedium tier model ID
PLUGIN_OPENROUTER_COMPLEX_MODELComplex tier model ID
PLUGIN_OPENROUTER_BASE_URLCustom API endpoint

Capabilities

CapabilitySupported
Structured OutputYes
StreamingYes
Tool CallingYes
VisionNo (depends on selected model)
Max Context Length128,000 tokens
note

Vision support depends on the specific model selected. While the plugin reports supportsVision: false at the plugin level, individual models accessed through OpenRouter (such as GPT-4o or Claude Sonnet) do support vision. The capability is determined at the model level, not the provider level.

Configuration Mode: Hybrid

OpenRouter uses hybrid configuration mode, which offers the most flexibility:

  • Admin-managed: Set PLUGIN_OPENROUTER_API_KEY as an environment variable. All users share this key and billing is centralized.
  • User-managed: Each user enters their own API key. Billing is distributed to individual OpenRouter accounts.
  • Override: If both admin and user keys exist, the user's key takes precedence (per the settings resolution hierarchy).

System Plugin Behavior

As a system plugin, OpenRouter has special behavior:

  1. Auto-enabled: Automatically activated when the platform starts
  2. Default provider: Registered as the default for ai-provider capability
  3. Fallback: Other AI providers (OpenAI, Anthropic, etc.) are optional alternatives
  4. Cannot be removed: System plugins cannot be uninstalled, only disabled

Cost Optimization Strategy

Because OpenRouter provides access to models at different price points, the tiered model system enables cost optimization:

TierRecommended StrategyExample Models
SimpleUse the cheapest/fastest modelopenai/gpt-5-nano, google/gemini-2.0-flash
StandardBalance cost and qualityopenai/gpt-4o, anthropic/claude-haiku-3.5
ComplexUse the highest quality modelopenai/gpt-5.1, anthropic/claude-sonnet-4

Lifecycle

Dependencies

PackageVersionPurpose
@ever-works/pluginworkspacePlugin contracts and base classes
@langchain/openai^0.6.17LangChain OpenAI-compatible provider
@langchain/core^0.3.80LangChain core abstractions

Getting Started

  1. Create an account at openrouter.ai
  2. Generate an API key from the OpenRouter dashboard
  3. Enter the key in the OpenRouter API Key field in plugin settings
  4. Select your preferred models for each task complexity level
  5. OpenRouter is enabled by default -- no additional activation needed