Request Body
组成对话的消息列表。每个消息对象包含:
role(string):system,user, orassistantcontent(string | array): The message content
content is an array, LemonData supports structured multimodal blocks for compatible models:- text:
{ "type": "text", "text": "..." } - image:
{ "type": "image_url", "image_url": { "url": "https://..." } } - video:
{ "type": "video_url", "video_url": { "url": "https://..." } } - audio:
{ "type": "audio_url", "audio_url": { "url": "https://..." } }
https URLs. LemonData will translate these media blocks into the provider-specific request shape required by the routed physical model.采样温度,范围在 0 到 2 之间。较高的值会使输出更随机。
要生成的最大 token 数。
如果为 true,则部分消息增量将作为 SSE events 发送。
流式传输选项。设置
include_usage: true 以在流分片中接收 token 使用情况。Nucleus 采样参数。建议更改此参数或 temperature,而不是同时更改两者。
值在 -2.0 到 2.0 之间。正值会惩罚重复出现的 token。
值在 -2.0 到 2.0 之间。正值会惩罚已出现在文本中的 token。
最多 4 个序列,API 在遇到这些序列时会停止生成 token。
模型可能调用的工具列表(函数调用)。
控制模型如何使用工具。选项:
auto, none, required, 或特定工具对象。是否启用并行函数调用。设置为 false 则按顺序调用函数。
补全的最大 token 数。作为
max_tokens 的替代,对于启用推理的新模型系列更有用。启用推理的模型的推理强度。选项:
low, medium, high。用于确定性采样的随机种子。
要生成的补全数量(1-128)。
是否返回对数概率(log probabilities)。
要返回的顶级对数概率数量(0-20)。需要
logprobs: true。Top-K 采样参数(用于 Anthropic/Gemini 模型)。
响应格式规范。使用
{"type": "json_object"} 进入 JSON 模式。将 {"type": "json_schema", "json_schema": {...}} 视为一条基于所选模型和路由行为的尽力支持路径。修改指定 token 出现的可能性。将 token ID(以字符串形式)映射到 -100 到 100 的偏差值。
表示您最终用户的唯一标识符,用于滥用监控。
LemonData 缓存控制选项。
type(string): 缓存策略 -default,no_cache,no_store,response_only,semantic_onlymax_age(integer): 缓存 TTL(秒),最大 86400
Response
补全的唯一标识符。
始终为
chat.completion。补全创建时的 Unix 时间戳。
用于补全的模型。
补全选项列表。每个选项包含:
index(integer): 选项的索引message(object): 生成的消息finish_reason(string): 模型停止的原因(stop,length,tool_calls)
token 使用统计。
prompt_tokens(integer): 提示中的 token 数completion_tokens(integer): 补全中的 token 数total_tokens(integer): 使用的总 token 数