AI Providers

List AI providers

Code samples

# Example request using curl curl -X GET http://coder-server:8080/api/v2/ai/providers \ -H 'Accept: application/json' \ -H 'Coder-Session-Token: API_KEY'

GET /api/v2/ai/providers

Example responses

200 Response

[ { "api_keys": [ { "created_at": "2019-08-24T14:15:22Z", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "masked": "string" } ], "base_url": "string", "created_at": "2019-08-24T14:15:22Z", "display_name": "string", "enabled": true, "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "name": "string", "settings": {}, "type": "openai", "updated_at": "2019-08-24T14:15:22Z" } ]

Responses

StatusMeaningDescriptionSchema
200OKOKarray of codersdk.AIProvider

Response Schema

Status Code 200

NameTypeRequiredRestrictionsDescription
[array item]arrayfalse
» api_keysarrayfalse
»» created_atstring(date-time)false
»» idstring(uuid)false
»» maskedstringfalse
» base_urlstringfalse
» created_atstring(date-time)false
» display_namestringfalse
» enabledbooleanfalse
» idstring(uuid)false
» namestringfalse
» settingscodersdk.AIProviderSettingsfalse
» typecodersdk.AIProviderTypefalse
» updated_atstring(date-time)false

Enumerated Values

PropertyValue(s)
typeanthropic, azure, bedrock, google, openai, openai-compat, openrouter, vercel

To perform this operation, you must be authenticated. Learn more.

Create an AI provider

Code samples

# Example request using curl curl -X POST http://coder-server:8080/api/v2/ai/providers \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Coder-Session-Token: API_KEY'

POST /api/v2/ai/providers

Body parameter

{ "api_keys": [ "string" ], "base_url": "string", "display_name": "string", "enabled": true, "name": "string", "settings": {}, "type": "openai" }

Parameters

NameInTypeRequiredDescription
bodybodycodersdk.CreateAIProviderRequesttrueCreate AI provider request

Example responses

201 Response

{ "api_keys": [ { "created_at": "2019-08-24T14:15:22Z", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "masked": "string" } ], "base_url": "string", "created_at": "2019-08-24T14:15:22Z", "display_name": "string", "enabled": true, "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "name": "string", "settings": {}, "type": "openai", "updated_at": "2019-08-24T14:15:22Z" }

Responses

StatusMeaningDescriptionSchema
201CreatedCreatedcodersdk.AIProvider

To perform this operation, you must be authenticated. Learn more.

Get an AI provider

Code samples

# Example request using curl curl -X GET http://coder-server:8080/api/v2/ai/providers/{idOrName} \ -H 'Accept: application/json' \ -H 'Coder-Session-Token: API_KEY'

GET /api/v2/ai/providers/{idOrName}

Parameters

NameInTypeRequiredDescription
idOrNamepathstringtrueProvider ID or name

Example responses

200 Response

{ "api_keys": [ { "created_at": "2019-08-24T14:15:22Z", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "masked": "string" } ], "base_url": "string", "created_at": "2019-08-24T14:15:22Z", "display_name": "string", "enabled": true, "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "name": "string", "settings": {}, "type": "openai", "updated_at": "2019-08-24T14:15:22Z" }

Responses

StatusMeaningDescriptionSchema
200OKOKcodersdk.AIProvider

To perform this operation, you must be authenticated. Learn more.

Delete an AI provider

Code samples

# Example request using curl curl -X DELETE http://coder-server:8080/api/v2/ai/providers/{idOrName} \ -H 'Coder-Session-Token: API_KEY'

DELETE /api/v2/ai/providers/{idOrName}

Parameters

NameInTypeRequiredDescription
idOrNamepathstringtrueProvider ID or name

Responses

StatusMeaningDescriptionSchema
204No ContentNo Content

To perform this operation, you must be authenticated. Learn more.

Update an AI provider

Code samples

# Example request using curl curl -X PATCH http://coder-server:8080/api/v2/ai/providers/{idOrName} \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Coder-Session-Token: API_KEY'

PATCH /api/v2/ai/providers/{idOrName}

Body parameter

{ "api_keys": [ { "api_key": "string", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08" } ], "base_url": "string", "display_name": "string", "enabled": true, "settings": {} }

Parameters

NameInTypeRequiredDescription
idOrNamepathstringtrueProvider ID or name
bodybodycodersdk.UpdateAIProviderRequesttrueUpdate AI provider request

Example responses

200 Response

{ "api_keys": [ { "created_at": "2019-08-24T14:15:22Z", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "masked": "string" } ], "base_url": "string", "created_at": "2019-08-24T14:15:22Z", "display_name": "string", "enabled": true, "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "name": "string", "settings": {}, "type": "openai", "updated_at": "2019-08-24T14:15:22Z" }

Responses

StatusMeaningDescriptionSchema
200OKOKcodersdk.AIProvider

To perform this operation, you must be authenticated. Learn more.