Felo API PlatformFelo API Platform
v0.4.0
OpenAPI 3.1.0

建立 Claude 訊息

伺服器:https://openapi.felo.ai
用戶端程式庫

建立 Claude 訊息

​

相容於 Claude Messages API 的端點。設定 stream=true 即可接收 Claude 風格的訊息串流事件。請求、回應與驗證錯誤欄位皆遵循 Claude Messages 協定;若發生基礎設施故障,Router 也可能傳回經過清理的閘道錯誤封裝。

請求標頭
  • X-Felo-Channel
    類型: string

    依序排列、以逗號分隔的公開頻道代碼。省略此標頭即使用 default;default 必須單獨使用。在錢包模式下,default 會反向掃描模型實際生效的公開頻道順序,略過未發布或不可用的頻道,並選用第一個可用頻道所屬的供應商。它會納入該供應商底下具有相同上游模型 ID 與服務層級的可用端點。明確指定的頻道會依用戶端指定的順序驗證;只會提交第一個頻道所屬的供應商群組。不會自動回退至其他供應商。舊版的供應商標頭無法覆寫頻道路由。

請求本文·ClaudeMessagesRequest
必填
application/json
  • max_tokens
    類型: integer
    最小值:  
    1
    必填

    Integer numbers.

  • messages
    類型: array object[] · ClaudeMessage[] 1…
    必填

    Use a document block for a PDF or an image block for a picture. Set source to {type: 'file', file_id: 'felo_file_...'} for an uploaded Felo attachment, {type: 'url', url: 'https://...'} for an HTTPS URL, or provide type, media_type and data for a base64 source. PDF and image URL support are enabled per model.

    • content
      必填
      • 類型: string
    • role
      類型: string 列舉
      必填
      值
      • user
      • assistant
    • propertyName
      類型: anything
  • model
    類型: string
    必填
  • metadata
    類型: object
    • propertyName
      類型: anything
  • service_tier
    類型: string | null

    目前僅支援 default(標準)。省略、null、別名以及不受支援的字串都會回退為 default;其他類型則傳回 HTTP 400。已設定的頻道與價格維持不變。文字 API 會傳送供應商的標準值;Decisions 與生成 API 則會省略上游欄位。

  • stop_sequences
    類型: array string[]
  • stream
    類型: boolean
  • system
    • 類型: string
  • temperature
    類型: number
    最小值:  
    0
    最大值:  
    1
  • thinking
    類型: object
    • propertyName
      類型: anything
  • tool_choice
    • 類型: string
  • tools
    類型: array object[]
    • propertyName
      類型: anything
  • propertyName
    類型: anything
  • top_k
    類型: integer
    最小值:  
    0

    Integer numbers.

  • top_p
    類型: number
    最小值:  
    0
    最大值:  
    1
  • propertyName
    類型: anything
