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

# claude-sonnet-5

> Send a structured list of input messages with text and/or image content, and Claude Sonnet 5 will generate the next message in the conversation.



## OpenAPI

````yaml api-reference/model-api/anthropic/openapi/claude-sonnet-5/openapi.yaml POST /v1/messages
openapi: 3.1.0
info:
  title: Claude Sonnet 5
  description: >-
    Anthropic Claude Sonnet 5 via Anyfast. Adaptive thinking is on by default,
    max output is 128K tokens, and manual extended thinking is not supported.
  version: 1.0.0
servers:
  - url: https://www.anyfast.ai
security:
  - bearerAuth: []
paths:
  /v1/messages:
    post:
      summary: Create a Message
      description: >-
        Send a structured list of input messages with text and/or image content,
        and Claude Sonnet 5 will generate the next message in the conversation.
      operationId: createMessageClaudeSonnet5
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - max_tokens
                - messages
              properties:
                model:
                  type: string
                  enum:
                    - claude-sonnet-5
                  description: Model ID.
                  example: claude-sonnet-5
                messages:
                  type: array
                  minItems: 1
                  description: Input messages. Each message has a role and content.
                  items:
                    type: object
                    required:
                      - role
                      - content
                    properties:
                      role:
                        type: string
                        enum:
                          - user
                          - assistant
                        description: The role of the message author.
                      content:
                        oneOf:
                          - type: string
                          - type: array
                            items:
                              type: object
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - text
                                    - image
                                text:
                                  type: string
                                source:
                                  type: object
                                  properties:
                                    type:
                                      type: string
                                    media_type:
                                      type: string
                                    data:
                                      type: string
                        description: >-
                          The content of the message. Either a string or an
                          array of content blocks.
                  example:
                    - role: user
                      content: Hello, Claude!
                max_tokens:
                  type: integer
                  minimum: 1
                  maximum: 128000
                  description: >-
                    The maximum number of tokens to generate before stopping.
                    Claude Sonnet 5 supports up to 128K output tokens.
                  example: 1024
                system:
                  oneOf:
                    - type: string
                    - type: array
                      items:
                        type: object
                        properties:
                          type:
                            type: string
                          text:
                            type: string
                  description: System prompt. Provides context and instructions to Claude.
                metadata:
                  type: object
                  properties:
                    user_id:
                      type: string
                      description: >-
                        An external identifier for the user who is associated
                        with the request.
                  description: An object describing metadata about the request.
                stop_sequences:
                  type: array
                  items:
                    type: string
                  description: >-
                    Custom text sequences that will cause the model to stop
                    generating.
                temperature:
                  type: number
                  minimum: 0
                  maximum: 1
                  default: 1
                  description: >-
                    Amount of randomness injected into the response. On Claude
                    Sonnet 5, non-default values return a 400 error.
                  example: 1
                top_p:
                  type: number
                  minimum: 0
                  maximum: 1
                  description: >-
                    Use nucleus sampling. On Claude Sonnet 5, non-default values
                    return a 400 error.
                top_k:
                  type: integer
                  minimum: 0
                  description: >-
                    Only sample from the top K options for each subsequent
                    token. On Claude Sonnet 5, non-default values return a 400
                    error.
                stream:
                  type: boolean
                  default: false
                  description: >-
                    Whether to incrementally stream the response using
                    server-sent events.
                tools:
                  type: array
                  items:
                    type: object
                    required:
                      - name
                      - input_schema
                    properties:
                      name:
                        type: string
                        description: Name of the tool.
                      description:
                        type: string
                        description: Description of what the tool does.
                      input_schema:
                        type: object
                        description: JSON Schema for the tool input.
                  description: Definitions of tools that the model may use.
                tool_choice:
                  type: object
                  properties:
                    type:
                      type: string
                      enum:
                        - auto
                        - any
                        - tool
                      description: How the model should use the provided tools.
                    name:
                      type: string
                      description: The name of the tool to use (when type is "tool").
                  description: How the model should use the provided tools.
                output_config:
                  type: object
                  properties:
                    effort:
                      type: string
                      enum:
                        - low
                        - medium
                        - high
                        - xhigh
                        - max
                      default: high
                      description: >-
                        Controls adaptive thinking depth and token usage. Claude
                        Sonnet 5 defaults to high.
                  description: >-
                    Output controls for models that support adaptive thinking
                    effort.
                thinking:
                  type: object
                  properties:
                    type:
                      type: string
                      enum:
                        - adaptive
                        - disabled
                      description: >-
                        Whether to explicitly use adaptive thinking or disable
                        thinking.
                  description: >-
                    Adaptive thinking configuration. Claude Sonnet 5 uses
                    adaptive thinking by default; use output_config.effort to
                    control depth. Manual extended thinking is not supported.
      responses:
        '200':
          description: Message created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Message'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: a4eee0ef-c999-4ba4-9266-02fa6ffdf936
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: a4eee0ef-c999-4ba4-9266-02fa6ffdf936
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: a4eee0ef-c999-4ba4-9266-02fa6ffdf936
components:
  schemas:
    Message:
      type: object
      required:
        - id
        - type
        - role
        - content
        - model
        - stop_reason
        - usage
      properties:
        id:
          type: string
          example: msg_01XFDUDYJgAACzvnptvVoYEL
        type:
          type: string
          example: message
        role:
          type: string
          example: assistant
        content:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
                enum:
                  - text
                  - thinking
                  - tool_use
              text:
                type: string
              thinking:
                type: string
              id:
                type: string
              name:
                type: string
              input:
                type: object
          example:
            - type: text
              text: Hello! How can I help you today?
        model:
          type: string
          example: claude-sonnet-5
        stop_reason:
          type: string
          enum:
            - end_turn
            - max_tokens
            - stop_sequence
            - tool_use
            - refusal
            - null
          description: Includes `refusal` for requests that the model declines.
        stop_sequence:
          type: string
          nullable: true
        usage:
          type: object
          properties:
            input_tokens:
              type: integer
            output_tokens:
              type: integer
            cache_creation_input_tokens:
              type: integer
            cache_read_input_tokens:
              type: integer

````