生成词汇表
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: {}如译文与英文参考文档不一致,以英文参考文档为准。