> ## 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 を受け付けます。対応プロバイダーの推奨旗艦モデルを Capriole AI に選ばせるには、latest エイリアスを使ってください。バージョン固定が重要な場合は、具体的なモデル 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-...`.

````