跳到正文

从 DeepL 迁移

只需更改服务器 URL 和 DeepL 客户端库中的密钥,即可将 DeepL API 集成迁移到 VibeQL。

Markdown

VibeQL 提供 DeepL API 格式。您的代码和 DeepL 客户端库可以保持不变。只需更改两点:

  1. 服务器 URL:https://vibeql.com。
  2. 密钥:从API 页面获取的 VibeQL 密钥。

更改服务器 URL

client = deepl.DeepLClient(os.environ["VIBEQL_API_KEY"], server_url="https://vibeql.com")
const client = new deepl.DeepLClient(process.env.VIBEQL_API_KEY, { serverUrl: "https://vibeql.com" });
var client = new DeepLClient(apiKey, new DeepLClientOptions { ServerUrl = "https://vibeql.com" });
DeepLClient client = new DeepLClient(apiKey, new DeepLClientOptions().setServerUrl("https://vibeql.com"));
$client = new \DeepL\DeepLClient($apiKey, ['server_url' => 'https://vibeql.com']);
// DeepL has no official Go library. Change the base URL in your HTTP code.
const baseURL = "https://vibeql.com" // was https://api.deepl.com or https://api-free.deepl.com
req, _ := http.NewRequest("POST", baseURL+"/v2/translate", body)
req.Header.Set("Authorization", "DeepL-Auth-Key "+os.Getenv("VIBEQL_API_KEY"))
client = DeepL::Client.new(ENV.fetch('VIBEQL_API_KEY'), server_url: 'https://vibeql.com')

较早的 Translator 类接受相同的选项。使用较早的模块级 Ruby API 时,请在 DeepL.configure 中设置 config.host = 'https://vibeql.com'。

如果您通过纯 HTTP 调用 API,请将 https://api.deepl.com 或 https://api-free.deepl.com 替换为 https://vibeql.com。路径和参数保持不变。

哪些内容保持不变

  • 端点:POST /v2/translate、POST /v2/document、POST /v2/document/{id}、POST /v2/document/{id}/result、GET|POST /v2/usage、GET|POST /v2/languages 和 GET /v3/languages。
  • Authorization: DeepL-Auth-Key 请求头和旧版 auth_key 字段。
  • JSON 字段名,例如 translations、detected_source_language、document_id、document_key、seconds_remaining 和 billed_characters。
  • 文档状态:queued、translating、done、error。
  • 状态码:400、403、404、413、456、503。
  • 语言代码,包括 EN-US、PT-BR、ES-419 和 ZH-HANT。参见支持的语言。

有哪些不同

DeepL VibeQL
每个文档的最低消费 50,000 字符 无。文档使用其自身的字符。
术语表 支持 不支持。glossary_id 会被忽略,术语表端点也不存在。
正式程度 部分语言支持 不支持。formality 会被忽略,supports_formality 为 false。
detected_source_language 开启 /v2/translate 检测到的语言 您指定的 source_lang;如果未指定,则为 EN
其他 DeepL API,例如 DeepL Write 支持 不可用
文档格式 多种 DOCX、PPTX、PDF、TXT
价格 参见 DeepL 参见价格

译文来自 AI 翻译模型,因此相同文本的措辞可能与 DeepL 的输出不同。在切换全部流量之前,请先用您自己的内容做抽样测试。

验证切换

curl https://vibeql.com/v2/usage \
  -H "Authorization: DeepL-Auth-Key $VIBEQL_API_KEY"

如果返回 200 响应,且包含 character_count 和 character_limit,则说明 URL 和密钥均可用。