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

# Create Claude message

> Create message responses using the Anthropic Claude Messages native API format, with tool calling and extended thinking support

## Models you can use

| Model ID                     | Notes                                               |
| ---------------------------- | --------------------------------------------------- |
| `claude-3-opus-20240229`     | Claude 3 flagship — top reasoning and comprehension |
| `claude-3-5-sonnet-20241022` | Claude 3.5 Sonnet — balanced performance            |
| `claude-3-5-haiku-20241022`  | Claude 3.5 Haiku — fast and lightweight             |

See [`GET /v1/models`](/api-reference/models/list-models) for the full list.

## Version header

Every request must include `anthropic-version: 2023-06-01` (or a newer
version).

## System prompt

The `system` field can be a plain text string or an array of content
blocks with cache-control directives for fine-grained prompt caching.

## Tool calling

Define tools in `tools` using a JSON Schema `input_schema`. The model
returns `tool_use` blocks in `content`; feed back the tool result as a
`tool_result` block in the next turn.

## Extended thinking

Set `thinking.type: enabled` and specify `thinking.budget_tokens` to
enable extended thinking mode. The model returns `thinking` content
blocks alongside the final answer.

## Streaming

Set `stream: true` for SSE streaming. Event types include
`message_start`, `content_block_delta`, and `message_stop`.


## OpenAPI

