Skip to content
Open
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
13 changes: 13 additions & 0 deletions plugins/ClaudeConsole/v1/configValidation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"steps": [
{
"displayName": "Authenticate",
"dataStream": {
"name": "organization"
},
"required": true,
"success": "Connected to your Claude Console organization.",
"error": "Could not authenticate. Check that your Admin API key (sk-ant-admin...) is valid and belongs to an organization, not an individual account."
}
]
}
23 changes: 23 additions & 0 deletions plugins/ClaudeConsole/v1/custom_types.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[
{
"name": "Claude Workspace",
"sourceType": "Claude Workspace",
"icon": "layer-group",
"singular": "Workspace",
"plural": "Workspaces"
},
{
"name": "Claude API Key",
"sourceType": "Claude API Key",
"icon": "key",
"singular": "API Key",
"plural": "API Keys"
},
{
"name": "Claude Member",
"sourceType": "Claude Member",
"icon": "user",
"singular": "Member",
"plural": "Members"
}
]
100 changes: 100 additions & 0 deletions plugins/ClaudeConsole/v1/dataStreams/apiKeys.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"name": "apiKeys",
"displayName": "API Keys",
"description": "API keys in your Claude Console organization",
"tags": ["API Keys"],
"baseDataSourceName": "httpRequestUnscoped",
"config": {
"httpMethod": "get",
"endpointPath": "v1/organizations/api_keys",
"getArgs": [
{
"key": "limit",
"value": "1000"
},
{
"key": "created_by_user_id",
"value": "{{ (createdBy && createdBy.length) ? (Array.isArray(createdBy[0].rawId) ? createdBy[0].rawId[0] : createdBy[0].rawId) : null }}"
}
],
"paging": {
"mode": "none"
},
"expandInnerObjects": true,
"postRequestScript": "apiKeys.js"
},
"matches": "none",
"ui": [
{
"type": "objects",
"name": "workspace",
"label": "Workspace (optional)",
"matches": {
"sourceType": {
"type": "oneOf",
"values": ["Claude Workspace"]
}
}
},
{
"type": "objects",
"name": "createdBy",
"label": "Created by (optional)",
"matches": {
"sourceType": { "type": "oneOf", "values": ["Claude Member"] }
}
}
],
"metadata": [
{
"name": "id",
"displayName": "API Key ID",
"shape": "string"
},
{
"name": "name",
"displayName": "Name",
"shape": "string",
"role": "label"
},
{
"name": "status",
"displayName": "Status",
"shape": [
"state",
{
"map": {
"success": ["active"],
"unknown": ["expired", "archived", "inactive"]
}
}
]
},
{
"name": "workspace_id",
"displayName": "Workspace ID",
"shape": "string"
},
{
"name": "partial_key_hint",
"displayName": "Key Hint",
"shape": "string"
},
{
"name": "created_at",
"displayName": "Created",
"shape": "date"
},
{
"name": "expires_at",
"displayName": "Expires",
"shape": "date"
},
{
"name": "created_by.id",
"displayName": "Created By",
"shape": "string"
}
],
"timeframes": false
}
119 changes: 119 additions & 0 deletions plugins/ClaudeConsole/v1/dataStreams/cost.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
{
"name": "cost",
"displayName": "Cost",
"description": "Organization spend in USD over time, one row per workspace/model/token-type bucket per day",
"tags": ["Cost", "Billing"],
"baseDataSourceName": "httpRequestUnscoped",
"config": {
"httpMethod": "get",
"endpointPath": "v1/organizations/cost_report",
"getArgs": [
{
"key": "starting_at",
"value": "{{timeframe.start}}"
},
{
"key": "ending_at",
"value": "{{timeframe.end}}"
},
{
"key": "bucket_width",
"value": "1d"
},
{
"key": "group_by[]",
"value": "workspace_id"
},
{
"key": "group_by[]",
"value": "description"
},
{
"key": "limit",
"value": "31"
}
],
"paging": {
"mode": "none"
},
"postRequestScript": "cost.js"
},
"matches": "none",
"ui": [
{
"type": "objects",
"name": "workspace",
"label": "Workspace (optional)",
"matches": {
"sourceType": {
"type": "oneOf",
"values": ["Claude Workspace"]
}
}
}
],
"metadata": [
{
"name": "date",
"displayName": "Date",
"shape": "date",
"role": "timestamp"
},
{
"name": "amount",
"displayName": "Cost ($)",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it always USD for every customer?

"shape": [
"currency",
{
"code": "usd",
"decimalPlaces": 2,
"thousandsSeparator": true
}
],
"role": "value"
},
{
"name": "workspace_id",
"displayName": "Workspace ID",
"shape": "string"
},
{
"name": "workspaceName",
"displayName": "Workspace",
"sourceId": "workspace_id",
"sourceType": "Claude Workspace",
"objectPropertyPath": "name"
},
{
"name": "description",
"displayName": "Description",
"shape": "string"
},
{
"name": "model",
"displayName": "Model",
"shape": "string"
},
{
"name": "token_type",
"displayName": "Token Type",
"shape": "string"
},
{
"name": "cost_type",
"displayName": "Cost Type",
"shape": "string"
},
{
"name": "service_tier",
"displayName": "Service Tier",
"shape": "string"
},
{
"name": "context_window",
"displayName": "Context Window",
"shape": "string"
}
],
"timeframes": ["last7days", "last30days", "thisMonth", "lastMonth"]
}
60 changes: 60 additions & 0 deletions plugins/ClaudeConsole/v1/dataStreams/members.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"name": "members",
"displayName": "Members",
"description": "Organization members in your Claude Console organization, with email and role",
"tags": [
"Members"
],
"baseDataSourceName": "httpRequestUnscoped",
"config": {
"httpMethod": "get",
"endpointPath": "v1/organizations/users",
"getArgs": [
{
"key": "limit",
"value": "1000"
}
],
"paging": {
"mode": "none"
},
"pathToData": "data"
},
"matches": "none",
"metadata": [
{
"name": "id",
"displayName": "User ID",
"shape": "string"
},
{
"name": "name",
"displayName": "Name",
"shape": "string"
},
{
"name": "email",
"displayName": "Email",
"shape": "string"
},
{
"name": "role",
"displayName": "Role",
"shape": "string"
},
{
"name": "added_at",
"displayName": "Added",
"shape": "date"
},
{
"name": "memberName",
"displayName": "Member",
"computed": true,
"valueExpression": "{{ $['name']?.__isNone ? $['email'] : $['name'] }}",
"shape": "string",
"role": "label"
}
],
"timeframes": false
}
41 changes: 41 additions & 0 deletions plugins/ClaudeConsole/v1/dataStreams/organization.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "organization",
"displayName": "Organization",
"description": "Your Claude Console organization id, name, and type",
"tags": [
"Organization"
],
"baseDataSourceName": "httpRequestUnscoped",
"config": {
"httpMethod": "get",
"endpointPath": "v1/organizations/me",
"paging": {
"mode": "none"
},
"getArgs": [],
"headers": []
},
"matches": "none",
"metadata": [
{
"name": "id",
"displayName": "Organization ID",
"shape": "string"
},
{
"name": "name",
"displayName": "Name",
"shape": "string",
"role": "label"
},
{
"name": "type",
"displayName": "Type",
"shape": "string"
}
],
"timeframes": false,
"visibility": {
"type": "hidden"
}
}
20 changes: 20 additions & 0 deletions plugins/ClaudeConsole/v1/dataStreams/scripts/apiKeys.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const unwrap = (v) => (Array.isArray(v) ? v[0] : v);

// Build set of selected workspace rawIds (empty โ†’ account-wide, no filter)
const selected = (context.config && context.config.workspace) || [];
const workspaceIds = new Set(
selected.map((o) => unwrap(o.rawId)).filter(Boolean),
);

let rows = data.data.map((a) => ({
...a,
// Claude does not let us filter by the default workspace on their api.
workspace_id: a.workspace_id || "default",
}));

// Apply optional workspace scope filter
if (workspaceIds.size) {
rows = rows.filter((r) => workspaceIds.has(r.workspace_id));
}

result = rows;
Loading
Loading