從 DeepL 轉移
只要變更 DeepL 用戶端程式庫中的伺服器 URL 和金鑰,就能將 DeepL API 整合遷移到 VibeQL。
VibeQL 提供 DeepL API 格式。您可以保留原有程式碼和 DeepL 用戶端程式庫,只需變更兩件事:
- 伺服器 URL:
https://vibeql.com。 - 金鑰:來自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 與金鑰皆可正常運作。