Skip to main content

API reference

CodeGate (0.1.7)

Download OpenAPI specification:Download

Generative AI CodeGen security gateway

System

Health Check

Responses

Response samples

Content type
application/json
null

CodeGate API

List Provider Endpoints

List all provider endpoints.

query Parameters
Name (string) or Name (null) (Name)

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Add Provider Endpoint

Add a provider endpoint.

Request Body schema: application/json
required
Id (string) or Id (null) (Id)
Default: ""
name
required
string (Name) >= 3 characters
description
string (Description)
Default: ""
provider_type
required
string (ProviderType)
Enum: "openai" "anthropic" "vllm" "ollama" "lm_studio" "llamacpp" "openrouter"

Represents the different types of providers we support.

endpoint
string (Endpoint)
Default: ""
auth_type
string (ProviderAuthType)
Default: "none"
Enum: "none" "passthrough" "api_key"

Represents the different types of auth we support for providers.

Api Key (string) or Api Key (null) (Api Key)

Responses

Request samples

Content type
application/json
{
  • "id": "",
  • "name": "string",
  • "description": "",
  • "provider_type": "openai",
  • "endpoint": "",
  • "auth_type": "none",
  • "api_key": "string"
}

Response samples

Content type
application/json
{
  • "id": "",
  • "name": "string",
  • "description": "",
  • "provider_type": "openai",
  • "endpoint": "",
  • "auth_type": "none"
}

List All Models For All Providers

List all models for all providers.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

List Models By Provider

List models by provider.

path Parameters
provider_name
required
string (Provider Name)

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get Provider Endpoint

Get a provider endpoint by name.

path Parameters
provider_name
required
string (Provider Name)

Responses

Response samples

Content type
application/json
{
  • "id": "",
  • "name": "string",
  • "description": "",
  • "provider_type": "openai",
  • "endpoint": "",
  • "auth_type": "none"
}

Update Provider Endpoint

Update a provider endpoint by name.

path Parameters
provider_name
required
string (Provider Name)
Request Body schema: application/json
required
Id (string) or Id (null) (Id)
Default: ""
name
required
string (Name) >= 3 characters
description
string (Description)
Default: ""
provider_type
required
string (ProviderType)
Enum: "openai" "anthropic" "vllm" "ollama" "lm_studio" "llamacpp" "openrouter"

Represents the different types of providers we support.

endpoint
string (Endpoint)
Default: ""
auth_type
string (ProviderAuthType)
Default: "none"
Enum: "none" "passthrough" "api_key"

Represents the different types of auth we support for providers.

Responses

Request samples

Content type
application/json
{
  • "id": "",
  • "name": "string",
  • "description": "",
  • "provider_type": "openai",
  • "endpoint": "",
  • "auth_type": "none"
}

Response samples

Content type
application/json
{
  • "id": "",
  • "name": "string",
  • "description": "",
  • "provider_type": "openai",
  • "endpoint": "",
  • "auth_type": "none"
}

Delete Provider Endpoint

Delete a provider endpoint by name.

path Parameters
provider_name
required
string (Provider Name)

Responses

Response samples

Content type
application/json
null

Configure Auth Material

Configure auth material for a provider.

path Parameters
provider_name
required
string (Provider Name)
Request Body schema: application/json
required
auth_type
required
string (ProviderAuthType)
Enum: "none" "passthrough" "api_key"

Represents the different types of auth we support for providers.

Api Key (string) or Api Key (null) (Api Key)

Responses

Request samples

Content type
application/json
{
  • "auth_type": "none",
  • "api_key": "string"
}

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

List Workspaces

List all workspaces.

Args: provider_name (Optional[str]): Filter workspaces by provider name. If provided, will return workspaces where models from the specified provider (e.g., OpenAI, Anthropic) have been used in workspace muxing rules.

Returns: ListWorkspacesResponse: A response object containing the list of workspaces.

query Parameters
Provider Name (string) or Provider Name (null) (Provider Name)

Responses

Response samples

Content type
application/json
{
  • "workspaces": [
    ]
}

Create Workspace

Create a new workspace.

Request Body schema: application/json
required
name
required
string (Name)
WorkspaceConfig (object) or null

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "config": {
    }
}

Response samples

Content type
application/json
{
  • "name": "string",
  • "config": {
    }
}

List Active Workspaces

List all active workspaces.

In it's current form, this function will only return one workspace. That is, the globally active workspace.

Responses

Response samples

Content type
application/json
{
  • "workspaces": [
    ]
}

