Felo API PlatformFelo API Platform
v0.3.0
OpenAPI 3.1.0

Create a chat completion

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

Create a chat completion

​

OpenAI-compatible Chat Completions API. Set stream=true to receive Server-Sent Events. The response and error envelope follow the Chat Completions/OpenAI-compatible shape.

请求体·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
  • stop
    可为 null
    • 类型: string
  • stream
    类型: boolean
  • temperature
    类型: number
    最小值:  
    0
  • tool_choice
    • 类型: string
  • tools
    类型: array object[]
    • propertyName
      类型: anything
  • top_p
    类型: number
    最小值:  
    0
    最大值:  
    1
  • propertyName
    类型: anything
  • user
    类型: string
  • propertyName
    类型: anything
响应
  • 200
    类型: object · ChatCompletionResponse

    Chat completion or streaming response

    • 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
      必填

      Usually chat.completion for non-streaming responses.

    • created
      类型: integer 格式: int64

      Signed 64-bit integers (long type).

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

      Provider usage object. Fields vary by endpoint and provider.

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

    Invalid request, model, or provider mapping

    OpenAI-compatible error envelope. The Router may include code and message without all optional upstream fields.

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

        OpenAI-compatible error type when supplied.

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

    Invalid or missing Felo API key

    OpenAI-compatible error envelope. The Router may include code and message without all optional upstream fields.

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

        OpenAI-compatible error type when supplied.

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

    Insufficient balance

    OpenAI-compatible error envelope. The Router may include code and message without all optional upstream fields.

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

        OpenAI-compatible error type when supplied.

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

    Account is not permitted to use the model. Disabled models are also rejected before upstream calls. Existing accepted requests and tasks continue.

    OpenAI-compatible error envelope. The Router may include code and message without all optional upstream fields.

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

        OpenAI-compatible error type when supplied.

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

    Spending or request limit reached

    OpenAI-compatible error envelope. The Router may include code and message without all optional upstream fields.

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

        OpenAI-compatible error type when supplied.

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

    Upstream provider request failed

    OpenAI-compatible error envelope. The Router may include code and message without all optional upstream fields.

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

        OpenAI-compatible error type when supplied.

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

    Provider or billing service unavailable

    OpenAI-compatible error envelope. The Router may include code and message without all optional upstream fields.

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

        OpenAI-compatible error type when supplied.

      • 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