跳轉到主要內容

Documentation Index

Fetch the complete documentation index at: https://docs.lemondata.cc/llms.txt

Use this file to discover all available pages before exploring further.

概覽

使用 /v1/translations 進行文字對文字翻譯
這個 endpoint 與 音訊翻譯 不同,後者會接收音訊檔案,並且一律輸出英文文字。
針對 agent workflow,建議先找出目前推薦的翻譯 model:
curl "https://api.lemondata.cc/v1/models?recommended_for=translation" \
  -H "Authorization: Bearer sk-your-api-key"
接著把選定的 model 明確傳給 /v1/translations
recommended_for=translation 只適用於文字翻譯POST /v1/translations),不適用於 音訊翻譯

請求主體

model
string
必填
/v1/models?recommended_for=translation 回傳的翻譯 model ID。
text
string
必填
要翻譯的來源文字。
target_language
string
必填
目標語言代碼或語言名稱,取決於 model 支援情況。
source_language
string
選用的來源語言提示。
mime_type
string
預設值:"text/plain"
來源文字格式。支援值:text/plaintext/html
user
string
選用的終端使用者識別碼,用於濫用監控與請求追蹤。

回應

text
string
翻譯後的文字。
model
string
產生翻譯結果的 model。
source_language
string | null
model 偵測到或接受的來源語言。
target_language
string
本次請求使用的目標語言。
curl -X POST "https://api.lemondata.cc/v1/translations" \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-translation-pro",
    "text": "你好,歡迎使用 LemonData。",
    "target_language": "en"
  }'
{
  "text": "Hello, welcome to LemonData.",
  "model": "gemini-translation-pro",
  "source_language": "zh",
  "target_language": "en"
}