@elizaos/plugin-openrouter 2.0.0-beta.1 → 2.0.3-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @elizaos/plugin-openrouter
2
2
 
3
- This plugin provides integration with various models available through the OpenRouter API via the ElizaOS platform.
3
+ elizaOS plugin that routes text generation, image description, image generation, and text embedding through the [OpenRouter](https://openrouter.ai) API, giving Eliza agents access to hundreds of hosted models via a single API key.
4
4
 
5
5
  ## Usage
6
6
 
@@ -25,7 +25,7 @@ The plugin requires the OpenRouter API key and can be configured via environment
25
25
  "OPENROUTER_IMAGE_MODEL": "x-ai/grok-2-vision-1212", // Optional: Overrides default image model
26
26
  "OPENROUTER_IMAGE_GENERATION_MODEL": "google/gemini-2.5-flash-image-preview", // Optional: Overrides default image generation model
27
27
  "OPENROUTER_EMBEDDING_MODEL": "openai/text-embedding-3-small", // Optional: Overrides default embedding model
28
- "OPENROUTER_EMBEDDING_DIMENSIONS": "1536", // Optional: Sets embedding vector dimensions (256, 384, 512, 768, 1024, 1536, 2048, 3072)
28
+ "OPENROUTER_EMBEDDING_DIMENSIONS": "1536", // Optional: Sets embedding vector dimensions (384, 512, 768, 1024, 1536, 2048, 3072)
29
29
  "OPENROUTER_BROWSER_BASE_URL": "https://your-proxy.example.com/openrouter"
30
30
  // Fallbacks if specific OPENROUTER models are not set
31
31
  "SMALL_MODEL": "google/gemini-flash",
@@ -103,23 +103,31 @@ app.listen(3000);
103
103
  - `OPENROUTER_IMAGE_MODEL`: Specific model to use for `IMAGE_DESCRIPTION`. Overrides `IMAGE_MODEL` if set.
104
104
  - `OPENROUTER_IMAGE_GENERATION_MODEL`: Specific model to use for `IMAGE` generation. Overrides `IMAGE_GENERATION_MODEL` if set.
105
105
  - `OPENROUTER_EMBEDDING_MODEL`: Specific model to use for `TEXT_EMBEDDING`. Overrides `EMBEDDING_MODEL` if set.
106
- - `OPENROUTER_EMBEDDING_DIMENSIONS`: Number of dimensions for embedding vectors. Supported values: 256, 384, 512, 768, 1024, 1536, 2048, 3072. Defaults to 1536.
107
- - `OPENROUTER_AUTO_CLEANUP_IMAGES`: Whether to automatically delete generated images after 30 seconds (default: "false"). Set to "true" to enable auto-cleanup.
108
- - `SMALL_MODEL`: Fallback model for small tasks (default: "google/gemini-2.0-flash-001"). Used if `OPENROUTER_SMALL_MODEL` is not set.
109
- - `LARGE_MODEL`: Fallback model for large tasks (default: "openai/gpt-5.1-nano"). Used if `OPENROUTER_LARGE_MODEL` is not set.
106
+ - `OPENROUTER_TRANSCRIPTION_MODEL`: Specific model to use for `TRANSCRIPTION` (default: `openai/whisper-large-v3`). Overrides `TRANSCRIPTION_MODEL` if set.
107
+ - `OPENROUTER_EMBEDDING_DIMENSIONS`: Number of dimensions for embedding vectors. Supported values: 384, 512, 768, 1024, 1536, 2048, 3072. Defaults to 1536.
108
+ - `OPENROUTER_AUTO_CLEANUP_IMAGES`: Boolean flag for auto-cleanup of generated images, read by `shouldAutoCleanupImages()` in `utils/config.ts` (default: "false").
109
+ - `SMALL_MODEL`: Fallback model for small tasks (default: "google/gemini-2.5-flash-lite"). Used if `OPENROUTER_SMALL_MODEL` is not set.
110
+ - `LARGE_MODEL`: Fallback model for large tasks (default: "google/gemini-2.5-flash"). Used if `OPENROUTER_LARGE_MODEL` is not set.
110
111
  - `IMAGE_MODEL`: Fallback model for image analysis (default: "x-ai/grok-2-vision-1212"). Used if `OPENROUTER_IMAGE_MODEL` is not set.
111
112
  - `IMAGE_GENERATION_MODEL`: Fallback model for image generation (default: "google/gemini-2.5-flash-image-preview"). Used if `OPENROUTER_IMAGE_GENERATION_MODEL` is not set.
112
113
  - `EMBEDDING_MODEL`: Fallback model for text embeddings (default: "openai/text-embedding-3-small"). Used if `OPENROUTER_EMBEDDING_MODEL` is not set.
114
+ - `TRANSCRIPTION_MODEL`: Fallback model for audio transcription (default: "openai/whisper-large-v3"). Used if `OPENROUTER_TRANSCRIPTION_MODEL` is not set.
113
115
  - `EMBEDDING_DIMENSIONS`: Fallback dimension setting for embeddings (default: "1536"). Used if `OPENROUTER_EMBEDDING_DIMENSIONS` is not set.
114
116
 
115
117
  ## Provided Models
116
118
 
117
- The plugin currently provides these model types:
118
-
119
- - `TEXT_SMALL`: Optimized for fast, cost-effective text generation using the configured small model. Supports `tools`, `toolChoice`, and `responseSchema` for structured output via native tool calling.
120
- - `TEXT_LARGE`: For more complex text generation tasks requiring larger models, using the configured large model. Supports `tools`, `toolChoice`, and `responseSchema` for structured output via native tool calling.
121
- - `IMAGE_DESCRIPTION`: Analyzes images and provides descriptive text and titles, using the configured image model.
122
- - `IMAGE`: Generates images from text prompts using the configured image generation model (e.g., Gemini 2.5 Flash Image Preview).
123
- - `TEXT_EMBEDDING`: Generates vector embeddings for text input, supporting configurable dimensions from 256 to 3072, using the configured embedding model.
124
-
125
- _Note: Audio Transcription is not currently implemented in this specific OpenRouter plugin._
119
+ The plugin registers these model types:
120
+
121
+ - `TEXT_NANO`: Fastest/cheapest text generation; falls back to the small model when no nano override is set.
122
+ - `TEXT_SMALL`: Fast, cost-effective text generation (default: `google/gemini-2.5-flash-lite`). Supports `tools`, `toolChoice`, and `responseSchema`.
123
+ - `TEXT_MEDIUM`: Mid-tier text generation; falls back to the small model when no medium override is set.
124
+ - `TEXT_LARGE`: Complex text generation tasks (default: `google/gemini-2.5-flash`). Supports `tools`, `toolChoice`, and `responseSchema`.
125
+ - `TEXT_MEGA`: Largest text tasks; falls back to the large model when no mega override is set.
126
+ - `RESPONSE_HANDLER`: Should-respond decisions; falls back to the nano model.
127
+ - `ACTION_PLANNER`: Action planning; falls back to the medium model.
128
+ - `IMAGE_DESCRIPTION`: Analyzes images and provides descriptive text (default: `x-ai/grok-2-vision-1212`).
129
+ - `IMAGE`: Generates images from text prompts (default: `google/gemini-2.5-flash-image-preview`).
130
+ - `TEXT_EMBEDDING`: Vector embeddings with configurable dimensions (default: `openai/text-embedding-3-small`, 1536 dims).
131
+ - `TRANSCRIPTION`: Transcribes audio through OpenRouter's `/audio/transcriptions` endpoint (default: `openai/whisper-large-v3`).
132
+
133
+ Transcription inputs may be URL strings, `Buffer`, `Blob` / `File`, core `{ audioUrl, prompt? }`, or local `{ audio, model?, language?, temperature?, format?, mimeType? }` objects. The handler sends base64 `input_audio` JSON to OpenRouter and returns the transcript text.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elizaos/plugin-openrouter",
3
- "version": "2.0.0-beta.1",
3
+ "version": "2.0.3-beta.3",
4
4
  "type": "module",
5
5
  "main": "dist/node/index.node.js",
6
6
  "module": "dist/node/index.node.js",
@@ -28,9 +28,16 @@
28
28
  "default": "./dist/node/index.node.js"
29
29
  },
