Felo API PlatformFelo API Platform
v0.4.0
OpenAPI 3.1.0

Tạo một message Claude

Máy chủ:https://openapi.felo.ai
Thư viện client

Tạo một message Claude

​

Endpoint tương thích API Claude Messages. Đặt stream=true để nhận các sự kiện luồng message kiểu Claude. Các trường yêu cầu, phản hồi và lỗi kiểm tra tính hợp lệ tuân theo giao thức Claude Messages; Router cũng có thể trả về cấu trúc lỗi gateway đã được làm sạch cho các lỗi hạ tầng.

Header
  • X-Felo-Channel
    Kiểu: string

    Mã kênh công khai được phân tách bằng dấu phẩy, có thứ tự. Bỏ trống header này để dùng default; default phải được dùng một mình. Ở chế độ ví, default quét thứ tự kênh công khai hiệu dụng của mô hình theo chiều ngược, bỏ qua các kênh chưa xuất bản hoặc không khả dụng, và chọn nhà cung cấp của kênh khả dụng đầu tiên. Nó bao gồm các endpoint khả dụng của nhà cung cấp đó có cùng ID mô hình upstream và cùng hạng dịch vụ. Các kênh chỉ định rõ được kiểm tra theo thứ tự do client chỉ định; chỉ nhóm nhà cung cấp của kênh đầu tiên được gửi đi. Không tự động dự phòng sang nhà cung cấp khác. Header nhà cung cấp kiểu cũ không thể ghi đè định tuyến kênh.

Phần thân·ClaudeMessagesRequest
bắt buộc
application/json
  • max_tokens
    Kiểu: integer
    tối thiểu:  
    1
    bắt buộc

    Integer numbers.

  • messages
    Kiểu: array object[] · ClaudeMessage[] 1…
    bắt buộc
    • content
      bắt buộc
      • Kiểu: string
    • role
      Kiểu: string enum
      bắt buộc
      giá trị
      • user
      • assistant
    • propertyName
      Kiểu: anything
  • model
    Kiểu: string
    bắt buộc
  • metadata
    Kiểu: object
    • propertyName
      Kiểu: anything
  • service_tier
    Kiểu: string | null

    Hiện chỉ hỗ trợ default (tiêu chuẩn). Giá trị bị bỏ trống, null, các bí danh và chuỗi không được hỗ trợ đều quay về default; các loại khác trả về HTTP 400. Các kênh và giá đã cấu hình không thay đổi. API văn bản gửi giá trị tiêu chuẩn của nhà cung cấp; API Decisions và tạo nội dung bỏ qua trường upstream.

  • stop_sequences
    Kiểu: array string[]
  • stream
    Kiểu: boolean
  • system
    • Kiểu: string
  • temperature
    Kiểu: number
    tối thiểu:  
    0
    tối đa:  
    1
  • thinking
    Kiểu: object
    • propertyName
      Kiểu: anything
  • tool_choice
    • Kiểu: string
  • tools
    Kiểu: array object[]
    • propertyName
      Kiểu: anything
  • propertyName
    Kiểu: anything
  • top_k
    Kiểu: integer
    tối thiểu:  
    0

    Integer numbers.

  • top_p
    Kiểu: number
    tối thiểu:  
    0
    tối đa:  
    1
  • propertyName
    Kiểu: anything
