curl --request POST \
--url https://api.omniall.ai/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-4o-mini",
"messages": [
{
"role": "user",
"content": "你好"
}
]
}
'{
"id": "chatcmpl-...",
"object": "chat.completion",
"created": 1710000000,
"model": "gpt-4o-mini",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello!"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 10,
"completion_tokens": 4,
"total_tokens": 14
}
}{
"error": {
"message": "<string>",
"type": "new_api_error",
"code": "<string>"
}
}{
"error": {
"message": "无效的令牌 (request id: ...)",
"type": "new_api_error",
"code": ""
}
}{
"error": {
"message": "<string>",
"type": "new_api_error",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "new_api_error",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "new_api_error",
"code": "<string>"
}
}Chat Completions 对话
Omniall AI 转发的 OpenAI Chat Completions 接口。支持多模态、流式、工具调用与结构化输出。
curl --request POST \
--url https://api.omniall.ai/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-4o-mini",
"messages": [
{
"role": "user",
"content": "你好"
}
]
}
'{
"id": "chatcmpl-...",
"object": "chat.completion",
"created": 1710000000,
"model": "gpt-4o-mini",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello!"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 10,
"completion_tokens": 4,
"total_tokens": 14
}
}{
"error": {
"message": "<string>",
"type": "new_api_error",
"code": "<string>"
}
}{
"error": {
"message": "无效的令牌 (request id: ...)",
"type": "new_api_error",
"code": ""
}
}{
"error": {
"message": "<string>",
"type": "new_api_error",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "new_api_error",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "new_api_error",
"code": "<string>"
}
}授权
使用来自 https://omniall.ai/dashboard 的 Authorization: Bearer sk-...
请求体
OpenAI Chat Completions 请求体(POST /v1/chat/completions)。字段映射到网关 GeneralOpenAIRequest。
模型广场 / GET /v1/models 中的模型 ID,须为当前 Key 可访问的模型。
"gpt-4o"
完整对话历史,按时间从早到晚。按需包含 system/user/assistant/tool 轮次。
Show child attributes
Show child attributes
为 true 时返回 SSE(chat.completion.chunk),而非单个 JSON 对象。
流式输出
Show child attributes
Show child attributes
采样温度(约 0–2)。越高越随机;0 更稳定。
0 <= x <= 2核采样概率质量(0–1)。建议主要调 temperature 或 top_p 之一,勿同时大幅调整。
0 <= x <= 1上游模型支持时的 Top-K 采样(部分 OpenAI 模型会忽略)。
为该提示生成多少条补全(费用随 n 增加)。
x >= 1旧版补全最大 token。新版 OpenAI 模型请优先用 max_completion_tokens。
模型最多可生成的 token 数(新版 OpenAI 聊天模型推荐)。
停止序列。生成到任一序列即结束。
根据是否已出现过惩罚新 token(−2 到 2)。正值更鼓励新话题。
-2 <= x <= 2按词频惩罚 token(−2 到 2)。正值减少重复。
-2 <= x <= 2厂商支持时的尽力确定性种子。
用于滥用监控的稳定终端用户 id(不透明字符串)。请勿放入密钥。
token-id → 偏置映射,用于封禁/增强特定 token(厂商相关)。
Show child attributes
Show child attributes
是否返回输出 token 的对数概率。
启用 logprobs 时每个位置返回的最可能 token 数。
强制输出形态。json_object 要求合法 JSON;json_schema 要求符合你的 schema
Show child attributes
Show child attributes
可供模型在 Agent 流程中使用的函数工具。
Show child attributes
Show child attributes
控制工具使用:none / auto / required,或强制某个函数。
none, auto, required 模型是否可在一轮内调用多个工具。
o 系列 / 兼容模型的推理强度(low / medium / high)。
low, medium, high 请求的输出模态,如 text、audio。
text, audio 使用音频模态时的音频输出设置。
模型支持搜索时的 OpenAI 风格联网选项。
Show child attributes
Show child attributes
通义风格联网开关(视渠道/模型而定)。
厂商特定联网对象(如百度)。
xAI 搜索参数对象。
豆包 / 智谱思考控制。
通义思考开关。
额外厂商字段(OpenAI 兼容路径上有时用于 Gemini 相关选项)。
支持时任意元数据透传。
可预知部分答案时的预测输出提示,用于降低延迟。
响应
Chat Completions JSON;当 stream=true 时为 SSE 流。
非流式 Chat Completions 响应。