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

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.2",
4
4
  "type": "module",
5
5
  "main": "dist/node/index.node.js",
6
6
  "module": "dist/node/index.node.js",
@@ -28,6 +28,12 @@
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": [
@@ -49,14 +55,12 @@
49
55
  },
50
56
  "sideEffects": false,
51
57
  "dependencies": {
52
- "@ai-sdk/openai": "^3.0.9",
53
- "@ai-sdk/ui-utils": "^1.2.8",
54
58
  "@openrouter/ai-sdk-provider": "^2.0.0",
55
59
  "ai": "^6.0.30"
56
60
  },
57
61
  "devDependencies": {
58
62
  "@biomejs/biome": "^2.4.14",
59
- "@elizaos/core": "2.0.0-beta.1",
63
+ "@elizaos/core": "2.0.3-beta.2",
60
64
  "@types/bun": "^1.3.5",
61
65
  "@types/json-schema": "^7.0.15",
62
66
  "@types/node": "^25.0.3",
@@ -65,7 +69,7 @@
65
69
  "vitest": "^4.0.0"
66
70
  },
67
71
  "peerDependencies": {
68
- "@elizaos/core": "2.0.0-beta.1"
72
+ "@elizaos/core": "2.0.3-beta.2"
69
73
  },
70
74
  "scripts": {
71
75
  "dev": "bun --hot build.ts",
@@ -74,8 +78,8 @@
74
78
  "format": "bunx @biomejs/biome format --write .",
75
79
  "format:check": "bunx @biomejs/biome format .",
76
80
  "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",
81
+ "test": "vitest run --config ./vitest.config.ts",
82
+ "test:unit": "vitest run __tests__/ --config ./vitest.config.ts",
79
83
  "test:watch": "vitest",
80
84
  "lint:check": "bunx @biomejs/biome check .",
81
85
  "build": "bun run build.ts",
@@ -116,7 +120,7 @@
116
120
  "type": "string",
117
121
  "description": "Overrides the default small language model used for text/object generation.",
118
122
  "required": false,
119
- "default": "google/gemini-2.0-flash-001",
123
+ "default": "google/gemini-2.5-flash-lite",
120
124
  "sensitive": false
121
125
  },
122
126
  "OPENROUTER_LARGE_MODEL": {
@@ -130,7 +134,7 @@
130
134
  "type": "string",
131
135
  "description": "General fallback environment variable for the small model name when OPENROUTER_SMALL_MODEL is not set.",
132
136
  "required": false,
133
- "default": "google/gemini-2.0-flash-001",
137
+ "default": "google/gemini-2.5-flash-lite",
134
138
  "sensitive": false
135
139
  },
136
140
  "LARGE_MODEL": {
@@ -177,7 +181,7 @@
177
181
  },
178
182
  "OPENROUTER_EMBEDDING_DIMENSIONS": {
179
183
  "type": "number",
180
- "description": "Number of dimensions for embedding vectors. Supported values: 256, 384, 512, 768, 1024, 1536, 2048, 3072.",
184
+ "description": "Number of dimensions for embedding vectors. Supported values: 384, 512, 768, 1024, 1536, 2048, 3072.",
181
185
  "required": false,
182
186
  "default": 1536,
183
187
  "sensitive": false
@@ -215,5 +219,6 @@
215
219
  "browser": "Browser-compatible build available via exports.browser",
216
220
  "node": "Node.js build available via exports.node"
217
221
  }
218
- }
222
+ },
223
+ "gitHead": "82fe0f44215954c2417328203f5bd6510985c1fc"
219
224
  }