feat: add ai_providers table, queries, dbauthz, audit, RBAC (#24892)

This commit is contained in:
Danny Kopping
2026-05-14 16:10:46 +02:00
committed by GitHub
parent acf57b3b35
commit 841b777ccd
43 changed files with 1960 additions and 232 deletions
+47 -31
View File
@@ -13889,7 +13889,7 @@ const docTemplate = `{
"description": "Providers holds provider instances populated from CODER_AIBRIDGE_PROVIDER_\u003cN\u003e_\u003cKEY\u003e\nenv vars and/or the deprecated LegacyOpenAI/LegacyAnthropic/LegacyBedrock fields above.",
"type": "array",
"items": {
"$ref": "#/definitions/codersdk.AIBridgeProviderConfig"
"$ref": "#/definitions/codersdk.AIProviderConfig"
}
},
"rate_limit": {
@@ -14010,36 +14010,6 @@ const docTemplate = `{
}
}
},
"codersdk.AIBridgeProviderConfig": {
"type": "object",
"properties": {
"base_url": {
"description": "BaseURL is the base URL of the upstream provider API.",
"type": "string"
},
"bedrock_model": {
"type": "string"
},
"bedrock_region": {
"type": "string"
},
"bedrock_small_fast_model": {
"type": "string"
},
"dump_dir": {
"description": "DumpDir is the directory path for dumping API requests and responses.",
"type": "string"
},
"name": {
"description": "Name is the unique instance identifier used for routing.\nDefaults to Type if not provided.",
"type": "string"
},
"type": {
"description": "Type is the provider type: \"openai\", \"anthropic\", or \"copilot\".",
"type": "string"
}
}
},
"codersdk.AIBridgeProxyConfig": {
"type": "object",
"properties": {
@@ -14421,6 +14391,36 @@ const docTemplate = `{
}
}
},
"codersdk.AIProviderConfig": {
"type": "object",
"properties": {
"base_url": {
"description": "BaseURL is the base URL of the upstream provider API.",
"type": "string"
},
"bedrock_model": {
"type": "string"
},
"bedrock_region": {
"type": "string"
},
"bedrock_small_fast_model": {
"type": "string"
},
"dump_dir": {
"description": "DumpDir is the directory path for dumping API requests and responses.",
"type": "string"
},
"name": {
"description": "Name is the unique instance identifier used for routing.\nDefaults to Type if not provided.",
"type": "string"
},
"type": {
"description": "Type is the provider type: \"openai\", \"anthropic\", or \"copilot\".",
"type": "string"
}
}
},
"codersdk.APIAllowListTarget": {
"type": "object",
"properties": {
@@ -14522,6 +14522,11 @@ const docTemplate = `{
"ai_model_price:*",
"ai_model_price:read",
"ai_model_price:update",
"ai_provider:*",
"ai_provider:create",
"ai_provider:delete",
"ai_provider:read",
"ai_provider:update",
"ai_seat:*",
"ai_seat:create",
"ai_seat:read",
@@ -14737,6 +14742,11 @@ const docTemplate = `{
"APIKeyScopeAiModelPriceAll",
"APIKeyScopeAiModelPriceRead",
"APIKeyScopeAiModelPriceUpdate",
"APIKeyScopeAiProviderAll",
"APIKeyScopeAiProviderCreate",
"APIKeyScopeAiProviderDelete",
"APIKeyScopeAiProviderRead",
"APIKeyScopeAiProviderUpdate",
"APIKeyScopeAiSeatAll",
"APIKeyScopeAiSeatCreate",
"APIKeyScopeAiSeatRead",
@@ -21351,6 +21361,7 @@ const docTemplate = `{
"enum": [
"*",
"ai_model_price",
"ai_provider",
"ai_seat",
"aibridge_interception",
"api_key",
@@ -21399,6 +21410,7 @@ const docTemplate = `{
"x-enum-varnames": [
"ResourceWildcard",
"ResourceAiModelPrice",
"ResourceAIProvider",
"ResourceAiSeat",
"ResourceAibridgeInterception",
"ResourceApiKey",
@@ -21658,6 +21670,8 @@ const docTemplate = `{
"workspace_app",
"task",
"ai_seat",
"ai_provider",
"ai_provider_key",
"chat",
"user_secret"
],
@@ -21689,6 +21703,8 @@ const docTemplate = `{
"ResourceTypeWorkspaceApp",
"ResourceTypeTask",
"ResourceTypeAISeat",
"ResourceTypeAIProvider",
"ResourceTypeAIProviderKey",
"ResourceTypeChat",
"ResourceTypeUserSecret"
]
+47 -31
View File
@@ -12361,7 +12361,7 @@
"description": "Providers holds provider instances populated from CODER_AIBRIDGE_PROVIDER_\u003cN\u003e_\u003cKEY\u003e\nenv vars and/or the deprecated LegacyOpenAI/LegacyAnthropic/LegacyBedrock fields above.",
"type": "array",
"items": {
"$ref": "#/definitions/codersdk.AIBridgeProviderConfig"
"$ref": "#/definitions/codersdk.AIProviderConfig"
}
},
"rate_limit": {
@@ -12482,36 +12482,6 @@
}
}
},
"codersdk.AIBridgeProviderConfig": {
"type": "object",
"properties": {
"base_url": {
"description": "BaseURL is the base URL of the upstream provider API.",
"type": "string"
},
"bedrock_model": {
"type": "string"
},
"bedrock_region": {
"type": "string"
},
"bedrock_small_fast_model": {
"type": "string"
},
"dump_dir": {
"description": "DumpDir is the directory path for dumping API requests and responses.",
"type": "string"
},
"name": {
"description": "Name is the unique instance identifier used for routing.\nDefaults to Type if not provided.",
"type": "string"
},
"type": {
"description": "Type is the provider type: \"openai\", \"anthropic\", or \"copilot\".",
"type": "string"
}
}
},
"codersdk.AIBridgeProxyConfig": {
"type": "object",
"properties": {
@@ -12893,6 +12863,36 @@
}
}
},
"codersdk.AIProviderConfig": {
"type": "object",
"properties": {
"base_url": {
"description": "BaseURL is the base URL of the upstream provider API.",
"type": "string"
},
"bedrock_model": {
"type": "string"
},
"bedrock_region": {
"type": "string"
},
"bedrock_small_fast_model": {
"type": "string"
},
"dump_dir": {
"description": "DumpDir is the directory path for dumping API requests and responses.",
"type": "string"
},
"name": {
"description": "Name is the unique instance identifier used for routing.\nDefaults to Type if not provided.",
"type": "string"
},
"type": {
"description": "Type is the provider type: \"openai\", \"anthropic\", or \"copilot\".",
"type": "string"
}
}
},
"codersdk.APIAllowListTarget": {
"type": "object",
"properties": {
@@ -12986,6 +12986,11 @@
"ai_model_price:*",
"ai_model_price:read",
"ai_model_price:update",
"ai_provider:*",
"ai_provider:create",
"ai_provider:delete",
"ai_provider:read",
"ai_provider:update",
"ai_seat:*",
"ai_seat:create",
"ai_seat:read",
@@ -13201,6 +13206,11 @@
"APIKeyScopeAiModelPriceAll",
"APIKeyScopeAiModelPriceRead",
"APIKeyScopeAiModelPriceUpdate",
"APIKeyScopeAiProviderAll",
"APIKeyScopeAiProviderCreate",
"APIKeyScopeAiProviderDelete",
"APIKeyScopeAiProviderRead",
"APIKeyScopeAiProviderUpdate",
"APIKeyScopeAiSeatAll",
"APIKeyScopeAiSeatCreate",
"APIKeyScopeAiSeatRead",
@@ -19575,6 +19585,7 @@
"enum": [
"*",
"ai_model_price",
"ai_provider",
"ai_seat",
"aibridge_interception",
"api_key",
@@ -19623,6 +19634,7 @@
"x-enum-varnames": [
"ResourceWildcard",
"ResourceAiModelPrice",
"ResourceAIProvider",
"ResourceAiSeat",
"ResourceAibridgeInterception",
"ResourceApiKey",
@@ -19872,6 +19884,8 @@
"workspace_app",
"task",
"ai_seat",
"ai_provider",
"ai_provider_key",
"chat",
"user_secret"
],
@@ -19903,6 +19917,8 @@
"ResourceTypeWorkspaceApp",
"ResourceTypeTask",
"ResourceTypeAISeat",
"ResourceTypeAIProvider",
"ResourceTypeAIProviderKey",
"ResourceTypeChat",
"ResourceTypeUserSecret"
]