Felo API PlatformFelo API Platform
v0.4.0
OpenAPI 3.1.0

创建聊天补全

服务器:https://openapi.felo.ai
客户端库

创建聊天补全

​

兼容 OpenAI 的 Chat Completions API。设置 stream=true 可接收 Server-Sent Events。响应和错误封装遵循 Chat Completions/OpenAI 兼容结构。

请求头
  • X-Felo-Channel
    类型: string

    以逗号分隔、按顺序排列的公开通道代码。省略此请求头表示使用 default;default 必须单独使用。在钱包模式下,default 会从后往前扫描该模型实际生效的公开通道顺序,跳过未发布或不可用的通道,并选择第一个可用通道的提供方。它会纳入该提供方下上游模型 ID 和服务层级相同的可用端点。显式通道按客户端指定的顺序校验;仅提交第一个通道所属的提供方组。不会自动回退到其他提供方。旧版提供方请求头无法覆盖通道路由。

请求体·ChatCompletionRequest
必填
application/json
  • messages
    类型: array object[] · ChatMessage[] 1…
    必填
    • content
      可为 null
      必填
      • 类型: string
    • role
      类型: string 枚举
      必填
      值
      • system
      • developer
      • user
      • assistant
      • tool
    • name
      类型: string
    • tool_call_id
      类型: string
    • tool_calls
      类型: array object[]
      • propertyName
        类型: anything
    • propertyName
      类型: anything
  • model
    类型: string
    必填
  • max_completion_tokens
    类型: integer
    最小值:  
    1

    Integer numbers.

  • max_tokens
    类型: integer
    最小值:  
    1

    Integer numbers.

  • n
    类型: integer
    最小值:  
    1

    Integer numbers.

  • response_format
    类型: object
    • propertyName
      类型: anything
  • service_tier
    类型: string | null

    目前仅支持 default(standard)。省略、null、别名以及不支持的字符串都会回退到 default;其他类型返回 HTTP 400。已配置的通道和价格保持不变。文本 API 发送提供方的标准值;Decisions 和生成类 API 省略该上游字段。

  • stop
    可为 null
    • 类型: string
  • stream
    类型: boolean
  • temperature
    类型: number
    最小值:  
    0
  • tool_choice
    • 类型: string
  • tools
    类型: array object[]
    • propertyName
      类型: anything
  • propertyName
    类型: anything
  • top_p
    类型: number
    最小值:  
    0
    最大值:  
    1
  • user
    类型: string
  • propertyName
    类型: anything
响应
  • 200
    类型: object · ChatCompletionResponse

    聊天补全或流式响应

    • choices
      类型: array object[] · ChatChoice[]
      必填
      • finish_reason
        类型: string | null
      • index
        类型: integer

        Integer numbers.

      • logprobs
        类型: object | null
        • propertyName
          类型: anything
      • message
        类型: object · ChatMessage
        • content
          可为 null
          必填
          • 类型: string
        • role
          类型: string 枚举
          必填
          值
          • system
          • developer
          • user
          • assistant
          • tool
        • name
          类型: string
        • tool_call_id
          类型: string
        • tool_calls
          类型: array object[]
          • propertyName
            类型: anything
        • propertyName
          类型: anything
      • propertyName
        类型: anything
    • id
      类型: string
      必填
    • object
      类型: string
      必填

      非流式响应通常为 chat.completion。

    • created
      类型: integer 格式: int64

      Signed 64-bit integers (long type).

    • model
      类型: string
    • system_fingerprint
      类型: string
    • usage
      类型: object · Usage

      提供方用量对象。字段因端点和提供方而异。

      • propertyName
        类型: anything
    • propertyName
      类型: anything
  • 400
    类型: object · OpenAIErrorResponse

    请求、模型或提供方映射无效

    兼容 OpenAI 的错误封装。Router 可能只包含 code 和 message,而不包含所有可选的上游字段。

    • error
      类型: object
      必填
      • message
        类型: string
        必填
      • code
        类型: string | null
      • param
        类型: string | null
      • type
        类型: string

        提供时为 OpenAI 兼容的错误类型。

      • propertyName
        类型: anything
    • propertyName
      类型: anything
    application/json
  • 401
    类型: object · OpenAIErrorResponse

    Felo API 密钥无效或缺失

    兼容 OpenAI 的错误封装。Router 可能只包含 code 和 message,而不包含所有可选的上游字段。

    • error
      类型: object
      必填
      • message
        类型: string
        必填
      • code
        类型: string | null
      • param
        类型: string | null
      • type
        类型: string

        提供时为 OpenAI 兼容的错误类型。

      • propertyName
        类型: anything
    • propertyName
      类型: anything
    application/json
  • 402
    类型: object · OpenAIErrorResponse

    余额不足

    兼容 OpenAI 的错误封装。Router 可能只包含 code 和 message,而不包含所有可选的上游字段。

    • error
      类型: object
      必填
      • message
        类型: string
        必填
      • code
        类型: string | null
      • param
        类型: string | null
      • type
        类型: string

        提供时为 OpenAI 兼容的错误类型。

      • propertyName
        类型: anything
    • propertyName
      类型: anything
    application/json
  • 403
    类型: object · OpenAIErrorResponse

    该账户未获授权使用此模型。已停用的模型也会在调用上游之前被拒绝。已接受的请求和任务继续进行。

    兼容 OpenAI 的错误封装。Router 可能只包含 code 和 message,而不包含所有可选的上游字段。

    • error
      类型: object
      必填
      • message
        类型: string
        必填
      • code
        类型: string | null
      • param
        类型: string | null
      • type
        类型: string

        提供时为 OpenAI 兼容的错误类型。

      • propertyName
        类型: anything
    • propertyName
      类型: anything
    application/json
  • 429
    类型: object · OpenAIErrorResponse

    已达到消费或请求上限

    兼容 OpenAI 的错误封装。Router 可能只包含 code 和 message,而不包含所有可选的上游字段。

    • error
      类型: object
      必填
      • message
        类型: string
        必填
      • code
        类型: string | null
      • param
        类型: string | null
      • type
        类型: string

        提供时为 OpenAI 兼容的错误类型。

      • propertyName
        类型: anything
    • propertyName
      类型: anything
    application/json
  • 502
    类型: object · OpenAIErrorResponse

    上游提供方请求失败

    兼容 OpenAI 的错误封装。Router 可能只包含 code 和 message,而不包含所有可选的上游字段。

    • error
      类型: object
      必填
      • message
        类型: string
        必填
      • code
        类型: string | null
      • param
        类型: string | null
      • type
        类型: string

        提供时为 OpenAI 兼容的错误类型。

      • propertyName
        类型: anything
    • propertyName
      类型: anything
    application/json
  • 503
    类型: object · OpenAIErrorResponse

    提供方或计费服务不可用

    兼容 OpenAI 的错误封装。Router 可能只包含 code 和 message,而不包含所有可选的上游字段。

    • error
      类型: object
      必填
      • message
        类型: string
        必填
      • code
        类型: string | null
      • param
        类型: string | null
      • type
        类型: string

        提供时为 OpenAI 兼容的错误类型。

      • propertyName
        类型: anything
    • propertyName
      类型: anything
    application/json
Request Example for post/api/v1/chat/completions
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"
}
Create a chat completion

需要帮助?