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

需要帮助?