PUT管理接口
更新实例级 AI 翻译配置
部分更新:只修改请求中出现的字段。`api_key` 传空字符串表示清除, 以 AES-256-GCM 加密落库,密钥派生自实例的 JWT_SECRET。 `base_url` 只填路径前缀,后缀按协议固定拼接: - `openai`:`{base_url}/chat/completions`,例如填 `https://api.openai.com/v1` - `anthropic`:`{base_url}/v1/messages`,例如填 `https://api.anthropic.com` `api_key` 可以留空:自建的 Ollama / vLLM 常常无鉴权,此时请求不带鉴权头。 `custom_prompt` 关闭时 `system_prompt` 一律被忽略,使用内置提示词。
URL
/api/v1/admin/translation鉴权方式
需要管理员 JWT(Authorization: Bearer <token>)
请求参数
Header 参数
| 名称 | 类型 | 必填 | 说明 |
|---|---|---|---|
| Authorization | string | 是 | Bearer <管理员 JWT 或 API Key> |
请求体
{
"enabled": true,
"provider": "openai",
"base_url": "https://api.openai.com/v1",
"api_key": "sk-...",
"model": "gpt-4o-mini"
}响应示例
200 响应
{
"configured": false,
"enabled": false,
"provider": "openai",
"base_url": "string",
"model": "string",
"has_api_key": false,
"api_key_fingerprint": "string",
"api_key_updated_at": 0,
"custom_prompt": false,
"system_prompt": "string",
"builtin_system_prompt": "string",
"prompt_variables": [
"string"
],
"request_url": "string",
"updated_at": 0
}PUT
