> ## 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

> Creates a text response from a model.

Use this endpoint to send plain text input to a model and receive a plain text response. This Capriole-native route is non-streaming; use Chat Completions, Responses, or Messages when your client needs an SSE stream.

`POST /v1/chat` accepts `openai-latest`, `claude-latest`, `google-latest`, and public concrete model IDs returned by `GET /v1/models`. Use a latest alias to let Capriole AI choose our recommended flagship model for that provider. Use a concrete model ID when version pinning matters.

Capriole AI web chat and the public API are separate product surfaces. In web chat, Fable 5 and Fable 5 Thinking are product modes. The public API does not expose web chat thinking presets as separate model IDs; for Claude Chat API requests, use `claude-latest` or a concrete public Claude model ID such as `anthropic/claude-fable-5`, `anthropic/claude-opus-4-8`, or `anthropic/claude-sonnet-4-6`. Existing Opus 4.7 and Opus 4.6 integrations remain supported.


## 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-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
        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-...`.

````