Activate Workspace

Activate a workspace by name.

query Parameters
status_code
any (Status Code)
Default: 204
Request Body schema: application/json
required
name
required
string (Name)

Responses

Request samples

Content type
application/json
{
  • "name": "string"
}

Response samples

Content type
application/json
null

Update Workspace

Update a workspace.

path Parameters
workspace_name
required
string (Workspace Name)
Request Body schema: application/json
required
name
required
string (Name)
WorkspaceConfig (object) or null

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "config": {
    }
}

Response samples

Content type
application/json
{
  • "name": "string",
  • "config": {
    }
}

Delete Workspace

Delete a workspace by name.

path Parameters
workspace_name
required
string (Workspace Name)

Responses

Response samples

Content type
application/json
null

Get Workspace By Name

List workspaces by provider ID.

path Parameters
workspace_name
required
string (Workspace Name)

Responses

Response samples

Content type
application/json
{
  • "name": "string",
  • "config": {
    }
}

List Archived Workspaces

List all archived workspaces.

Responses

Response samples

Content type
application/json
{
  • "workspaces": [
    ]
}

Recover Workspace

Recover an archived workspace by name.

path Parameters
workspace_name
required
string (Workspace Name)

Responses

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

Hard Delete Workspace

Hard delete an archived workspace by name.

path Parameters
workspace_name
required
string (Workspace Name)

Responses

Response samples

Content type
application/json
null

Get Workspace Alerts

Get alerts for a workspace.

path Parameters
workspace_name
required
string (Workspace Name)

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get Workspace Alerts Summary

Get alert summary for a workspace.

path Parameters
workspace_name
required
string (Workspace Name)

Responses

Response samples

Content type
application/json
{
  • "malicious_packages": 0,
  • "pii": 0,
  • "secrets": 0,
  • "total_alerts": 0
}

Get Workspace Messages

Get messages for a workspace.

path Parameters
workspace_name
required
string (Workspace Name)
query Parameters
page
integer (Page) >= 1
Default: 1
page_size
integer (Page Size) [ 1 .. 100 ]
Default: 50
Array of Filter By Ids (strings) or Filter By Ids (null) (Filter By Ids)
Array of Filter By Alert Trigger Types (strings) or Filter By Alert Trigger Types (null) (Filter By Alert Trigger Types)

Responses

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "limit": 0,
  • "offset": 0,
  • "total": 0
}

Get Messages By Prompt Id

Get messages for a workspace.

path Parameters
workspace_name
required
string (Workspace Name)
prompt_id
required
string (Prompt Id)

Responses

Response samples

Content type
application/json
{
  • "question_answers": [
    ],
  • "provider": "string",
  • "type": "chat",
  • "chat_id": "string",
  • "conversation_timestamp": "2019-08-24T14:15:22Z",
  • "token_usage_agg": {
    },
  • "alerts": [ ]
}

Get Workspace Custom Instructions

Get the custom instructions of a workspace.

path Parameters
workspace_name
required
string (Workspace Name)

Responses

Response samples

Content type
application/json
{
  • "prompt": "string"
}

Set Workspace Custom Instructions

path Parameters
workspace_name
required
string (Workspace Name)
Request Body schema: application/json
required
prompt
required
string (Prompt)

Responses

Request samples

Content type
application/json
{
  • "prompt": "string"
}

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

Delete Workspace Custom Instructions

path Parameters
workspace_name
required
string (Workspace Name)

Responses

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

Get Workspace Muxes

Get the mux rules of a workspace.

The list is ordered in order of priority. That is, the first rule in the list has the highest priority.

path Parameters
workspace_name
required
string (Workspace Name)

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Set Workspace Muxes

Set the mux rules of a workspace.

path Parameters
workspace_name
required
string (Workspace Name)
Request Body schema: application/json
required
Array
provider_name
required
string (Provider Name)
provider_type
required
string (ProviderType)
Enum: "openai" "anthropic" "vllm" "ollama" "lm_studio" "llamacpp" "openrouter"

Represents the different types of providers we support.

model
required
string (Model)
matcher_type
required
string (MuxMatcherType)
Enum: "catch_all" "filename_match" "fim_filename" "chat_filename"

Represents the different types of matchers we support.

The 3 rules present match filenames and request types. They're used in conjunction with the matcher field in the MuxRule model. E.g.

  • catch_all-> Always match
  • filename_match and match: requests.py -> Match the request if the filename is requests.py
  • fim_filename and match: main.py -> Match the request if the request type is fim and the filename is main.py

