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(標準)。省略、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

需要協助嗎?