30
30
  "default": "./dist/node/index.node.js"
31
+ },
32
+ "./*.css": "./dist/*.css",
33
+ "./*": {
34
+ "types": "./dist/*.d.ts",
35
+ "import": "./dist/*.js",
36
+ "default": "./dist/*.js"
31
37
  }
32
38
  },
33
39
  "files": [
40
+ "registry-entry.json",
34
41
  "dist",
35
42
  "auto-enable.ts"
36
43
  ],
@@ -49,14 +56,13 @@
49
56
  },
50
57
  "sideEffects": false,
51
58
  "dependencies": {
52
- "@ai-sdk/openai": "^3.0.9",
53
- "@ai-sdk/ui-utils": "^1.2.8",
54
59
  "@openrouter/ai-sdk-provider": "^2.0.0",
55
60
  "ai": "^6.0.30"
56
61
  },
57
62
  "devDependencies": {
58
63
  "@biomejs/biome": "^2.4.14",
59
- "@elizaos/core": "2.0.0-beta.1",
64
+ "@elizaos/core": "2.0.3-beta.3",
65
+ "@elizaos/test-harness": "2.0.3-beta.3",
60
66
  "@types/bun": "^1.3.5",
61
67
  "@types/json-schema": "^7.0.15",
62
68
  "@types/node": "^25.0.3",
@@ -65,7 +71,7 @@
65
71
  "vitest": "^4.0.0"
66
72
  },
