{ "openapi": "3.1.0", "info": { "title": "CodeGate", "description": "Generative AI CodeGen security gateway", "version": "0.1.7" }, "paths": { "/health": { "get": { "tags": [ "System" ], "summary": "Health Check", "operationId": "health_check_health_get", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } } } } }, "/api/v1/provider-endpoints": { "get": { "tags": [ "CodeGate API", "Providers" ], "summary": "List Provider Endpoints", "description": "List all provider endpoints.", "operationId": "v1_list_provider_endpoints", "parameters": [ { "name": "name", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Name" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/ProviderEndpoint" }, "title": "Response V1 List Provider Endpoints" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } }, "post": { "tags": [ "CodeGate API", "Providers" ], "summary": "Add Provider Endpoint", "description": "Add a provider endpoint.", "operationId": "v1_add_provider_endpoint", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AddProviderEndpointRequest" } } } }, "responses": { "201": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ProviderEndpoint" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/provider-endpoints/models": { "get": { "tags": [ "CodeGate API", "Providers" ], "summary": "List All Models For All Providers", "description": "List all models for all providers.", "operationId": "v1_list_all_models_for_all_providers", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "items": { "$ref": "#/components/schemas/ModelByProvider" }, "type": "array", "title": "Response V1 List All Models For All Providers" } } } } } } }, "/api/v1/provider-endpoints/{provider_name}/models": { "get": { "tags": [ "CodeGate API", "Providers" ], "summary": "List Models By Provider", "description": "List models by provider.", "operationId": "v1_list_models_by_provider", "parameters": [ { "name": "provider_name", "in": "path", "required": true, "schema": { "type": "string", "title": "Provider Name" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/ModelByProvider" }, "title": "Response V1 List Models By Provider" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/provider-endpoints/{provider_name}": { "get": { "tags": [ "CodeGate API", "Providers" ], "summary": "Get Provider Endpoint", "description": "Get a provider endpoint by name.", "operationId": "v1_get_provider_endpoint", "parameters": [ { "name": "provider_name", "in": "path", "required": true, "schema": { "type": "string", "title": "Provider Name" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ProviderEndpoint" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } }, "put": { "tags": [ "CodeGate API", "Providers" ], "summary": "Update Provider Endpoint", "description": "Update a provider endpoint by name.", "operationId": "v1_update_provider_endpoint", "parameters": [ { "name": "provider_name", "in": "path", "required": true, "schema": { "type": "string", "title": "Provider Name" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ProviderEndpoint" } } } }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ProviderEndpoint" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } }, "delete": { "tags": [ "CodeGate API", "Providers" ], "summary": "Delete Provider Endpoint", "description": "Delete a provider endpoint by name.", "operationId": "v1_delete_provider_endpoint", "parameters": [ { "name": "provider_name", "in": "path", "required": true, "schema": { "type": "string", "title": "Provider Name" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/provider-endpoints/{provider_name}/auth-material": { "put": { "tags": [ "CodeGate API", "Providers" ], "summary": "Configure Auth Material", "description": "Configure auth material for a provider.", "operationId": "v1_configure_auth_material", "parameters": [ { "name": "provider_name", "in": "path", "required": true, "schema": { "type": "string", "title": "Provider Name" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConfigureAuthMaterial" } } } }, "responses": { "204": { "description": "Successful Response" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/workspaces": { "get": { "tags": [ "CodeGate API", "Workspaces" ], "summary": "List Workspaces", "description": "List all workspaces.\n\nArgs:\n provider_name (Optional[str]): Filter workspaces by provider name. If provided,\n will return workspaces where models from the specified provider (e.g., OpenAI,\n Anthropic) have been used in workspace muxing rules.\n\nReturns:\n ListWorkspacesResponse: A response object containing the list of workspaces.", "operationId": "v1_list_workspaces", "parameters": [ { "name": "provider_name", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Provider Name" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListWorkspacesResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } }, "post": { "tags": [ "CodeGate API", "Workspaces" ], "summary": "Create Workspace", "description": "Create a new workspace.", "operationId": "v1_create_workspace", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FullWorkspace-Input" } } } }, "responses": { "201": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FullWorkspace-Output" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/workspaces/active": { "get": { "tags": [ "CodeGate API", "Workspaces" ], "summary": "List Active Workspaces", "description": "List all active workspaces.\n\nIn it's current form, this function will only return one workspace. That is,\nthe globally active workspace.", "operationId": "v1_list_active_workspaces", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListActiveWorkspacesResponse" } } } } } }, "post": { "tags": [ "CodeGate API", "Workspaces" ], "summary": "Activate Workspace", "description": "Activate a workspace by name.", "operationId": "v1_activate_workspace", "parameters": [ { "name": "status_code", "in": "query", "required": false, "schema": { "default": 204, "title": "Status Code" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ActivateWorkspaceRequest" } } } }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/workspaces/{workspace_name}": { "put": { "tags": [ "CodeGate API", "Workspaces" ], "summary": "Update Workspace", "description": "Update a workspace.", "operationId": "v1_update_workspace", "parameters": [ { "name": "workspace_name", "in": "path", "required": true, "schema": { "type": "string", "title": "Workspace Name" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FullWorkspace-Input" } } } }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FullWorkspace-Output" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } }, "delete": { "tags": [ "CodeGate API", "Workspaces" ], "summary": "Delete Workspace", "description": "Delete a workspace by name.", "operationId": "v1_delete_workspace", "parameters": [ { "name": "workspace_name", "in": "path", "required": true, "schema": { "type": "string", "title": "Workspace Name" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } }, "get": { "tags": [ "CodeGate API", "Workspaces" ], "summary": "Get Workspace By Name", "description": "List workspaces by provider ID.", "operationId": "v1_get_workspace_by_name", "parameters": [ { "name": "workspace_name", "in": "path", "required": true, "schema": { "type": "string", "title": "Workspace Name" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/FullWorkspace-Output" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/workspaces/archive": { "get": { "tags": [ "CodeGate API", "Workspaces" ], "summary": "List Archived Workspaces", "description": "List all archived workspaces.", "operationId": "v1_list_archived_workspaces", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListWorkspacesResponse" } } } } } } }, "/api/v1/workspaces/archive/{workspace_name}/recover": { "post": { "tags": [ "CodeGate API", "Workspaces" ], "summary": "Recover Workspace", "description": "Recover an archived workspace by name.", "operationId": "v1_recover_workspace", "parameters": [ { "name": "workspace_name", "in": "path", "required": true, "schema": { "type": "string", "title": "Workspace Name" } } ], "responses": { "204": { "description": "Successful Response" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/workspaces/archive/{workspace_name}": { "delete": { "tags": [ "CodeGate API", "Workspaces" ], "summary": "Hard Delete Workspace", "description": "Hard delete an archived workspace by name.", "operationId": "v1_hard_delete_workspace", "parameters": [ { "name": "workspace_name", "in": "path", "required": true, "schema": { "type": "string", "title": "Workspace Name" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/workspaces/{workspace_name}/alerts": { "get": { "tags": [ "CodeGate API", "Workspaces" ], "summary": "Get Workspace Alerts", "description": "Get alerts for a workspace.", "operationId": "v1_get_workspace_alerts", "parameters": [ { "name": "workspace_name", "in": "path", "required": true, "schema": { "type": "string", "title": "Workspace Name" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "type": "array", "items": { "anyOf": [ { "$ref": "#/components/schemas/AlertConversation" }, { "type": "null" } ] }, "title": "Response V1 Get Workspace Alerts" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/workspaces/{workspace_name}/alerts-summary": { "get": { "tags": [ "CodeGate API", "Workspaces" ], "summary": "Get Workspace Alerts Summary", "description": "Get alert summary for a workspace.", "operationId": "v1_get_workspace_alerts_summary", "parameters": [ { "name": "workspace_name", "in": "path", "required": true, "schema": { "type": "string", "title": "Workspace Name" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AlertSummary" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/workspaces/{workspace_name}/messages": { "get": { "tags": [ "CodeGate API", "Workspaces" ], "summary": "Get Workspace Messages", "description": "Get messages for a workspace.", "operationId": "v1_get_workspace_messages", "parameters": [ { "name": "workspace_name", "in": "path", "required": true, "schema": { "type": "string", "title": "Workspace Name" } }, { "name": "page", "in": "query", "required": false, "schema": { "type": "integer", "minimum": 1, "default": 1, "title": "Page" } }, { "name": "page_size", "in": "query", "required": false, "schema": { "type": "integer", "maximum": 100, "minimum": 1, "default": 50, "title": "Page Size" } }, { "name": "filter_by_ids", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "null" } ], "title": "Filter By Ids" } }, { "name": "filter_by_alert_trigger_types", "in": "query", "required": false, "schema": { "anyOf": [ { "type": "array", "items": { "$ref": "#/components/schemas/AlertTriggerType" } }, { "type": "null" } ], "title": "Filter By Alert Trigger Types" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PaginatedMessagesResponse" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/workspaces/{workspace_name}/messages/{prompt_id}": { "get": { "tags": [ "CodeGate API", "Workspaces" ], "summary": "Get Messages By Prompt Id", "description": "Get messages for a workspace.", "operationId": "v1_get_messages_by_prompt_id", "parameters": [ { "name": "workspace_name", "in": "path", "required": true, "schema": { "type": "string", "title": "Workspace Name" } }, { "name": "prompt_id", "in": "path", "required": true, "schema": { "type": "string", "title": "Prompt Id" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Conversation" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/workspaces/{workspace_name}/custom-instructions": { "get": { "tags": [ "CodeGate API", "Workspaces" ], "summary": "Get Workspace Custom Instructions", "description": "Get the custom instructions of a workspace.", "operationId": "v1_get_workspace_custom_instructions", "parameters": [ { "name": "workspace_name", "in": "path", "required": true, "schema": { "type": "string", "title": "Workspace Name" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomInstructions" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } }, "put": { "tags": [ "CodeGate API", "Workspaces" ], "summary": "Set Workspace Custom Instructions", "operationId": "v1_set_workspace_custom_instructions", "parameters": [ { "name": "workspace_name", "in": "path", "required": true, "schema": { "type": "string", "title": "Workspace Name" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomInstructions" } } } }, "responses": { "204": { "description": "Successful Response" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } }, "delete": { "tags": [ "CodeGate API", "Workspaces" ], "summary": "Delete Workspace Custom Instructions", "operationId": "v1_delete_workspace_custom_instructions", "parameters": [ { "name": "workspace_name", "in": "path", "required": true, "schema": { "type": "string", "title": "Workspace Name" } } ], "responses": { "204": { "description": "Successful Response" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/workspaces/{workspace_name}/muxes": { "get": { "tags": [ "CodeGate API", "Workspaces", "Muxes" ], "summary": "Get Workspace Muxes", "description": "Get the mux rules of a workspace.\n\nThe list is ordered in order of priority. That is, the first rule in the list\nhas the highest priority.", "operationId": "v1_get_workspace_muxes", "parameters": [ { "name": "workspace_name", "in": "path", "required": true, "schema": { "type": "string", "title": "Workspace Name" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/MuxRule" }, "title": "Response V1 Get Workspace Muxes" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } }, "put": { "tags": [ "CodeGate API", "Workspaces", "Muxes" ], "summary": "Set Workspace Muxes", "description": "Set the mux rules of a workspace.", "operationId": "v1_set_workspace_muxes", "parameters": [ { "name": "workspace_name", "in": "path", "required": true, "schema": { "type": "string", "title": "Workspace Name" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/MuxRule" }, "title": "Request" } } } }, "responses": { "204": { "description": "Successful Response" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/alerts_notification": { "get": { "tags": [ "CodeGate API", "Dashboard" ], "summary": "Stream Sse", "description": "Send alerts event", "operationId": "v1_stream_sse", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } } } } }, "/api/v1/version": { "get": { "tags": [ "CodeGate API", "Dashboard" ], "summary": "Version Check", "operationId": "v1_version_check", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": {} } } } } } }, "/api/v1/workspaces/{workspace_name}/token-usage": { "get": { "tags": [ "CodeGate API", "Workspaces", "Token Usage" ], "summary": "Get Workspace Token Usage", "description": "Get the token usage of a workspace.", "operationId": "v1_get_workspace_token_usage", "parameters": [ { "name": "workspace_name", "in": "path", "required": true, "schema": { "type": "string", "title": "Workspace Name" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TokenUsageAggregate" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/personas": { "get": { "tags": [ "CodeGate API", "Personas" ], "summary": "List Personas", "description": "List all personas.", "operationId": "v1_list_personas", "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "items": { "$ref": "#/components/schemas/Persona" }, "type": "array", "title": "Response V1 List Personas" } } } } } }, "post": { "tags": [ "CodeGate API", "Personas" ], "summary": "Create Persona", "description": "Create a new persona.", "operationId": "v1_create_persona", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PersonaRequest" } } }, "required": true }, "responses": { "201": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Persona" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } }, "/api/v1/personas/{persona_name}": { "get": { "tags": [ "CodeGate API", "Personas" ], "summary": "Get Persona", "description": "Get a persona by name.", "operationId": "v1_get_persona", "parameters": [ { "name": "persona_name", "in": "path", "required": true, "schema": { "type": "string", "title": "Persona Name" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Persona" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } }, "put": { "tags": [ "CodeGate API", "Personas" ], "summary": "Update Persona", "description": "Update an existing persona.", "operationId": "v1_update_persona", "parameters": [ { "name": "persona_name", "in": "path", "required": true, "schema": { "type": "string", "title": "Persona Name" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PersonaUpdateRequest" } } } }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Persona" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } }, "delete": { "tags": [ "CodeGate API", "Personas" ], "summary": "Delete Persona", "description": "Delete a persona.", "operationId": "v1_delete_persona", "parameters": [ { "name": "persona_name", "in": "path", "required": true, "schema": { "type": "string", "title": "Persona Name" } } ], "responses": { "204": { "description": "Successful Response" }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } } } } }, "components": { "schemas": { "ActivateWorkspaceRequest": { "properties": { "name": { "type": "string", "title": "Name" } }, "type": "object", "required": [ "name" ], "title": "ActivateWorkspaceRequest" }, "ActiveWorkspace": { "properties": { "name": { "type": "string", "title": "Name" }, "is_active": { "type": "boolean", "title": "Is Active" }, "last_updated": { "title": "Last Updated" } }, "type": "object", "required": [ "name", "is_active", "last_updated" ], "title": "ActiveWorkspace" }, "AddProviderEndpointRequest": { "properties": { "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Id", "default": "" }, "name": { "type": "string", "minLength": 3, "title": "Name" }, "description": { "type": "string", "title": "Description", "default": "" }, "provider_type": { "$ref": "#/components/schemas/ProviderType" }, "endpoint": { "type": "string", "title": "Endpoint", "default": "" }, "auth_type": { "$ref": "#/components/schemas/ProviderAuthType", "default": "none" }, "api_key": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Api Key" } }, "type": "object", "required": [ "name", "provider_type" ], "title": "AddProviderEndpointRequest", "description": "Represents a request to add a provider endpoint." }, "Alert": { "properties": { "id": { "type": "string", "title": "Id" }, "prompt_id": { "type": "string", "title": "Prompt Id" }, "code_snippet": { "anyOf": [ { "$ref": "#/components/schemas/CodeSnippet" }, { "type": "null" } ] }, "trigger_string": { "anyOf": [ { "type": "string" }, { "type": "object" }, { "type": "null" } ], "title": "Trigger String" }, "trigger_type": { "type": "string", "title": "Trigger Type" }, "trigger_category": { "$ref": "#/components/schemas/AlertSeverity" }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" } }, "type": "object", "required": [ "id", "prompt_id", "code_snippet", "trigger_string", "trigger_type", "trigger_category", "timestamp" ], "title": "Alert", "description": "Represents an alert." }, "AlertConversation": { "properties": { "conversation": { "$ref": "#/components/schemas/Conversation" }, "alert_id": { "type": "string", "title": "Alert Id" }, "code_snippet": { "anyOf": [ { "$ref": "#/components/schemas/CodeSnippet" }, { "type": "null" } ] }, "trigger_string": { "anyOf": [ { "type": "string" }, { "type": "object" }, { "type": "null" } ], "title": "Trigger String" }, "trigger_type": { "type": "string", "title": "Trigger Type" }, "trigger_category": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Trigger Category" }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" } }, "type": "object", "required": [ "conversation", "alert_id", "code_snippet", "trigger_string", "trigger_type", "trigger_category", "timestamp" ], "title": "AlertConversation", "description": "Represents an alert with it's respective conversation." }, "AlertSeverity": { "type": "string", "enum": [ "info", "critical" ], "title": "AlertSeverity" }, "AlertSummary": { "properties": { "malicious_packages": { "type": "integer", "title": "Malicious Packages" }, "pii": { "type": "integer", "title": "Pii" }, "secrets": { "type": "integer", "title": "Secrets" }, "total_alerts": { "type": "integer", "title": "Total Alerts" } }, "type": "object", "required": [ "malicious_packages", "pii", "secrets", "total_alerts" ], "title": "AlertSummary", "description": "Represents a set of summary alerts" }, "AlertTriggerType": { "type": "string", "enum": [ "codegate-pii", "codegate-context-retriever", "codegate-secrets" ], "title": "AlertTriggerType" }, "ChatMessage": { "properties": { "message": { "type": "string", "title": "Message" }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp" }, "message_id": { "type": "string", "title": "Message Id" } }, "type": "object", "required": [ "message", "timestamp", "message_id" ], "title": "ChatMessage", "description": "Represents a chat message." }, "CodeSnippet": { "properties": { "code": { "type": "string", "title": "Code" }, "language": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Language" }, "filepath": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Filepath" }, "libraries": { "items": { "type": "string" }, "type": "array", "title": "Libraries", "default": [] }, "file_extension": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "File Extension" } }, "type": "object", "required": [ "code", "language", "filepath" ], "title": "CodeSnippet", "description": "Represents a code snippet with its programming language.\n\nArgs:\n language: The programming language identifier (e.g., 'python', 'javascript')\n code: The actual code content" }, "ConfigureAuthMaterial": { "properties": { "auth_type": { "$ref": "#/components/schemas/ProviderAuthType" }, "api_key": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Api Key" } }, "type": "object", "required": [ "auth_type" ], "title": "ConfigureAuthMaterial", "description": "Represents a request to configure auth material for a provider." }, "Conversation": { "properties": { "question_answers": { "items": { "$ref": "#/components/schemas/QuestionAnswer" }, "type": "array", "title": "Question Answers" }, "provider": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Provider" }, "type": { "$ref": "#/components/schemas/QuestionType" }, "chat_id": { "type": "string", "title": "Chat Id" }, "conversation_timestamp": { "type": "string", "format": "date-time", "title": "Conversation Timestamp" }, "token_usage_agg": { "anyOf": [ { "$ref": "#/components/schemas/TokenUsageAggregate" }, { "type": "null" } ] }, "alerts": { "anyOf": [ { "items": { "$ref": "#/components/schemas/Alert" }, "type": "array" }, { "type": "null" } ], "title": "Alerts", "default": [] } }, "type": "object", "required": [ "question_answers", "provider", "type", "chat_id", "conversation_timestamp", "token_usage_agg" ], "title": "Conversation", "description": "Represents a conversation." }, "ConversationSummary": { "properties": { "chat_id": { "type": "string", "title": "Chat Id" }, "prompt": { "$ref": "#/components/schemas/ChatMessage" }, "alerts_summary": { "$ref": "#/components/schemas/AlertSummary" }, "token_usage_agg": { "anyOf": [ { "$ref": "#/components/schemas/TokenUsageAggregate" }, { "type": "null" } ] }, "provider": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Provider" }, "type": { "$ref": "#/components/schemas/QuestionType" }, "conversation_timestamp": { "type": "string", "format": "date-time", "title": "Conversation Timestamp" } }, "type": "object", "required": [ "chat_id", "prompt", "alerts_summary", "token_usage_agg", "provider", "type", "conversation_timestamp" ], "title": "ConversationSummary", "description": "Represents a conversation summary." }, "CustomInstructions": { "properties": { "prompt": { "type": "string", "title": "Prompt" } }, "type": "object", "required": [ "prompt" ], "title": "CustomInstructions" }, "FullWorkspace-Input": { "properties": { "name": { "type": "string", "title": "Name" }, "config": { "anyOf": [ { "$ref": "#/components/schemas/WorkspaceConfig-Input" }, { "type": "null" } ] } }, "type": "object", "required": [ "name" ], "title": "FullWorkspace" }, "FullWorkspace-Output": { "properties": { "name": { "type": "string", "title": "Name" }, "config": { "anyOf": [ { "$ref": "#/components/schemas/WorkspaceConfig-Output" }, { "type": "null" } ] } }, "type": "object", "required": [ "name" ], "title": "FullWorkspace" }, "HTTPValidationError": { "properties": { "detail": { "items": { "$ref": "#/components/schemas/ValidationError" }, "type": "array", "title": "Detail" } }, "type": "object", "title": "HTTPValidationError" }, "ListActiveWorkspacesResponse": { "properties": { "workspaces": { "items": { "$ref": "#/components/schemas/ActiveWorkspace" }, "type": "array", "title": "Workspaces" } }, "type": "object", "required": [ "workspaces" ], "title": "ListActiveWorkspacesResponse" }, "ListWorkspacesResponse": { "properties": { "workspaces": { "items": { "$ref": "#/components/schemas/Workspace" }, "type": "array", "title": "Workspaces" } }, "type": "object", "required": [ "workspaces" ], "title": "ListWorkspacesResponse" }, "ModelByProvider": { "properties": { "name": { "type": "string", "title": "Name" }, "provider_type": { "$ref": "#/components/schemas/ProviderType" }, "provider_name": { "type": "string", "title": "Provider Name" } }, "type": "object", "required": [ "name", "provider_type", "provider_name" ], "title": "ModelByProvider", "description": "Represents a model supported by a provider.\n\nNote that these are auto-discovered by the provider." }, "MuxMatcherType": { "type": "string", "enum": [ "catch_all", "filename_match", "fim_filename", "chat_filename" ], "title": "MuxMatcherType", "description": "Represents the different types of matchers we support.\n\nThe 3 rules present match filenames and request types. They're used in conjunction with the\nmatcher field in the MuxRule model.\nE.g.\n- catch_all-> Always match\n- filename_match and match: requests.py -> Match the request if the filename is requests.py\n- fim_filename and match: main.py -> Match the request if the request type is fim\nand the filename is main.py\n\nNOTE: Removing or updating fields from this enum will require a migration.\nAdding new fields is safe." }, "MuxRule": { "properties": { "provider_name": { "type": "string", "title": "Provider Name" }, "provider_type": { "$ref": "#/components/schemas/ProviderType" }, "model": { "type": "string", "title": "Model" }, "matcher_type": { "$ref": "#/components/schemas/MuxMatcherType" }, "matcher": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Matcher" } }, "type": "object", "required": [ "provider_name", "provider_type", "model", "matcher_type" ], "title": "MuxRule", "description": "Represents a mux rule for a provider." }, "PaginatedMessagesResponse": { "properties": { "data": { "items": { "$ref": "#/components/schemas/ConversationSummary" }, "type": "array", "title": "Data" }, "limit": { "type": "integer", "title": "Limit" }, "offset": { "type": "integer", "title": "Offset" }, "total": { "type": "integer", "title": "Total" } }, "type": "object", "required": [ "data", "limit", "offset", "total" ], "title": "PaginatedMessagesResponse" }, "Persona": { "properties": { "id": { "type": "string", "title": "Id" }, "name": { "type": "string", "title": "Name" }, "description": { "type": "string", "title": "Description" } }, "type": "object", "required": [ "id", "name", "description" ], "title": "Persona", "description": "Represents a persona object." }, "PersonaRequest": { "properties": { "name": { "type": "string", "title": "Name" }, "description": { "type": "string", "title": "Description" } }, "type": "object", "required": [ "name", "description" ], "title": "PersonaRequest", "description": "Model for creating a new Persona." }, "PersonaUpdateRequest": { "properties": { "new_name": { "type": "string", "title": "New Name" }, "new_description": { "type": "string", "title": "New Description" } }, "type": "object", "required": [ "new_name", "new_description" ], "title": "PersonaUpdateRequest", "description": "Model for updating a Persona." }, "ProviderAuthType": { "type": "string", "enum": [ "none", "passthrough", "api_key" ], "title": "ProviderAuthType", "description": "Represents the different types of auth we support for providers." }, "ProviderEndpoint": { "properties": { "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Id", "default": "" }, "name": { "type": "string", "minLength": 3, "title": "Name" }, "description": { "type": "string", "title": "Description", "default": "" }, "provider_type": { "$ref": "#/components/schemas/ProviderType" }, "endpoint": { "type": "string", "title": "Endpoint", "default": "" }, "auth_type": { "$ref": "#/components/schemas/ProviderAuthType", "default": "none" } }, "type": "object", "required": [ "name", "provider_type" ], "title": "ProviderEndpoint", "description": "Represents a provider's endpoint configuration. This\nallows us to persist the configuration for each provider,\nso we can use this for muxing messages." }, "ProviderType": { "type": "string", "enum": [ "openai", "anthropic", "vllm", "ollama", "lm_studio", "llamacpp", "openrouter" ], "title": "ProviderType", "description": "Represents the different types of providers we support." }, "QuestionAnswer": { "properties": { "question": { "$ref": "#/components/schemas/ChatMessage" }, "answer": { "anyOf": [ { "$ref": "#/components/schemas/ChatMessage" }, { "type": "null" } ] } }, "type": "object", "required": [ "question", "answer" ], "title": "QuestionAnswer", "description": "Represents a question and answer pair." }, "QuestionType": { "type": "string", "enum": [ "chat", "fim" ], "title": "QuestionType" }, "TokenUsage": { "properties": { "input_tokens": { "type": "integer", "title": "Input Tokens", "default": 0 }, "output_tokens": { "type": "integer", "title": "Output Tokens", "default": 0 }, "input_cost": { "type": "number", "title": "Input Cost", "default": 0 }, "output_cost": { "type": "number", "title": "Output Cost", "default": 0 } }, "type": "object", "title": "TokenUsage", "description": "TokenUsage it's not a table, it's a model to represent the token usage.\nThe data is stored in the outputs table." }, "TokenUsageAggregate": { "properties": { "tokens_by_model": { "additionalProperties": { "$ref": "#/components/schemas/TokenUsageByModel" }, "type": "object", "title": "Tokens By Model" }, "token_usage": { "$ref": "#/components/schemas/TokenUsage" } }, "type": "object", "required": [ "tokens_by_model", "token_usage" ], "title": "TokenUsageAggregate", "description": "Represents the tokens used. Includes the information of the tokens used by model.\n`used_tokens` are the total tokens used in the `tokens_by_model` list." }, "TokenUsageByModel": { "properties": { "provider_type": { "$ref": "#/components/schemas/ProviderType" }, "model": { "type": "string", "title": "Model" }, "token_usage": { "$ref": "#/components/schemas/TokenUsage" } }, "type": "object", "required": [ "provider_type", "model", "token_usage" ], "title": "TokenUsageByModel", "description": "Represents the tokens used by a model." }, "ValidationError": { "properties": { "loc": { "items": { "anyOf": [ { "type": "string" }, { "type": "integer" } ] }, "type": "array", "title": "Location" }, "msg": { "type": "string", "title": "Message" }, "type": { "type": "string", "title": "Error Type" } }, "type": "object", "required": [ "loc", "msg", "type" ], "title": "ValidationError" }, "Workspace": { "properties": { "name": { "type": "string", "title": "Name" }, "is_active": { "type": "boolean", "title": "Is Active" } }, "type": "object", "required": [ "name", "is_active" ], "title": "Workspace" }, "WorkspaceConfig-Input": { "properties": { "custom_instructions": { "type": "string", "title": "Custom Instructions" }, "muxing_rules": { "items": { "$ref": "#/components/schemas/MuxRule" }, "type": "array", "title": "Muxing Rules" } }, "type": "object", "required": [ "custom_instructions", "muxing_rules" ], "title": "WorkspaceConfig" }, "WorkspaceConfig-Output": { "properties": { "custom_instructions": { "type": "string", "title": "Custom Instructions" }, "muxing_rules": { "items": { "$ref": "#/components/schemas/MuxRule" }, "type": "array", "title": "Muxing Rules" } }, "type": "object", "required": [ "custom_instructions", "muxing_rules" ], "title": "WorkspaceConfig" } } } }