NOTE: Removing or updating fields from this enum will require a migration. Adding new fields is safe.

Matcher (string) or Matcher (null) (Matcher)

Responses

Request samples

Content type
application/json
[
  • {
    }
]

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

Stream Sse

Send alerts event

Responses

Response samples

Content type
application/json
null

Version Check

Responses

Response samples

Content type
application/json
null

Get Workspace Token Usage

Get the token usage of a workspace.

path Parameters
workspace_name
required
string (Workspace Name)

Responses

Response samples

Content type
application/json
{
  • "tokens_by_model": {
    },
  • "token_usage": {
    }
}

List Personas

List all personas.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Create Persona

Create a new persona.

Request Body schema: application/json
required
name
required
string (Name)
description
required
string (Description)

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "description": "string"
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "name": "string",
  • "description": "string"
}

Get Persona

Get a persona by name.

path Parameters
persona_name
required
string (Persona Name)

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "name": "string",
  • "description": "string"
}

Update Persona

Update an existing persona.

path Parameters
persona_name
required
string (Persona Name)
Request Body schema: application/json
required
new_name
required
string (New Name)
new_description
required
string (New Description)

Responses

Request samples

Content type
application/json
{
  • "new_name": "string",
  • "new_description": "string"
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "name": "string",
  • "description": "string"
}

Delete Persona

Delete a persona.

path Parameters
persona_name
required
string (Persona Name)

Responses

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

Providers

List Provider Endpoints

List all provider endpoints.

query Parameters
Name (string) or Name (null) (Name)

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Add Provider Endpoint

Add a provider endpoint.

Request Body schema: application/json
required
Id (string) or Id (null) (Id)
Default: ""
name
required
string (Name) >= 3 characters
description
string (Description)
Default: ""
provider_type
required
string (ProviderType)
Enum: "openai" "anthropic" "vllm" "ollama" "lm_studio" "llamacpp" "openrouter"

Represents the different types of providers we support.

endpoint
string (Endpoint)
Default: ""
auth_type
string (ProviderAuthType)
Default: "none"
Enum: "none" "passthrough" "api_key"

Represents the different types of auth we support for providers.

Api Key (string) or Api Key (null) (Api Key)

Responses

Request samples

Content type
application/json
{
  • "id": "",
  • "name": "string",
  • "description": "",
  • "provider_type": "openai",
  • "endpoint": "",
  • "auth_type": "none",
  • "api_key": "string"
}

Response samples

Content type
application/json
{
  • "id": "",
  • "name": "string",
  • "description": "",
  • "provider_type": "openai",
  • "endpoint": "",
  • "auth_type": "none"
}

List All Models For All Providers

List all models for all providers.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

List Models By Provider

List models by provider.

path Parameters
provider_name
required
string (Provider Name)

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get Provider Endpoint

Get a provider endpoint by name.

path Parameters
provider_name
required
string (Provider Name)

Responses

Response samples

Content type
application/json
{
  • "id": "",
  • "name": "string",
  • "description": "",
  • "provider_type": "openai",
  • "endpoint": "",
  • "auth_type": "none"
}

Update Provider Endpoint

Update a provider endpoint by name.

path Parameters
provider_name
required
string (Provider Name)
Request Body schema: application/json
required
Id (string) or Id (null) (Id)
Default: ""
name
required
string (Name) >= 3 characters
description
string (Description)
Default: ""
provider_type
required
string (ProviderType)
Enum: "openai" "anthropic" "vllm" "ollama" "lm_studio" "llamacpp" "openrouter"

Represents the different types of providers we support.

endpoint
string (Endpoint)
Default: ""
auth_type
string (ProviderAuthType)
Default: "none"
Enum: "none" "passthrough" "api_key"

Represents the different types of auth we support for providers.

Responses

Request samples

Content type
application/json
{
  • "id": "",
  • "name": "string",
  • "description": "",
  • "provider_type": "openai",
  • "endpoint": "",
  • "auth_type": "none"
}

Response samples

Content type
application/json
{
  • "id": "",
  • "name": "string",
  • "description": "",
  • "provider_type": "openai",
  • "endpoint": "",
  • "auth_type": "none"
}

Delete Provider Endpoint

Delete a provider endpoint by name.

path Parameters
provider_name
required
string (Provider Name)

Responses

Response samples

Content type
application/json
null

Configure Auth Material

Configure auth material for a provider.