67
73
  "peerDependencies": {
68
- "@elizaos/core": "2.0.0-beta.1"
74
+ "@elizaos/core": "2.0.3-beta.3"
69
75
  },
70
76
  "scripts": {
71
77
  "dev": "bun --hot build.ts",
@@ -73,9 +79,10 @@
73
79
  "clean": "rm -rf dist .turbo .turbo-tsconfig.json tsconfig.tsbuildinfo",
74
80
  "format": "bunx @biomejs/biome format --write .",
75
81
  "format:check": "bunx @biomejs/biome format .",
76
- "typecheck": "tsc --noEmit --noCheck -p tsconfig.json",
77
- "test": "vitest run --config ./vitest.config.ts --passWithNoTests",
78
- "test:unit": "vitest run __tests__/ --config ./vitest.config.ts --passWithNoTests",
82
+ "typecheck": "tsgo --noEmit -p tsconfig.json",
83
+ "test": "vitest run --config ./vitest.config.ts",
84
+ "test:harness": "bunx vitest run --config vitest.harness.config.ts",
85
+ "test:unit": "vitest run __tests__/ --config ./vitest.config.ts",
79
86
  "test:watch": "vitest",
80
87
  "lint:check": "bunx @biomejs/biome check .",
81
88
  "build": "bun run build.ts",
@@ -116,7 +123,7 @@
116
123
  "type": "string",
117
124
  "description": "Overrides the default small language model used for text/object generation.",
118
125
  "required": false,
119
- "default": "google/gemini-2.0-flash-001",
126
+ "default": "google/gemini-2.5-flash-lite",
120
127
  "sensitive": false
121
128
  },
122
129
  "OPENROUTER_LARGE_MODEL": {
@@ -130,7 +137,7 @@
130
137
  "type": "string",
131
138
  "description": "General fallback environment variable for the small model name when OPENROUTER_SMALL_MODEL is not set.",
132
139
  "required": false,
133
- "default": "google/gemini-2.0-flash-001",
140
+ "default": "google/gemini-2.5-flash-lite",
134
141
  "sensitive": false
135
142
  },
136
143
  "LARGE_MODEL": {
@@ -177,7 +184,7 @@
177
184
  },
178
185
  "OPENROUTER_EMBEDDING_DIMENSIONS": {
179
186
  "type": "number",
180
- "description": "Number of dimensions for embedding vectors. Supported values: 256, 384, 512, 768, 1024, 1536, 2048, 3072.",
187
+ "description": "Number of dimensions for embedding vectors. Supported values: 384, 512, 768, 1024, 1536, 2048, 3072.",
181
188
  "required": false,
182
189
  "default": 1536,
183
190
  "sensitive": false
@@ -215,5 +222,6 @@
215
222
  "browser": "Browser-compatible build available via exports.browser",
216
223
  "node": "Node.js build available via exports.node"
217
224
  }
218
- }
225
+ },
226
+ "gitHead": "f54b0f4eaed317d59fa7dbcdce20f4cdb0734420"
219
227
  }