Phản hồi
  • 200
    Kiểu: object · ClaudeMessageResponse

    Message Claude hoặc phản hồi streaming

    • content
      Kiểu: array object[] · ClaudeContentBlock[]
      bắt buộc
      • type
        Kiểu: string enum
        bắt buộc
        giá trị
        • text
        • image
        • document
        • tool_use
        • tool_result
        • thinking
      • content
        Kiểu: string | array
      • id
        Kiểu: string
      • input
        Kiểu: object
        • propertyName
          Kiểu: anything
      • name
        Kiểu: string
      • source
        Kiểu: object
        • propertyName
          Kiểu: anything
      • text
        Kiểu: string
      • propertyName
        Kiểu: anything
    • id
      Kiểu: string
      bắt buộc
    • model
      Kiểu: string
      bắt buộc
    • role
      const:  
      assistant
      bắt buộc
    • stop_reason
      Kiểu: string | null
      bắt buộc
    • type
      const:  
      message
      bắt buộc
    • stop_sequence
      Kiểu: string | null
    • usage
      Kiểu: object · Usage

      Đối tượng mức sử dụng của nhà cung cấp. Các trường thay đổi tùy theo endpoint và nhà cung cấp.

      • propertyName
        Kiểu: anything
    • propertyName
      Kiểu: anything
  • 400
    Kiểu: object · ClaudeErrorResponse

    invalid_request_error của Claude hoặc lỗi xác thực yêu cầu của Router

    Phong bì lỗi tương thích API Claude Errors cho các yêu cầu Messages.

    • error
      Kiểu: object
      bắt buộc
      • message
        Kiểu: string
        bắt buộc
      • type
        Kiểu: string
        bắt buộc
      • propertyName
        Kiểu: anything
    • type
      const:  
      error
      bắt buộc
    • request_id
      Kiểu: string
    • propertyName
      Kiểu: anything
    application/json
  • 401
    Kiểu: object · ClaudeErrorResponse

    Khóa API Felo không hợp lệ hoặc bị thiếu

    Phong bì lỗi tương thích API Claude Errors cho các yêu cầu Messages.

    • error
      Kiểu: object
      bắt buộc
      • message
        Kiểu: string
        bắt buộc
      • type
        Kiểu: string
        bắt buộc
      • propertyName
        Kiểu: anything
    • type
      const:  
      error
      bắt buộc
    • request_id
      Kiểu: string
    • propertyName
      Kiểu: anything
    application/json
  • 402
    Kiểu: object · ClaudeErrorResponse

    Số dư không đủ

    Phong bì lỗi tương thích API Claude Errors cho các yêu cầu Messages.

    • error
      Kiểu: object
      bắt buộc
      • message
        Kiểu: string
        bắt buộc
      • type
        Kiểu: string
        bắt buộc
      • propertyName
        Kiểu: anything
    • type
      const:  
      error
      bắt buộc
    • request_id
      Kiểu: string
    • propertyName
      Kiểu: anything
    application/json
  • 403
    Kiểu: object · ClaudeErrorResponse

    Tài khoản không được phép sử dụng mô hình. Các mô hình đã bị vô hiệu hóa cũng bị từ chối trước khi gọi upstream. Các yêu cầu và tác vụ đã được tiếp nhận vẫn tiếp tục.

    Phong bì lỗi tương thích API Claude Errors cho các yêu cầu Messages.

    • error
      Kiểu: object
      bắt buộc
      • message
        Kiểu: string
        bắt buộc
      • type
        Kiểu: string
        bắt buộc
      • propertyName
        Kiểu: anything
    • type
      const:  
      error
      bắt buộc
    • request_id
      Kiểu: string
    • propertyName
      Kiểu: anything
    application/json
  • 429
    Kiểu: object · ClaudeErrorResponse

    Đã đạt giới hạn chi tiêu hoặc số yêu cầu

    Phong bì lỗi tương thích API Claude Errors cho các yêu cầu Messages.

    • error
      Kiểu: object
      bắt buộc
      • message
        Kiểu: string
        bắt buộc
      • type
        Kiểu: string
        bắt buộc
      • propertyName
        Kiểu: anything
    • type
      const:  
      error
      bắt buộc
    • request_id
      Kiểu: string
    • propertyName
      Kiểu: anything
    application/json
  • 502
    Kiểu: object · ClaudeErrorResponse

    Yêu cầu tới nhà cung cấp upstream thất bại

    Phong bì lỗi tương thích API Claude Errors cho các yêu cầu Messages.

    • error
      Kiểu: object
      bắt buộc
      • message
        Kiểu: string
        bắt buộc
      • type
        Kiểu: string
        bắt buộc
      • propertyName
        Kiểu: anything
    • type
      const:  
      error
      bắt buộc
    • request_id
      Kiểu: string
    • propertyName
      Kiểu: anything
    application/json
  • 503
    Kiểu: object · ClaudeErrorResponse

    Nhà cung cấp hoặc dịch vụ thanh toán không khả dụng

    Phong bì lỗi tương thích API Claude Errors cho các yêu cầu Messages.

    • error
      Kiểu: object
      bắt buộc
      • message
        Kiểu: string
        bắt buộc
      • type
        Kiểu: string
        bắt buộc
      • propertyName
        Kiểu: anything
    • type
      const:  
      error
      bắt buộc
    • request_id
      Kiểu: string
    • propertyName
      Kiểu: 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