Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
22 changes: 22 additions & 0 deletions plugins/OpenRouter/v1/configValidation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"steps": [
{
"displayName": "Authenticate",
"dataStream": {
"name": "credits"
},
"required": true,
"success": "Connected to OpenRouter.",
"error": "Could not authenticate. Check that the key is valid, enabled, and has not expired."
},
{
"displayName": "Check management access",
"dataStream": {
"name": "workspaces"
},
"required": false,
"success": "Management key detected. All data streams are available.",
"error": "Could not read workspaces. Workspaces, API keys, usage, and performance need a management key; everything else still works."
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}
]
}
30 changes: 30 additions & 0 deletions plugins/OpenRouter/v1/custom_types.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[
{
"name": "Model",
"sourceType": "Model",
"icon": "brain",
"singular": "Model",
"plural": "Models"
},
{
"name": "Provider",
"sourceType": "Provider",
"icon": "server",
"singular": "Provider",
"plural": "Providers"
},
{
"name": "Workspace",
"sourceType": "Workspace",
"icon": "layer-group",
"singular": "Workspace",
"plural": "Workspaces"
},
{
"name": "API Key",
"sourceType": "API Key",
"icon": "key",
"singular": "API Key",
"plural": "API Keys"
}
]
105 changes: 105 additions & 0 deletions plugins/OpenRouter/v1/dataStreams/apiKeys.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{
"name": "apiKeys",
"displayName": "API Keys",
"description": "API keys in a workspace, with spend and limits in USD (requires a management key)",
"tags": ["API Keys", "Cost"],
"baseDataSourceName": "httpRequestScopedSingle",
"config": {
"httpMethod": "get",
"endpointPath": "keys",
"paging": {
"mode": "offset",
"offset": {
"mode": "row",
"rowCountIn": { "realm": "payloadArraySize", "path": "data" },
"base": 0
},
"out": { "realm": "queryArg", "path": "offset" }
},
"getArgs": [
{ "key": "workspace_id", "value": "{{object.rawId}}" },
{ "key": "include_disabled", "value": "true" }
],
"headers": [],
"pathToData": "data"
},
"matches": {
"sourceType": { "type": "oneOf", "values": ["Workspace"] }
},
"metadata": [
{
"name": "hash",
"displayName": "Key Hash",
"shape": "string"
},
{
"name": "name",
"displayName": "Name",
"shape": "string",
"role": "label"
},
{
"name": "disabled",
"displayName": "Disabled",
"shape": "boolean"
},
{
"name": "usage_daily",
"displayName": "Spend Today",
"shape": "usd"
},
{
"name": "usage_weekly",
"displayName": "Spend This Week",
"shape": "usd"
},
{
"name": "usage_monthly",
"displayName": "Spend This Month",
"shape": "usd"
},
{
"name": "usage",
"displayName": "Total Spend",
"shape": "usd"
},
{
"name": "limit",
"displayName": "Limit",
"shape": "usd"
},
{
"name": "limit_remaining",
"displayName": "Limit Remaining",
"shape": "usd"
},
{
"name": "limitUsed",
"displayName": "Limit Used (%)",
"shape": ["number", { "decimalPlaces": 1 }],
"computed": true,
"valueExpression": "{{ $['limit'] > 0 && $['limit_remaining'] != null ? Math.min(100, 100 * ($['limit'] - $['limit_remaining']) / $['limit']) : null }}"
},
{
"name": "limit_reset",
"displayName": "Limit Reset",
"shape": "string"
},
{
"name": "workspace_id",
"displayName": "Workspace ID",
"shape": "string"
},
{
"name": "created_at",
"displayName": "Created",
"shape": "date"
},
{
"name": "expires_at",
"displayName": "Expires",
"shape": "date"
}
],
"timeframes": false
}
239 changes: 239 additions & 0 deletions plugins/OpenRouter/v1/dataStreams/appRankings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
{
"name": "appRankings",
"displayName": "App Rankings",
"description": "Top public apps on OpenRouter by tokens processed, most popular or trending (from OpenRouter's public apps marketplace)",
"tags": [
"Usage"
],
"baseDataSourceName": "httpRequestUnscoped",
"config": {
"httpMethod": "get",
"endpointPath": "datasets/app-rankings",
"paging": {
"mode": "none"
},
"getArgs": [
{
"key": "start_date",
"value": "{{timeframe.start.substring(0, 10)}}"
},
{
"key": "end_date",
"value": "{{timeframe.end.substring(0, 10)}}"
},
{
"key": "sort",
"value": "{{ typeof rankBy !== 'undefined' && rankBy ? rankBy : 'popular' }}"
},
{
"key": "category",
"value": "{{ typeof category === 'string' && ['coding', 'creative', 'productivity', 'entertainment'].includes(category) ? category : null }}"
},
{
"key": "subcategory",
"value": "{{ typeof category === 'string' && category && !['coding', 'creative', 'productivity', 'entertainment'].includes(category) ? category : null }}"
},
{
"key": "limit",
"value": "100"
}
],
"headers": [],
"postRequestScript": "appRankings.js"
},
"matches": "none",
"metadata": [
{
"name": "rank",
"displayName": "Rank",
"shape": "number"
},
{
"name": "app_id",
"displayName": "App ID",
"shape": "string",
"visible": false
},
{
"name": "app_name",
"displayName": "App",
"shape": "string",
"role": "label"
},
{
"name": "total_tokens",
"displayName": "Total Tokens",
"shape": [
"number",
{
"decimalPlaces": 0,
"thousandsSeparator": true
}
],
"role": "value"
},
{
"name": "total_requests",
"displayName": "Total Requests",
"shape": [
"number",
{
"decimalPlaces": 0,
"thousandsSeparator": true
}
]
},
{
"name": "asOf",
"displayName": "As Of",
"shape": "date",
"visible": false
},
{
"name": "citation",
"displayName": "Citation",
"shape": "string",
"visible": false
}
],
"timeframes": [
"last7days",
"last30days",
"thisMonth",
"lastMonth",
"thisQuarter",
"lastQuarter",
"thisYear",
"lastYear"
],
"options": {
"minimumRequestIntervalSeconds": 86400
},
"ui": [
{
"type": "choiceChips",
"name": "rankBy",
"label": "Rank by",
"defaultValue": "popular",
"options": [
{
"value": "popular",
"label": "Most tokens"
},
{
"value": "trending",
"label": "Trending"
}
],
"help": "**Trending** ranks apps by token growth over the previous three periods of the same length, so it may return fewer apps"
},
{
"type": "autocomplete",
"name": "category",
"label": "Category",
"isMulti": false,
"isClearable": true,
"data": {
"source": "fixed",
"values": [
{
"label": "Coding",
"options": [
{
"value": "coding",
"label": "All coding"
},
{
"value": "cli-agent",
"label": "CLI agents"
},
{
"value": "ide-extension",
"label": "IDE extensions"
},
{
"value": "cloud-agent",
"label": "Cloud agents"
},
{
"value": "programming-app",
"label": "Programming apps"
},
{
"value": "native-app-builder",
"label": "Native app builders"
}
]
},
{
"label": "Creative",
"options": [
{
"value": "creative",
"label": "All creative"
},
{
"value": "creative-writing",
"label": "Creative writing"
},
{
"value": "video-gen",
"label": "Video generation"
},
{
"value": "image-gen",
"label": "Image generation"
},
{
"value": "audio-gen",
"label": "Audio generation"
}
]
},
{
"label": "Productivity",
"options": [
{
"value": "productivity",
"label": "All productivity"
},
{
"value": "writing-assistant",
"label": "Writing assistants"
},
{
"value": "general-chat",
"label": "General chat"
},
{
"value": "personal-agent",
"label": "Personal agents"
},
{
"value": "legal",
"label": "Legal"
}
]
},
{
"label": "Entertainment",
"options": [
{
"value": "entertainment",
"label": "All entertainment"
},
{
"value": "roleplay",
"label": "Roleplay"
},
{
"value": "game",
"label": "Games"
}
]
}
]
}
}
]
}
Loading
Loading