@@ -0,0 +1,188 @@
1
+ {
2
+ "id": "openrouter",
3
+ "name": "Openrouter",
4
+ "description": "OpenRouter provider for routing requests across many hosted models through one API.",
5
+ "npmName": "@elizaos/plugin-openrouter",
6
+ "version": "2.0.0-beta.0",
7
+ "source": "bundled",
8
+ "tags": ["ai-provider", "llm", "openrouter", "routing"],
9
+ "config": {
10
+ "OPENROUTER_API_KEY": {
11
+ "type": "secret",
12
+ "required": true,
13
+ "sensitive": true,
14
+ "label": "Api Key",
15
+ "help": "API key used by the OpenRouter plugin for authenticating requests.",
16
+ "advanced": false
17
+ },
18
+ "OPENROUTER_IMAGE_MODEL": {
19
+ "type": "string",
20
+ "required": false,
21
+ "sensitive": false,
22
+ "label": "Image Model",
23
+ "help": "Overrides the default image description model used by the OpenRouter plugin.",
24
+ "placeholder": "e.g., gpt-4o, claude-sonnet-4-20250514",
25
+ "advanced": false
26
+ },
27
+ "OPENROUTER_BASE_URL": {
28
+ "type": "url",
29
+ "required": false,
30
+ "sensitive": false,
31
+ "default": "https://openrouter.ai/api/v1",
32
+ "label": "Base Url",
33
+ "help": "Base URL for the OpenRouter API endpoints.",
34
+ "advanced": false
35
+ },
36
+ "OPENROUTER_BROWSER_BASE_URL": {
37
+ "type": "url",
38
+ "required": false,
39
+ "sensitive": false,
40
+ "label": "Browser Base Url",
41
+ "help": "Browser-only proxy endpoint base URL for OpenRouter requests (no secrets in the client).",
42
+ "advanced": false
43
+ },
44
+ "OPENROUTER_SMALL_MODEL": {
45
+ "type": "string",
46
+ "required": false,
47
+ "sensitive": false,
48
+ "default": "google/gemini-2.5-flash-lite",
49
+ "label": "Small Model",
50
+ "help": "Overrides the default small language model used for text/object generation.",
51
+ "placeholder": "e.g., gpt-4o, claude-sonnet-4-20250514",
52
+ "advanced": false
53
+ },
54
+ "OPENROUTER_LARGE_MODEL": {
55
+ "type": "string",
56
+ "required": false,
57
+ "sensitive": false,
58
+ "default": "google/gemini-2.5-flash",
59
+ "label": "Large Model",
60
+ "help": "Overrides the default large language model used for text/object generation.",
61
+ "placeholder": "e.g., gpt-4o, claude-sonnet-4-20250514",
62
+ "advanced": false
63
+ },
64
+ "SMALL_MODEL": {
65
+ "type": "string",
66
+ "required": false,
67
+ "sensitive": false,
68
+ "default": "google/gemini-2.5-flash-lite",
69
+ "label": "Model",
70
+ "help": "General fallback environment variable for the small model name when OPENROUTER_SMALL_MODEL is not set.",
71
+ "placeholder": "e.g., gpt-4o, claude-sonnet-4-20250514",
72
+ "advanced": false
73
+ },
74
+ "LARGE_MODEL": {
75
+ "type": "string",
76
+ "required": false,
77
+ "sensitive": false,
78
+ "default": "google/gemini-2.5-flash",
79
+ "label": "Model",
80
+ "help": "General fallback environment variable for the large model name when OPENROUTER_LARGE_MODEL is not set.",
81
+ "placeholder": "e.g., gpt-4o, claude-sonnet-4-20250514",
82
+ "advanced": false
83
+ },
84
+ "IMAGE_MODEL": {
85
+ "type": "string",
86
+ "required": false,
87
+ "sensitive": false,
88
+ "default": "x-ai/grok-2-vision-1212",
89
+ "label": "Model",
90
+ "help": "General fallback environment variable for the image model name when OPENROUTER_IMAGE_MODEL is not set.",
91
+ "placeholder": "e.g., gpt-4o, claude-sonnet-4-20250514",
92
+ "advanced": false
93
+ },
94
+ "OPENROUTER_IMAGE_GENERATION_MODEL": {
95
+ "type": "string",
96
+ "required": false,
97
+ "sensitive": false,
98
+ "default": "google/gemini-2.5-flash-image-preview",
99
+ "label": "Image Generation Model",
100
+ "help": "Overrides the default image generation model used by the OpenRouter plugin.",
101
+ "placeholder": "e.g., gpt-4o, claude-sonnet-4-20250514",
102
+ "advanced": false
103
+ },
104
+ "IMAGE_GENERATION_MODEL": {
105
+ "type": "string",
106
+ "required": false,
107
+ "sensitive": false,
108
+ "default": "google/gemini-2.5-flash-image-preview",
109
+ "label": "Generation Model",
110
+ "help": "General fallback environment variable for the image generation model name when OPENROUTER_IMAGE_GENERATION_MODEL is not set.",
111
+ "placeholder": "e.g., gpt-4o, claude-sonnet-4-20250514",
112
+ "advanced": false
113
+ },
114
+ "OPENROUTER_EMBEDDING_MODEL": {
115
+ "type": "string",
116
+ "required": false,
117
+ "sensitive": false,
118
+ "default": "openai/text-embedding-3-small",
119
+ "label": "Embedding Model",
120
+ "help": "Overrides the default text embedding model used by the OpenRouter plugin.",
121
+ "placeholder": "e.g., text-embedding-3-small",
122
+ "advanced": false
123
+ },
124
+ "EMBEDDING_MODEL": {
125
+ "type": "string",
126
+ "required": false,
127
+ "sensitive": false,
128
+ "default": "openai/text-embedding-3-small",
129
+ "label": "Model",
130
+ "help": "General fallback environment variable for the embedding model name when OPENROUTER_EMBEDDING_MODEL is not set.",
131
+ "placeholder": "e.g., text-embedding-3-small",
132
+ "advanced": false
133
+ },
134
+ "OPENROUTER_EMBEDDING_DIMENSIONS": {
135
+ "type": "number",
136
+ "required": false,
137
+ "sensitive": false,
138
+ "default": "1536",
139
+ "label": "Embedding Dimensions",
140
+ "help": "Number of dimensions for embedding vectors. Supported values: 256, 384, 512, 768, 1024, 1536, 2048, 3072.",
141
+ "advanced": false
142
+ },
143
+ "EMBEDDING_DIMENSIONS": {
144
+ "type": "number",
145
+ "required": false,
146
+ "sensitive": false,
147
+ "default": "1536",
148
+ "label": "Dimensions",
149
+ "help": "General fallback environment variable for the embedding dimensions when OPENROUTER_EMBEDDING_DIMENSIONS is not set.",
150
+ "advanced": false
151
+ },
152
+ "OPENROUTER_AUTO_CLEANUP_IMAGES": {
153
+ "type": "boolean",
154
+ "required": false,
155
+ "sensitive": false,
156
+ "default": "False",
157
+ "label": "Auto Cleanup Images",
158
+ "help": "Whether to automatically cleanup generated images after a short delay.",
159
+ "advanced": false
160
+ },
161
+ "OPENROUTER_TOOL_EXECUTION_MAX_STEPS": {
162
+ "type": "number",
163
+ "required": false,
164
+ "sensitive": false,
165
+ "default": "15",
166
+ "label": "Tool Execution Max Steps",
167
+ "help": "Maximum number of steps for multi-step tool execution. Allows the AI to generate descriptive text after calling tools in AI SDK v5.",
168
+ "advanced": false
169
+ }
170
+ },
171
+ "render": {
172
+ "visible": true,
173
+ "pinTo": [],
174
+ "style": "card",
175
+ "icon": "Shuffle",
176
+ "group": "ai-provider",
177
+ "groupOrder": 0,
178
+ "actions": ["enable", "configure"]
179
+ },
180
+ "resources": {
181
+ "homepage": "https://github.com/elizaos-plugins/plugin-openrouter#readme",
182
+ "repository": "https://github.com/elizaos-plugins/plugin-openrouter",
183
+ "setupGuideUrl": "https://docs.eliza.ai/plugin-setup-guide#openrouter"
184
+ },
185
+ "dependsOn": [],
186
+ "kind": "plugin",
187
+ "subtype": "ai-provider"
188
+ }