````yaml /openapi/chat.en.yaml post /v1/messages
openapi: 3.1.0
info:
  title: InfinityBlue API — Chat
  version: 1.0.0
  summary: Unified AI model API gateway — Chat endpoints
  description: >
    InfinityBlue is a unified API gateway for AI models. It exposes

    **OpenAI-, Google Gemini-, and Anthropic Claude-compatible** endpoints,

    backed by models from OpenAI, Google, DeepSeek, ByteDance (Seedance),

    Kuaishou (Kling), and more.


    You don't need to integrate each vendor separately — just point your

    base URL at InfinityBlue and keep using the official SDK you already know.


    ## Authentication


    Every request must include your API key in the header:


    ```

    Authorization: Bearer YOUR_API_KEY

    ```


    Create and manage your API keys in the
    [console](https://api.getinfinityblue.com/console).


    ## Endpoint format conventions


    | Path prefix | Compatible format |

    | --- | --- |

    | `/v1/*` | OpenAI (Chat Completions, Responses, Images, etc.) |

    | `/v1/messages` | Anthropic Claude Messages |

    | `/v1beta/models/*` | Google Gemini native |


    ## Model selection


    Pass any model ID in the `model` parameter. See

    [`GET /v1/models`](/api-reference/models/list-models)

    or the [pricing page](https://api.getinfinityblue.com/pricing)

    for the full list.
  contact:
    name: InfinityBlue
    url: https://getinfinityblue.com
servers:
  - url: https://api.getinfinityblue.com
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Chat
    description: |
      Text conversations, vision, tool calling, streaming, and reasoning
      models — all through a single chat endpoint.
paths:
  /v1/messages:
    post:
      tags:
        - Chat
      summary: Create Claude message
      description: |
        Create a message response using the Anthropic Claude Messages API native
        format. Requires the `anthropic-version` header. Accepts either
        `Authorization: Bearer` or `x-api-key` for authentication.
      operationId: createClaudeMessage
      parameters:
        - name: anthropic-version
          in: header
          description: Anthropic API version. Recommended value is `2023-06-01`.
          required: true
          schema:
            type: string
            examples:
              - '2023-06-01'
        - name: x-api-key
          in: header
          description: >
            Anthropic API key (optional). You can use this header or the
            standard

            `Authorization: Bearer YOUR_KEY` header — either works.
          required: false
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClaudeMessageRequest'
            examples:
              simple:
                summary: Basic text chat
                value:
                  model: claude-3-opus-20240229
                  max_tokens: 1024
                  messages:
                    - role: user
                      content: Introduce yourself in one sentence.
              with_system:
                summary: With system prompt
                value:
                  model: claude-3-opus-20240229
                  max_tokens: 2048
                  system: You are a professional technical documentation writer.
                  messages:
                    - role: user
                      content: >-
                        Write a brief introduction to REST API design
                        principles.
              tool_calling:
                summary: Tool calling
                value:
                  model: claude-3-opus-20240229
                  max_tokens: 1024
                  tools:
                    - name: get_weather
                      description: Get the current weather for a city
                      input_schema:
                        type: object
                        properties:
                          city:
                            type: string
                            description: City name
                        required:
                          - city
                  messages:
                    - role: user
                      content: What's the weather in Beijing?
              extended_thinking:
                summary: Extended thinking
                value:
                  model: claude-3-opus-20240229
                  max_tokens: 16000
                  thinking:
                    type: enabled
                    budget_tokens: 10000
                  messages:
                    - role: user
                      content: >-
                        Analyze the potential impact of quantum computing on
                        modern cryptography.
              streaming:
                summary: Streaming response
                value:
                  model: claude-3-opus-20240229
                  max_tokens: 1024
                  stream: true
                  messages:
                    - role: user
                      content: Write a short poem about the deep sea.
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClaudeMessageResponse'
            text/event-stream:
              schema:
                type: string
                description: >
                  Server-Sent Events stream when `stream=true`. Event types
                  include

                  `message_start`, `content_block_start`, `content_block_delta`,

                  `content_block_stop`, `message_delta`, and `message_stop`.
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    ClaudeMessageRequest:
      type: object
      required:
        - model
        - messages
        - max_tokens
      description: Anthropic Claude Messages API request body.
      properties:
        model:
          type: string
          description: >-
            Model ID, e.g. `claude-3-opus-20240229`. See `GET /v1/models` for
            the full list.
          examples:
            - claude-3-opus-20240229
        messages:
          type: array
          description: >-
            Conversation messages. `role` must alternate between `user` and
            `assistant`.
          items:
            $ref: '#/components/schemas/ClaudeMessage'
        system:
          description: |
            System prompt — either a plain text string or an array of content
            blocks with cache-control directives.
          oneOf:
            - type: string
            - type: array
              items:
                type: object
        max_tokens:
          type: integer
          minimum: 1
          description: Maximum number of tokens the model may generate. Required.
        temperature:
          type: number
          minimum: 0
          maximum: 1
          description: Sampling temperature between 0 and 1, controlling output randomness.
        top_p:
          type: number
          description: Nucleus sampling threshold. Tune this or `temperature`, not both.
        top_k:
          type: integer
          description: Top-K sampling — only the K most probable tokens are considered.
        stream:
          type: boolean
          description: Whether to stream the response as Server-Sent Events.
        stop_sequences:
          type: array
          description: Stop sequences — generation halts when any of these is produced.
          items:
            type: string
        tools:
          type: array
          description: >-
            Tools the model may call. Each tool requires `name`, `description`,
            and `input_schema`.
          items:
            type: object
            properties:
              name:
                type: string
                description: Tool name.
              description:
                type: string
                description: What the tool does, to help the model decide when to call it.
              input_schema:
                type: object
                description: Input parameter definition in JSON Schema format.
        tool_choice:
          description: >
            Tool calling strategy. `auto` lets the model decide, `any` forces at
            least

            one tool call, `tool` forces a specific tool (also set `name`).
          oneOf:
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - auto
                    - any
                    - tool
                  description: Strategy type.
                name:
                  type: string
                  description: Tool name when `type=tool`.
        thinking:
          type: object
          description: >-
            Extended thinking configuration, only effective for models that
            support it.
          properties:
            type:
              type: string
              enum:
                - enabled
                - disabled
              description: Whether to enable extended thinking.
            budget_tokens:
              type: integer
              description: |
                Maximum token budget for the thinking process. Must be positive;
                at least 1000 is recommended for meaningful thinking output.
        metadata:
          type: object
          description: Additional request metadata.
          properties:
            user_id:
              type: string
              description: >-
                A unique identifier for your end user, useful for abuse
                monitoring.
    ClaudeMessageResponse:
      type: object
      description: Anthropic Claude Messages API response body.
      properties:
        id:
          type: string
          description: Unique identifier for this message.
        type:
          type: string
          description: Object type, value is `message`.
          examples:
            - message
        role:
          type: string
          description: Response role, value is `assistant`.
          examples:
            - assistant
        content:
          type: array
          description: >-
            List of response content blocks — may include text, tool_use, or
            thinking blocks.
          items:
            type: object
            properties:
              type:
                type: string
                description: Content block type, e.g. `text`, `tool_use`, `thinking`.
              text:
                type: string
                description: Text content, present when `type=text`.
        model:
          type: string
          description: The model that actually processed the request.
        stop_reason:
          type: string
          enum:
            - end_turn
            - max_tokens
            - stop_sequence
            - tool_use
          description: The reason generation stopped.
        usage:
          type: object
          description: Token usage statistics.
          properties:
            input_tokens:
              type: integer
              description: Tokens consumed by the input.
            output_tokens:
              type: integer
              description: Tokens consumed by the output.
            cache_creation_input_tokens:
              type: integer
              description: Tokens written to prompt cache (prompt caching feature).
            cache_read_input_tokens:
              type: integer
              description: Tokens read from prompt cache (prompt caching feature).
    ErrorResponse:
      type: object
      description: Standard error response.
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              description: Error message.
              examples:
                - Invalid duration. Supported range is 4 to 15 seconds.
            type:
              type: string
              description: Error type.
              examples:
                - invalid_request_error
            param:
              type:
                - string
                - 'null'
              description: The parameter related to the error.
              examples:
                - seconds
            code:
              type:
                - string
                - 'null'
              description: Error code.
              examples:
                - invalid_duration
    ClaudeMessage:
      type: object
      required:
        - role
        - content
      description: A Claude conversation message.
      properties:
        role:
          type: string
          enum:
            - user
            - assistant
          description: Message role, must alternate between `user` and `assistant`.
        content:
          description: |
            Message content — either a plain text string or an array of content
            blocks (text, image, tool_use, tool_result, etc.).
          oneOf:
            - type: string
            - type: array
              items:
                type: object
                properties:
                  type:
                    type: string
                    enum:
                      - text
                      - image
                      - tool_use
                      - tool_result
                    description: Content block type.
                  text:
                    type: string
                    description: Text content, present when `type=text`.
                  source:
                    type: object
                    description: Image source, used when `type=image`.
                    properties:
                      type:
                        type: string
                        enum:
                          - base64
                          - url
                        description: Source type.
                      media_type:
                        type: string
                        description: >-
                          Image MIME type, e.g. `image/jpeg`, `image/png`,
                          `image/webp`, `image/gif`.
                      data:
                        type: string
                        description: Base64-encoded image data, used when `type=base64`.
                      url:
                        type: string
                        description: Image URL, used when `type=url`.
                  id:
                    type: string
                    description: Tool call ID, present when `type=tool_use`.
                  name:
                    type: string
                    description: Tool name, present when `type=tool_use`.
                  input:
                    type: object
                    description: Tool input arguments, present when `type=tool_use`.
                  tool_use_id:
                    type: string
                    description: >-
                      The tool call ID this result responds to, present when
                      `type=tool_result`.
                  content:
                    type: string
                    description: Tool execution result, present when `type=tool_result`.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >
        Bearer token authentication, format: `Authorization: Bearer sk-xxxxxx`.

        Get your API key in the
        [console](https://api.getinfinityblue.com/console).

````