创建聊天补全
兼容 OpenAI 的 Chat Completions API。设置 stream=true 可接收 Server-Sent Events。响应和错误封装遵循 Chat Completions/OpenAI 兼容结构。
- 类型: stringX
- Felo - Channel 以逗号分隔、按顺序排列的公开通道代码。省略此请求头表示使用 default;default 必须单独使用。在钱包模式下,default 会从后往前扫描该模型实际生效的公开通道顺序,跳过未发布或不可用的通道,并选择第一个可用通道的提供方。它会纳入该提供方下上游模型 ID 和服务层级相同的可用端点。显式通道按客户端指定的顺序校验;仅提交第一个通道所属的提供方组。不会自动回退到其他提供方。旧版提供方请求头无法覆盖通道路由。
- 类型: array object[] · ChatMessage[] 1…messages必填
- content可为 null必填
- 类型: string
- role类型: string 枚举必填值
- system
- developer
- user
- assistant
- tool
- name类型: string
- tool类型: string
_call _id - tool类型: array object[]
_calls - property类型: anything
Name
- property类型: anything
Name
- 类型: stringmodel必填
- 类型: integermax
_completion _tokens 最小值:1Integer numbers.
- 类型: integermax
_tokens 最小值:1Integer numbers.
- 类型: integern最小值:1
Integer numbers.
- 类型: objectresponse
_format - property类型: anything
Name
- 类型: string | nullservice
_tier 目前仅支持 default(standard)。省略、null、别名以及不支持的字符串都会回退到 default;其他类型返回 HTTP 400。已配置的通道和价格保持不变。文本 API 发送提供方的标准值;Decisions 和生成类 API 省略该上游字段。
- 可为 nullstop
- 类型: string
- 类型: booleanstream
- 类型: numbertemperature最小值:0
- tool
_choice - 类型: string
- 类型: array object[]tools
- property类型: anything
Name
- 类型: anythingproperty
Name
- 类型: numbertop
_p 最小值:0最大值:1 - 类型: stringuser
- 类型: anythingproperty
Name
- 类型: object · ChatCompletionResponse200
聊天补全或流式响应
- 类型: array object[] · ChatChoice[]choices必填
- finish类型: string | null
_reason - index类型: integer
Integer numbers.
- logprobs类型: object | null
- property类型: anything
Name
- message类型: object · ChatMessage
- content可为 null必填
- 类型: string
- role类型: string 枚举必填值
- system
- developer
- user
- assistant
- tool
- name类型: string
- tool类型: string
_call _id - tool类型: array object[]
_calls - property类型: anything
Name
- property类型: anything
Name
- property类型: anything
Name
- 类型: stringid必填
- 类型: stringobject必填
非流式响应通常为 chat.completion。
- 类型: integer 格式: int64created
Signed 64-bit integers (long type).
- 类型: stringmodel
- 类型: stringsystem
_fingerprint - 类型: object · Usageusage
提供方用量对象。字段因端点和提供方而异。
- property类型: anything
Name
- 类型: anythingproperty
Name
- 类型: object · OpenAIErrorResponse400
请求、模型或提供方映射无效
兼容 OpenAI 的错误封装。Router 可能只包含 code 和 message,而不包含所有可选的上游字段。
- 类型: objecterror必填
- message类型: string必填
- code类型: string | null
- param类型: string | null
- type类型: string
提供时为 OpenAI 兼容的错误类型。
- property类型: anything
Name
- 类型: anythingproperty
Name
application/json - 类型: object · OpenAIErrorResponse401
Felo API 密钥无效或缺失
兼容 OpenAI 的错误封装。Router 可能只包含 code 和 message,而不包含所有可选的上游字段。
- 类型: objecterror必填
- message类型: string必填
- code类型: string | null
- param类型: string | null
- type类型: string
提供时为 OpenAI 兼容的错误类型。
- property类型: anything
Name
- 类型: anythingproperty
Name
application/json - 类型: object · OpenAIErrorResponse402
余额不足
兼容 OpenAI 的错误封装。Router 可能只包含 code 和 message,而不包含所有可选的上游字段。
- 类型: objecterror必填
- message类型: string必填
- code类型: string | null
- param类型: string | null
- type类型: string
提供时为 OpenAI 兼容的错误类型。
- property类型: anything
Name
- 类型: anythingproperty
Name
application/json - 类型: object · OpenAIErrorResponse403
该账户未获授权使用此模型。已停用的模型也会在调用上游之前被拒绝。已接受的请求和任务继续进行。
兼容 OpenAI 的错误封装。Router 可能只包含 code 和 message,而不包含所有可选的上游字段。
- 类型: objecterror必填
- message类型: string必填
- code类型: string | null
- param类型: string | null
- type类型: string
提供时为 OpenAI 兼容的错误类型。
- property类型: anything
Name
- 类型: anythingproperty
Name
application/json - 类型: object · OpenAIErrorResponse429
已达到消费或请求上限
兼容 OpenAI 的错误封装。Router 可能只包含 code 和 message,而不包含所有可选的上游字段。
- 类型: objecterror必填
- message类型: string必填
- code类型: string | null
- param类型: string | null
- type类型: string
提供时为 OpenAI 兼容的错误类型。
- property类型: anything
Name
- 类型: anythingproperty
Name
application/json - 类型: object · OpenAIErrorResponse502
上游提供方请求失败
兼容 OpenAI 的错误封装。Router 可能只包含 code 和 message,而不包含所有可选的上游字段。
- 类型: objecterror必填
- message类型: string必填
- code类型: string | null
- param类型: string | null
- type类型: string
提供时为 OpenAI 兼容的错误类型。
- property类型: anything
Name
- 类型: anythingproperty
Name
application/json - 类型: object · OpenAIErrorResponse503
提供方或计费服务不可用
兼容 OpenAI 的错误封装。Router 可能只包含 code 和 message,而不包含所有可选的上游字段。
- 类型: objecterror必填
- message类型: string必填
- code类型: string | null
- param类型: string | null
- type类型: string
提供时为 OpenAI 兼容的错误类型。
- property类型: anything
Name
- 类型: anythingproperty
Name
application/json
curl https://openapi.felo.ai/api/v1/chat/completions \
--request POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
--data '{
"model": "gpt-5.5",
"messages": [
{
"role": "user",
"content": "Write a one-sentence greeting."
}
],
"stream": false
}'
{
"id": "string",
"object": "string",
"created": 1,
"model": "string",
"choices": [
{
"index": 1,
"message": {
"role": "system",
"content": "string",
"name": "string",
"tool_call_id": "string",
"tool_calls": [
{
"additionalProperty": "anything"
}
],
"additionalProperty": "anything"
},
"finish_reason": null,
"logprobs": null,
"additionalProperty": "anything"
}
],
"usage": {
"additionalProperty": "anything"
},
"system_fingerprint": "string",
"additionalProperty": "anything"
}