mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
10 KiB
Generated
10 KiB
Generated
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
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | array of codersdk.AIProvider |
Response Schema
Status Code 200
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
[array item] |
array | false | ||
» api_keys |
array | false | ||
»» created_at |
string(date-time) | false | ||
»» id |
string(uuid) | false | ||
»» masked |
string | false | ||
» base_url |
string | false | ||
» created_at |
string(date-time) | false | ||
» display_name |
string | false | ||
» enabled |
boolean | false | ||
» id |
string(uuid) | false | ||
» name |
string | false | ||
» settings |
codersdk.AIProviderSettings | false | ||
» type |
codersdk.AIProviderType | false | ||
» updated_at |
string(date-time) | false |
Enumerated Values
| Property | Value(s) |
|---|---|
type |
anthropic, azure, bedrock, copilot, 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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
body |
body | codersdk.CreateAIProviderRequest | true | Create 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
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 201 | Created | Created | codersdk.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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
idOrName |
path | string | true | Provider 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
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | codersdk.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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
idOrName |
path | string | true | Provider ID or name |
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 204 | No Content | No 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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
idOrName |
path | string | true | Provider ID or name |
body |
body | codersdk.UpdateAIProviderRequest | true | Update 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
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | codersdk.AIProvider |
To perform this operation, you must be authenticated. Learn more.