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

# Anthropic Messages

> Anthropic-compatible Messages endpoint. Any LinkModel chat model can be
called here with the native Anthropic request/response shape — point an
Anthropic SDK at this base URL and set `model` to one of the supported names.

Note the Anthropic contract differs from OpenAI: `system` is a top-level
field (not a message), `max_tokens` is required, and the response body is
a list of content blocks rather than `choices`.

Set `stream: true` to receive Server-Sent Events (`text/event-stream`): a
sequence of typed events (`message_start`, `content_block_delta`, …,
`message_stop`).

### Supported models

| Model | Provider | Details |
| --- | --- | --- |
| `claude-opus-4-7` | Claude | <a href="https://linkmodel.ai/en/models/claude-opus-4-7" target="_blank" rel="noopener">Pricing & specs</a> |
| `deepseek-v4-pro` | DeepSeek | <a href="https://linkmodel.ai/en/models/deepseek-v4-pro" target="_blank" rel="noopener">Pricing & specs</a> |
| `kimi-k2.6` | Moonshot | <a href="https://linkmodel.ai/en/models/kimi-k2.6" target="_blank" rel="noopener">Pricing & specs</a> |




## OpenAPI

````yaml /openapi/chat/_anthropic-messages.yaml post /messages
openapi: 3.0.3
info:
  title: Anthropic Messages
  version: 1.0.0
  description: Anthropic-compatible Messages endpoint for LinkModel chat models.
servers:
  - url: https://api.linkmodel.ai/v1
    description: Production
security:
  - bearerAuth: []
tags:
  - name: chat
paths:
  /messages:
    post:
      tags:
        - chat
      summary: Anthropic Messages
      description: >
        Anthropic-compatible Messages endpoint. Any LinkModel chat model can be

        called here with the native Anthropic request/response shape — point an

        Anthropic SDK at this base URL and set `model` to one of the supported
        names.


        Note the Anthropic contract differs from OpenAI: `system` is a top-level

        field (not a message), `max_tokens` is required, and the response body
        is

        a list of content blocks rather than `choices`.


        Set `stream: true` to receive Server-Sent Events (`text/event-stream`):
        a

        sequence of typed events (`message_start`, `content_block_delta`, …,

        `message_stop`).


        ### Supported models


        | Model | Provider | Details |

        | --- | --- | --- |

        | `claude-opus-4-7` | Claude | <a
        href="https://linkmodel.ai/en/models/claude-opus-4-7" target="_blank"
        rel="noopener">Pricing & specs</a> |

        | `deepseek-v4-pro` | DeepSeek | <a
        href="https://linkmodel.ai/en/models/deepseek-v4-pro" target="_blank"
        rel="noopener">Pricing & specs</a> |

        | `kimi-k2.6` | Moonshot | <a
        href="https://linkmodel.ai/en/models/kimi-k2.6" target="_blank"
        rel="noopener">Pricing & specs</a> |
      operationId: anthropic-messages
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - messages
                - max_tokens
              properties:
                model:
                  type: string
                  description: >-
                    ID of the chat model to use. Must be one of the supported
                    models listed above.
                  example: claude-opus-4-7
                  enum:
                    - claude-opus-4-7
                    - deepseek-v4-pro
                    - kimi-k2.6
                messages:
                  type: array
                  description: Input messages. Alternating user / assistant turns.
                  items:
                    type: object
                    required:
                      - role
                      - content
                    properties:
                      role:
                        type: string
                        enum:
                          - user
                          - assistant
                        example: user
                      content:
                        type: string
                        description: >-
                          The message content. May also be an array of content
                          blocks.
                        example: Hello, who are you?
                max_tokens:
                  type: integer
                  description: >-
                    The maximum number of tokens to generate before stopping.
                    Required.
                  example: 1024
                system:
                  type: string
                  description: >-
                    A system prompt providing context and instructions, set at
                    the top level.
                  example: You are a helpful assistant.
                stream:
                  type: boolean
                  description: If true, the response is streamed as Server-Sent Events.
                  default: false
                stop_sequences:
                  type: array
                  description: >
                    Custom text sequences that will cause the model to stop
                    generating. The

                    generated text will not contain the stop sequence.
                  items:
                    type: string
      responses:
        '200':
          description: >-
            Message result. When `stream` is true, the body is an SSE stream
            instead.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    example: msg_abc123
                  type:
                    type: string
                    example: message
                  role:
                    type: string
                    example: assistant
                  model:
                    type: string
                    example: claude-opus-4-7
                  content:
                    type: array
                    items:
                      type: object
                      properties:
                        type:
                          type: string
                          example: text
                        text:
                          type: string
                          example: I'm Claude, an AI assistant made by Anthropic.
                  stop_reason:
                    type: string
                    enum:
                      - end_turn
                      - max_tokens
                      - stop_sequence
                    example: end_turn
                  stop_sequence:
                    type: string
                    nullable: true
                  usage:
                    type: object
                    properties:
                      input_tokens:
                        type: integer
                        example: 12
                      output_tokens:
                        type: integer
                        example: 18
            text/event-stream:
              schema:
                type: string
                description: >
                  SSE stream of typed events. Begins with `message_start`,
                  followed by `content_block_start` / `content_block_delta` /
                  `content_block_stop`, then `message_delta` and `message_stop`.
        '400':
          description: Bad request — invalid or missing parameter.
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 400
                  msg:
                    type: string
                    example: max_tokens is required
                  request_id:
                    type: string
                    format: uuid
                    example: 96be7a7d-3e81-4916-a6b8-19b32773a693
        '401':
          description: Unauthorized — missing or invalid API key.
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 401
                  msg:
                    type: string
                    example: invalid api key
                  request_id:
                    type: string
                    format: uuid
                    example: bff4c295-c7da-4507-9708-4627cb6373ba
        '500':
          description: >-
            Internal error — message creation failed (e.g. insufficient balance
            or upstream error).
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 500
                  msg:
                    type: string
                    example: 'message failed: billing: code=100601: insufficient balance'
                  request_id:
                    type: string
                    format: uuid
                    example: 3409f6fb-fa9a-4534-b530-195b5f6f4e32
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````