回應
  • 200
    類型: object · ClaudeMessageResponse

    Claude 訊息或串流回應

    • content
      類型: array object[] · ClaudeContentBlock[]
      必填
      • type
        類型: string 列舉
        必填
        值
        • text
        • image
        • document
        • tool_use
        • tool_result
        • thinking
      • content
        類型: string | array
      • id
        類型: string
      • input
        類型: object
        • propertyName
          類型: anything
      • name
        類型: string
      • source
        類型: object
        • propertyName
          類型: anything
      • text
        類型: string
      • propertyName
        類型: anything
    • id
      類型: string
      必填
    • model
      類型: string
      必填
    • role
      常數:  
      assistant
      必填
    • stop_reason
      類型: string | null
      必填
    • type
      常數:  
      message
      必填
    • stop_sequence
      類型: string | null
    • usage
      類型: object · Usage

      供應商用量物件。欄位會因端點與供應商而異。

      • propertyName
        類型: anything
    • propertyName
      類型: anything
  • 400
    類型: object · ClaudeErrorResponse

    Claude 的 invalid_request_error 或 Router 請求驗證錯誤

    用於 Messages 請求、相容於 Claude Errors API 的錯誤封裝。

    • error
      類型: object
      必填
      • message
        類型: string
        必填
      • type
        類型: string
        必填
      • propertyName
        類型: anything
    • type
      常數:  
      error
      必填
    • request_id
      類型: string
    • propertyName
      類型: anything
    application/json
  • 401
    類型: object · ClaudeErrorResponse

    Felo API 金鑰無效或未提供

    用於 Messages 請求、相容於 Claude Errors API 的錯誤封裝。

    • error
      類型: object
      必填
      • message
        類型: string
        必填
      • type
        類型: string
        必填
      • propertyName
        類型: anything
    • type
      常數:  
      error
      必填
    • request_id
      類型: string
    • propertyName
      類型: anything
    application/json
  • 402
    類型: object · ClaudeErrorResponse

    餘額不足

    用於 Messages 請求、相容於 Claude Errors API 的錯誤封裝。

    • error
      類型: object
      必填
      • message
        類型: string
        必填
      • type
        類型: string
        必填
      • propertyName
        類型: anything
    • type
      常數:  
      error
      必填
    • request_id
      類型: string
    • propertyName
      類型: anything
    application/json
  • 403
    類型: object · ClaudeErrorResponse

    此帳戶無權使用該模型。已停用的模型同樣會在上游呼叫前遭到拒絕。已受理的請求與任務將繼續執行。

    用於 Messages 請求、相容於 Claude Errors API 的錯誤封裝。

    • error
      類型: object
      必填
      • message
        類型: string
        必填
      • type
        類型: string
        必填
      • propertyName
        類型: anything
    • type
      常數:  
      error
      必填
    • request_id
      類型: string
    • propertyName
      類型: anything
    application/json
  • 429
    類型: object · ClaudeErrorResponse

    已達消費或請求上限

    用於 Messages 請求、相容於 Claude Errors API 的錯誤封裝。

    • error
      類型: object
      必填
      • message
        類型: string
        必填
      • type
        類型: string
        必填
      • propertyName
        類型: anything
    • type
      常數:  
      error
      必填
    • request_id
      類型: string
    • propertyName
      類型: anything
    application/json
  • 502
    類型: object · ClaudeErrorResponse

    上游供應商請求失敗

    用於 Messages 請求、相容於 Claude Errors API 的錯誤封裝。

    • error
      類型: object
      必填
      • message
        類型: string
        必填
      • type
        類型: string
        必填
      • propertyName
        類型: anything
    • type
      常數:  
      error
      必填
    • request_id
      類型: string
    • propertyName
      類型: anything
    application/json
  • 503
    類型: object · ClaudeErrorResponse

    供應商或計費服務暫時無法使用

    用於 Messages 請求、相容於 Claude Errors API 的錯誤封裝。

    • error
      類型: object
      必填
      • message
        類型: string
        必填
      • type
        類型: string
        必填
      • propertyName
        類型: anything
    • type
      常數:  
      error
      必填
    • request_id
      類型: string
    • propertyName
      類型: anything
    application/json
Request Example for post/api/v1/messages
curl https://openapi.felo.ai/api/v1/messages \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --data '{
  "model": "claude-sonnet-4-5",
  "max_tokens": 256,
  "messages": [
    {
      "role": "user",
      "content": "Write a one-sentence greeting."
    }
  ],
  "stream": false
}'
{
  "id": "string",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "string",
      "id": "string",
      "name": "string",
      "input": {
        "additionalProperty": "anything"
      },
      "content": "string",
      "source": {
        "additionalProperty": "anything"
      },
      "additionalProperty": "anything"
    }
  ],
  "model": "string",
  "stop_reason": null,
  "stop_sequence": null,
  "usage": {
    "additionalProperty": "anything"
  },
  "additionalProperty": "anything"
}
Create a Claude message

需要協助嗎?