path Parameters
provider_name
required
string (Provider Name)
Request Body schema: application/json
required
auth_type
required
string (ProviderAuthType)
Enum: "none" "passthrough" "api_key"

Represents the different types of auth we support for providers.

Api Key (string) or Api Key (null) (Api Key)

Responses

Request samples

Content type
application/json
{
  • "auth_type": "none",
  • "api_key": "string"
}

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

Workspaces

List Workspaces

List all workspaces.

Args: provider_name (Optional[str]): Filter workspaces by provider name. If provided, will return workspaces where models from the specified provider (e.g., OpenAI, Anthropic) have been used in workspace muxing rules.

Returns: ListWorkspacesResponse: A response object containing the list of workspaces.

query Parameters
Provider Name (string) or Provider Name (null) (Provider Name)

Responses

Response samples

Content type
application/json
{
  • "workspaces": [
    ]
}

Create Workspace

Create a new workspace.

Request Body schema: application/json
required
name
required
string (Name)
WorkspaceConfig (object) or null

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "config": {
    }
}

Response samples

Content type
application/json
{
  • "name": "string",
  • "config": {
    }
}

List Active Workspaces

List all active workspaces.

In it's current form, this function will only return one workspace. That is, the globally active workspace.

Responses

Response samples

Content type
application/json
{
  • "workspaces": [
    ]
}

Activate Workspace

Activate a workspace by name.

query Parameters
status_code
any (Status Code)
Default: 204
Request Body schema: application/json
required
name
required
string (Name)

Responses

Request samples

Content type
application/json
{
  • "name": "string"
}

Response samples

Content type
application/json
null

Update Workspace

Update a workspace.

path Parameters
workspace_name
required
string (Workspace Name)
Request Body schema: application/json
required
name
required
string (Name)
WorkspaceConfig (object) or null

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "config": {
    }
}

Response samples

Content type
application/json
{
  • "name": "string",
  • "config": {
    }
}

Delete Workspace

Delete a workspace by name.

path Parameters
workspace_name
required
string (Workspace Name)

Responses

Response samples

Content type
application/json
null

Get Workspace By Name

List workspaces by provider ID.

path Parameters
workspace_name
required
string (Workspace Name)

Responses

Response samples

Content type
application/json
{
  • "name": "string",
  • "config": {
    }
}

List Archived Workspaces

List all archived workspaces.

Responses

Response samples

Content type
application/json
{
  • "workspaces": [
    ]
}

Recover Workspace

Recover an archived workspace by name.

path Parameters
workspace_name
required
string (Workspace Name)

Responses

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

Hard Delete Workspace

Hard delete an archived workspace by name.

path Parameters
workspace_name
required
string (Workspace Name)

Responses

Response samples

Content type
application/json
null

Get Workspace Alerts

Get alerts for a workspace.

path Parameters
workspace_name
required
string (Workspace Name)

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get Workspace Alerts Summary

Get alert summary for a workspace.

path Parameters
workspace_name
required
string (Workspace Name)

Responses

Response samples

Content type
application/json
{
  • "malicious_packages": 0,
  • "pii": 0,
  • "secrets": 0,
  • "total_alerts": 0
}

Get Workspace Messages

Get messages for a workspace.

path Parameters
workspace_name
required
string (Workspace Name)
query Parameters
page
integer (Page) >= 1
Default: 1
page_size
integer (Page Size) [ 1 .. 100 ]
Default: 50
Array of Filter By Ids (strings) or Filter By Ids (null) (Filter By Ids)
Array of Filter By Alert Trigger Types (strings) or Filter By Alert Trigger Types (null) (Filter By Alert Trigger Types)

Responses

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "limit": 0,
  • "offset": 0,
  • "total": 0
}

Get Messages By Prompt Id

Get messages for a workspace.

path Parameters
workspace_name
required
string (Workspace Name)
prompt_id
required
string (Prompt Id)

Responses

Response samples

Content type
application/json
{
  • "question_answers": [
    ],
  • "provider": "string",
  • "type": "chat",
  • "chat_id": "string",
  • "conversation_timestamp": "2019-08-24T14:15:22Z",
  • "token_usage_agg": {
    },
  • "alerts": [ ]
}

Get Workspace Custom Instructions

Get the custom instructions of a workspace.

path Parameters
workspace_name
required
string (Workspace Name)

Responses

Response samples

Content type
application/json
{
  • "prompt": "string"
}

Set Workspace Custom Instructions

path Parameters
workspace_name
required
string (Workspace Name)
Request Body schema: application/json
required
prompt
required
string (Prompt)

