> ## Documentation Index
> Fetch the complete documentation index at: https://docs.capriole.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Chat

> 使用模型创建文本响应。

使用此端点向模型发送纯文本输入并接收纯文本响应。这个 Capriole 原生路由不支持流式输出。如果客户端需要 SSE 流，请使用 Chat Completions、Responses 或 Messages。

`POST /v1/chat` 接受 `openai-latest`、`claude-latest`、`google-latest`，以及 `GET /v1/models` 返回的公开具体模型 ID。使用 latest alias 可以让 Capriole AI 为对应提供商选择当前推荐的旗舰模型。需要固定模型版本时，请使用具体模型 ID。

Capriole AI 网页聊天和公开 API 是两个独立的产品界面。在网页聊天中，Fable 5 和 Fable 5 Thinking 是主要 Anthropic 模式，Opus 5 和 Opus 5 Thinking 位于 Other Models。公开 API 不会把网页聊天的 Thinking 预设作为独立模型 ID 暴露。调用 Claude Chat API 时，请使用 `claude-latest`，或 `anthropic/claude-fable-5`、`anthropic/claude-opus-5`、`anthropic/claude-sonnet-4-6` 等公开的具体 Claude 模型 ID。现有 Opus 4.8、Opus 4.7 和 Opus 4.6 集成仍受支持。


## OpenAPI

````yaml api-reference/openapi.json POST /v1/chat
openapi: 3.1.0
info:
  title: Capriole AI API
  description: >-
    Public API for model discovery, text chat, and protocol-compatible model
    endpoints.
  version: 1.0.0
servers:
  - url: https://api.caprioletech.com
security: []
paths:
  /v1/chat:
    post:
      summary: Create chat response
      description: Creates a text response from a model.
      operationId: createChat
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatRequest'
            examples:
              text:
                value:
                  model: openai-latest
                  input: Hello World!
      responses:
        '200':
          description: Chat completion response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatResponse'
              examples:
                default:
                  value:
                    id: 49da8eb7-916b-43a3-ab02-442bc2841839
                    model: openai/gpt-5.6-terra
                    result:
                      text: Here is a short joke.
                    usage:
                      input_tokens: 8
                      output_tokens: 6
                      total_tokens: 14
                      cached_tokens: 0
                      charged_tokens: 14
        '400':
          $ref: '#/components/responses/ValidationOrDetailErrorResponse'
        '401':
          $ref: '#/components/responses/DetailErrorResponse'
        '403':
          $ref: '#/components/responses/DetailErrorResponse'
        '429':
          $ref: '#/components/responses/RateLimitErrorResponse'
        '500':
          $ref: '#/components/responses/InternalServerErrorResponse'
        '502':
          $ref: '#/components/responses/DetailErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    ChatRequest:
      type: object
      additionalProperties: false
      required:
        - model
        - input
      properties:
        model:
          type: string
          description: Public model identifier or latest alias returned by GET /v1/models
          enum:
            - openai-latest
            - openai/gpt-5.6-terra
            - openai/gpt-5.6-luna
            - openai/gpt-5.5
            - openai/gpt-5.4-mini
            - claude-latest
            - anthropic/claude-fable-5
            - anthropic/claude-opus-5
            - anthropic/claude-opus-4-8
            - anthropic/claude-opus-4-7
            - anthropic/claude-opus-4-6
            - anthropic/claude-sonnet-4-6
            - google-latest
            - google/gemini-3.1-pro-preview
            - google/gemini-3.5-flash
            - xai/grok-4.5
            - zai/glm-5.2
            - moonshot/kimi-k3
        input:
          type: string
          description: Plain text user input
        web_search:
          type: boolean
          default: true
          description: >-
            Enable provider-native web search when the selected model supports
            it.
        temperature:
          type: number
          minimum: 0
          description: Optional sampling temperature.
        max_output_tokens:
          type: integer
          exclusiveMinimum: 0
          description: Optional maximum number of output tokens.
        max_retries:
          type: integer
          minimum: 0
          description: Optional maximum number of provider retries.
        timeout:
          type: number
          exclusiveMinimum: 0
          description: Optional provider request timeout in seconds.
    ChatResponse:
      type: object
      required:
        - id
        - model
        - result
        - usage
      properties:
        id:
          type: string
        model:
          type: string
        result:
          $ref: '#/components/schemas/ChatResult'
        usage:
          $ref: '#/components/schemas/ChatUsage'
    ChatResult:
      type: object
      required:
        - text
      properties:
        text:
          type: string
          description: Plain text assistant result
    ChatUsage:
      type: object
      required:
        - input_tokens
        - output_tokens
        - total_tokens
        - cached_tokens
        - charged_tokens
      properties:
        input_tokens:
          type: integer
        output_tokens:
          type: integer
        total_tokens:
          type: integer
        cached_tokens:
          type: integer
          description: Provider-reported cached input tokens.
        charged_tokens:
          type: integer
          description: Quota tokens charged after cached input discount.
    ValidationError:
      type: object
      required:
        - detail
        - errors
      properties:
        detail:
          type: string
          description: Validation summary
        errors:
          type: array
          items:
            type: string
          description: Per-field validation errors
    DetailError:
      type: object
      required:
        - detail
      properties:
        detail:
          type: string
          description: Error detail from the API
  responses:
    ValidationOrDetailErrorResponse:
      description: Validation error or request-level error response
      content:
        application/json:
          schema:
            oneOf:
              - $ref: '#/components/schemas/ValidationError'
              - $ref: '#/components/schemas/DetailError'
          examples:
            invalidPayload:
              value:
                detail: Invalid input parameters received.
                errors:
                  - >-
                    Field 'body -> input': String should have at least 1
                    character
    DetailErrorResponse:
      description: Error response with a detail message
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/DetailError'
          examples:
            missingBearerToken:
              value:
                detail: Missing Bearer token
            invalidApiKey:
              value:
                detail: Invalid API key
            usageMetadataUnavailable:
              value:
                detail: Missing usage metadata
    RateLimitErrorResponse:
      description: Rate limit error response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/DetailError'
          examples:
            rateLimitExceeded:
              value:
                detail: 'Rate limit exceeded: 100 per 1 minute'
    InternalServerErrorResponse:
      description: Internal server error response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/DetailError'
          examples:
            internalServerError:
              value:
                detail: An internal server error occurred. Please try again later.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Use an API key created in the Capriole AI page. Send it as
        `Authorization: Bearer sk-...`.

````