Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,261 changes: 1,261 additions & 0 deletions packages/plugins/official/openrouter-gateway/__tests__/index.test.ts

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"rootDir": "../..",
"baseUrl": "..",
"lib": ["ES2022", "DOM"],
"types": ["jest", "node"],
"paths": {
"@agentbase/plugin-sdk": ["../../../sdk/src/index.ts"]
}
},
"include": ["../src/**/*", "./**/*"],
"exclude": ["node_modules", "dist"]
}
57 changes: 57 additions & 0 deletions packages/plugins/official/openrouter-gateway/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"name": "openrouter-gateway",
"version": "1.0.0",
"description": "Route all AI model calls through OpenRouter — one key for 200+ models with automatic fallbacks and cost tracking.",
"author": "Agentbase",
"license": "GPL-3.0",
"main": "dist/index.js",
"agentbase": {
"type": "plugin",
"apiVersion": "1"
},
"hooks": ["app:init", "conversation:beforeMessage"],
"endpoints": [
{ "method": "GET", "path": "/models" },
{ "method": "GET", "path": "/usage" },
{ "method": "PUT", "path": "/config" },
{ "method": "GET", "path": "/config" },
{ "method": "POST", "path": "/test" }
],
"settings": [
{
"key": "openRouterApiKey",
"type": "string",
"label": "OpenRouter API Key",
"encrypted": true
},
{
"key": "defaultModel",
"type": "string",
"label": "Default Model (e.g. openai/gpt-4o)",
"default": "openai/gpt-4o"
},
{
"key": "fallbackModels",
"type": "string",
"label": "Fallback Models (comma-separated)",
"default": "openai/gpt-4o-mini,anthropic/claude-3-5-haiku"
},
{
"key": "maxCostPerRequest",
"type": "number",
"label": "Max Cost Per Request (USD)",
"default": 0.5
},
{
"key": "siteUrl",
"type": "string",
"label": "Site URL (sent as HTTP-Referer to OpenRouter)"
},
{
"key": "appName",
"type": "string",
"label": "App Name (sent as X-Title to OpenRouter)"
}
],
"permissions": ["network:external", "db:readwrite"]
}
35 changes: 35 additions & 0 deletions packages/plugins/official/openrouter-gateway/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "@agentbase/plugin-openrouter-gateway",
"version": "1.0.0",
"description": "Route all AI model calls through OpenRouter — one key for 200+ models with automatic fallbacks and cost tracking.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsc",
"test": "jest",
"lint": "eslint src --ext .ts"
},
"dependencies": {
"@agentbase/plugin-sdk": "workspace:*"
},
"devDependencies": {
"@types/jest": "^29.5.0",
"@types/node": "^20.0.0",
"jest": "^29.5.0",
"ts-jest": "^29.1.0",
"typescript": "^5.0.0"
},
"jest": {
"preset": "ts-jest",
"testEnvironment": "node",
"roots": [
"<rootDir>/__tests__"
],
"globals": {
"ts-jest": {
"tsconfig": "__tests__/tsconfig.json"
}
}
},
"license": "GPL-3.0"
}
Loading
Loading