生成詞彙表
API 版本 2026-10-affable-towhee
post https://api.getlingara.com/v1/vocab/stream
用串流方式傳送指定程度嘅詞語清單。串流會先傳送附有清單詳情嘅 started,跟住每個詞傳送一個 item 事件,最後傳送 done。清單未準備好之前,只會傳送保持連線嘅註解。
權限範圍 vocab:generate
參數
Lingara-Versionheaderstring選填- 回應呢個請求所用嘅 API 版本。冇呢個嘅話,存取權杖會用佢嘅用戶端綁定嘅版本,冇權杖嘅請求會用而家嘅版本。仲喺開發中嘅版本,只可以喺度指明先用到。唔認得嘅版本會回
400,代碼係api_version_unknown。GET /v1/versions會列出所有版本。
請求內容 application/json
levelinteger必填source_langstring必填target_langstring必填countinteger | null選填
回應
200 詞彙表,每個事件一個詞
串流事件 text/event-stream
每 15 秒送出一條 keepalive 註解。
-
startedVocabStarted -
metaVocabMeta必填levelinteger必填source_langstring必填target_langstring必填frameworkstring必填countinteger必填ai_generatedboolean必填
-
itemVocabItem -
wordstring必填pronunciationstring | null選填readingstring | null選填translationstring必填exampleVocabExample | null選填sentencestring必填translationstring必填
image_urlstring | null選填
-
doneDone 結束串流 -
errorStreamError 結束串流 -
喺 200 回應入面到達。狀態行已經送出,所以串流開咗之後嘅失敗會以呢個事件報告。
codestring必填messagestring必填plan_idstring | null選填
錯誤
402application/json- 一個按用量收費嘅用戶端嘅呼叫,喺佢用任何嘢之前已經被拒絕。
spend_cap_reached:用戶端或者佢嘅帳戶已經到咗每月嘅支出上限;請喺整合頁面調高上限。metered_billing_inactive:呢個帳戶嘅按用量收費未啟用;請喺整合頁面設定,或者更新付款方式。 410application/json- 回應呢個請求所用嘅 API 版本已經停用。請喺
Lingara-Version傳一個有支援嘅版本,或者將用戶端綁去另一個版本。 4XXapplication/json- 請求被拒絕。
code講出原因,error用文字解釋。 503application/json · text/plain- 服務暫時用唔到;請等
Retry-After入面嘅秒數之後再試。維護期間,回應內容係純文字,而唔係錯誤封包。 5XXapplication/json- 請求被拒絕。
code講出原因,error用文字解釋。
codestring必填請求被拒絕嘅原因,係一個穩定嘅代碼,可以用嚟做分支處理:例如
insufficient_scope(403)、rate_limited(429),對按用量收費嘅用戶端仲有spend_cap_reached(402)同metered_billing_inactive(402)。errorstring必填
例子
串流例子
event: started
data: {"meta":{"level":2,"source_lang":"en","target_lang":"zh","framework":"HSK","count":2,"ai_generated":true}}
event: item
data: {"word":"你好","pronunciation":"nǐ hǎo","translation":"hello","example":{"sentence":"你好,我叫小明。","translation":"Hello, my name is Xiaoming."}}
event: item
data: {"word":"谢谢","pronunciation":"xiè xie","translation":"thank you"}
event: done
data: {}如果譯本同英文參考文件有出入,以英文參考文件為準。