更新 Devin Desktop 模型允许列表
curl --request PUT \
--url https://server.codeium.com/api/v2alpha/models \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'If-Match: <if-match>' \
--data '
{
"allowed_model_uids": [
"<string>"
],
"allowed_model_tags": [
"<string>"
]
}
'import requests
url = "https://server.codeium.com/api/v2alpha/models"
payload = {
"allowed_model_uids": ["<string>"],
"allowed_model_tags": ["<string>"]
}
headers = {
"If-Match": "<if-match>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'If-Match': '<if-match>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({allowed_model_uids: ['<string>'], allowed_model_tags: ['<string>']})
};
fetch('https://server.codeium.com/api/v2alpha/models', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://server.codeium.com/api/v2alpha/models",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'allowed_model_uids' => [
'<string>'
],
'allowed_model_tags' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"If-Match: <if-match>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://server.codeium.com/api/v2alpha/models"
payload := strings.NewReader("{\n \"allowed_model_uids\": [\n \"<string>\"\n ],\n \"allowed_model_tags\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("If-Match", "<if-match>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://server.codeium.com/api/v2alpha/models")
.header("If-Match", "<if-match>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"allowed_model_uids\": [\n \"<string>\"\n ],\n \"allowed_model_tags\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://server.codeium.com/api/v2alpha/models")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["If-Match"] = '<if-match>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"allowed_model_uids\": [\n \"<string>\"\n ],\n \"allowed_model_tags\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_bodyAPI 参考文档
更新 Devin Desktop 模型允许列表
以编程方式替换您团队的 Devin Desktop 模型允许列表:设置允许的模型 UID 和标签,并通过 ETag 对照当前状态进行检查。
PUT
/
api
/
v2alpha
/
models
更新 Devin Desktop 模型允许列表
curl --request PUT \
--url https://server.codeium.com/api/v2alpha/models \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'If-Match: <if-match>' \
--data '
{
"allowed_model_uids": [
"<string>"
],
"allowed_model_tags": [
"<string>"
]
}
'import requests
url = "https://server.codeium.com/api/v2alpha/models"
payload = {
"allowed_model_uids": ["<string>"],
"allowed_model_tags": ["<string>"]
}
headers = {
"If-Match": "<if-match>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'If-Match': '<if-match>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({allowed_model_uids: ['<string>'], allowed_model_tags: ['<string>']})
};
fetch('https://server.codeium.com/api/v2alpha/models', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://server.codeium.com/api/v2alpha/models",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'allowed_model_uids' => [
'<string>'
],
'allowed_model_tags' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"If-Match: <if-match>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://server.codeium.com/api/v2alpha/models"
payload := strings.NewReader("{\n \"allowed_model_uids\": [\n \"<string>\"\n ],\n \"allowed_model_tags\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("If-Match", "<if-match>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://server.codeium.com/api/v2alpha/models")
.header("If-Match", "<if-match>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"allowed_model_uids\": [\n \"<string>\"\n ],\n \"allowed_model_tags\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://server.codeium.com/api/v2alpha/models")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["If-Match"] = '<if-match>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"allowed_model_uids\": [\n \"<string>\"\n ],\n \"allowed_model_tags\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body概述
替换您的团队的模型允许列表,该设置与 Admin 在 Devin Desktop 组织控制项中管理的设置相同。请求体即完整的目标状态:其中的两个列表会覆盖已存储的列表。 为避免覆盖你尚未看到的变更,请求必须在If-Match 中携带 List Models 响应返回的 ETag。如果在该响应之后,允许列表、可用模型或模型价格发生了变化,更新将被拒绝并返回 412,此时你需要重新列出模型。
此端点处于 alpha 阶段 (
v2alpha) ,请求和响应的结构可能会有所变化。身份验证
在Authorization 标头中传入 API 密钥:
Authorization: Bearer <api-key>
cog_...) 。除了 List Models 所需的 Use Devin Desktop 权限外,服务用户的角色还必须具有 Windsurf admin 权限 (account.windsurf.admin) ,内置的 Account Admin 角色已包含此权限。缺少该权限的服务用户虽然可以列出模型,但调用此端点时会返回 403。
请求
string
必填
GET /api/v2alpha/models 响应中的 ETag 标头,用于反映当前状态。必填;不接受 *。string[]
必填
用户可选择的模型 UID,例如
["claude-sonnet-4-5"]。传入 [] 表示仅按标签允许模型。string[]
必填
用户可选择的模型标签,包括
provider-anthropic、provider-openai 等提供商标签。传入 [] 表示仅允许所列的模型 UID。请求示例
ETAG=$(curl -s -D - -o /dev/null https://server.codeium.com/api/v2alpha/models \
-H "Authorization: Bearer $DEVIN_API_KEY" | awk 'tolower($1)=="etag:" {print $2}' | tr -d '\r')
curl -X PUT https://server.codeium.com/api/v2alpha/models \
-H "Authorization: Bearer $DEVIN_API_KEY" \
-H "If-Match: $ETAG" \
-H "Content-Type: application/json" \
-d '{"allowed_model_uids": ["claude-sonnet-4-5"], "allowed_model_tags": ["provider-anthropic"]}'
响应
成功时,返回的响应与 List Models 相同,并已应用新的允许列表:包含每个模型及其allowed 开关、已存储的 allowed_model_uids 和 allowed_model_tags,以及新的 ETag 标头。
错误响应
错误以{"error": "<message>"} 格式返回。
| 状态 | 原因 |
|---|---|
400 | 请求体不是 JSON、包含未知字段,或缺少 allowed_model_uids 或 allowed_model_tags;或设置了 filter 查询参数 (仅 List Models 接受该参数) |
401 | 缺少 API 密钥或 API 密钥无效,或使用了旧版 Windsurf API 密钥 (仅接受 Devin cog_... 服务用户密钥) |
403 | 该密钥所属用户没有 Devin Desktop 访问权限,或其角色缺少 Windsurf admin 权限 (account.windsurf.admin) |
412 | If-Match 与当前 ETag 不匹配;请重新列出模型后重试 |
428 | 缺少 If-Match 标头 |
429 | 超出速率限制;请等待 Retry-After 标头指定的时间后再重试 |