Responses

Request samples

Content type
application/json
{
  • "prompt": "string"
}

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

Delete Workspace Custom Instructions

path Parameters
workspace_name
required
string (Workspace Name)

Responses

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

Get Workspace Muxes

Get the mux rules of a workspace.

The list is ordered in order of priority. That is, the first rule in the list has the highest priority.

path Parameters
workspace_name
required
string (Workspace Name)

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Set Workspace Muxes

Set the mux rules of a workspace.

path Parameters
workspace_name
required
string (Workspace Name)
Request Body schema: application/json
required
Array
provider_name
required
string (Provider Name)
provider_type
required
string (ProviderType)
Enum: "openai" "anthropic" "vllm" "ollama" "lm_studio" "llamacpp" "openrouter"

Represents the different types of providers we support.

model
required
string (Model)
matcher_type
required
string (MuxMatcherType)
Enum: "catch_all" "filename_match" "fim_filename" "chat_filename"

Represents the different types of matchers we support.

The 3 rules present match filenames and request types. They're used in conjunction with the matcher field in the MuxRule model. E.g.

  • catch_all-> Always match
  • filename_match and match: requests.py -> Match the request if the filename is requests.py
  • fim_filename and match: main.py -> Match the request if the request type is fim and the filename is main.py

NOTE: Removing or updating fields from this enum will require a migration. Adding new fields is safe.

Matcher (string) or Matcher (null) (Matcher)

Responses

Request samples

Content type
application/json
[
  • {
    }
]

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

Get Workspace Token Usage

Get the token usage of a workspace.

path Parameters
workspace_name
required
string (Workspace Name)

Responses

Response samples

Content type
application/json
{
  • "tokens_by_model": {
    },
  • "token_usage": {
    }
}

Muxes

Get Workspace Muxes

Get the mux rules of a workspace.

The list is ordered in order of priority. That is, the first rule in the list has the highest priority.

path Parameters
workspace_name
required
string (Workspace Name)

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Set Workspace Muxes

Set the mux rules of a workspace.

path Parameters
workspace_name
required
string (Workspace Name)
Request Body schema: application/json
required
Array
provider_name
required
string (Provider Name)
provider_type
required
string (ProviderType)
Enum: "openai" "anthropic" "vllm" "ollama" "lm_studio" "llamacpp" "openrouter"

Represents the different types of providers we support.

model
required
string (Model)
matcher_type
required
string (MuxMatcherType)
Enum: "catch_all" "filename_match" "fim_filename" "chat_filename"

Represents the different types of matchers we support.

The 3 rules present match filenames and request types. They're used in conjunction with the matcher field in the MuxRule model. E.g.

  • catch_all-> Always match
  • filename_match and match: requests.py -> Match the request if the filename is requests.py
  • fim_filename and match: main.py -> Match the request if the request type is fim and the filename is main.py

NOTE: Removing or updating fields from this enum will require a migration. Adding new fields is safe.

Matcher (string) or Matcher (null) (Matcher)

Responses

Request samples

Content type
application/json
[
  • {
    }
]

Response samples

Content type
application/json
{
  • "detail": [
    ]
}

Dashboard

Stream Sse

Send alerts event

Responses

Response samples

Content type
application/json
null

Version Check

Responses

Response samples

Content type
application/json
null

Token Usage

Get Workspace Token Usage

Get the token usage of a workspace.

path Parameters
workspace_name
required
string (Workspace Name)

Responses

Response samples

Content type
application/json
{
  • "tokens_by_model": {
    },
  • "token_usage": {
    }
}

Personas

List Personas

List all personas.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Create Persona

Create a new persona.

Request Body schema: application/json
required
name
required
string (Name)
description
required
string (Description)

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "description": "string"
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "name": "string",
  • "description": "string"
}

Get Persona

Get a persona by name.

path Parameters
persona_name
required
string (Persona Name)

Responses

Response samples

Content type
application/json
{
  • "id": "string",
  • "name": "string",
  • "description": "string"
}

Update Persona

Update an existing persona.

path Parameters
persona_name
required
string (Persona Name)
Request Body schema: application/json
required
new_name
required
string (New Name)
new_description
required
string (New Description)

Responses

Request samples

Content type
application/json
{
  • "new_name": "string",
  • "new_description": "string"
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "name": "string",
  • "description": "string"
}

Delete Persona

Delete a persona.

path Parameters
persona_name
required
string (Persona Name)

Responses

Response samples

Content type
application/json
{
  • "detail": [
    ]
}