到 Hugging Face 註冊帳號
到 Access Tokens 頁面建立一個 token
scope:選 read
copy token,格式像這樣:
hf_xxxxxxxxxxxxxxxxxxxxx

我們用 Hugging Face 提供的免費翻譯模型:


Manual Trigger → 手動觸發
Set Node → 輸入要翻譯的文字
text
今天天氣很好,我想去公園散步

3. HTTP Request (Hugging Face) → 呼叫翻譯 API
Method: POST
URL:
https://api-inference.huggingface.co/models/Helsinki-NLP/opus-mt-zh-en
https://api-inference.huggingface.co/models/Helsinki-NLP/opus-mt-en-zh
Authentication: None
Headers:
Authorization: Bearer hf_xxxxx
Content-Type: application/json
Body Parameters → 選 JSON
inputs
={{ $json.text }}

Function Node (格式化翻譯結果)
return [{
json: {
original: $json.text,
translation: $json[0].translation_text
}
}];

{
"original": "今天天氣很好,我想去公園散步",
"translation": "The weather is nice today, I want to take a walk in the park."
}
完成!