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

# Create a message (Anthropic)

> Endpoint kompatibel Anthropic Messages API untuk integrasi SDK Anthropic maupun Claude Code menggunakan kunci API CerasAI yang sama.

Generates a response using the Anthropic Messages API schema. Authenticate with either `x-api-key: $CERASAI_API_KEY` or `Authorization: Bearer $CERASAI_API_KEY`.


## OpenAPI

````yaml POST /v1/messages
openapi: 3.1.0
info:
  title: CerasAI Inference API
  version: 1.0.0
  description: >-
    API inferensi AI berlatensi rendah yang kompatibel penuh dengan protokol
    OpenAI Chat Completions dan Anthropic Messages.
servers:
  - url: https://api.cerasai.cloud
    description: Production Inference Gateway
security:
  - BearerAuth: []
paths:
  /v1/messages:
    post:
      summary: Buat Message (Anthropic-compatible)
      description: >-
        Endpoint kompatibel Anthropic Messages API untuk integrasi SDK Anthropic
        maupun Claude Code menggunakan kunci API CerasAI yang sama.
      operationId: createAnthropicMessage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AnthropicMessageRequest'
      responses:
        '200':
          description: Respons Anthropic Message berhasil.
          headers:
            x-request-id:
              description: UUID v4 unik untuk melacak permintaan di halaman Logs.
              schema:
                type: string
                format: uuid
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicMessageResponse'
        '401':
          description: Kunci API tidak sah.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '402':
          description: Saldo habis atau batas bulanan tercapai.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - AnthropicKeyAuth: []
        - BearerAuth: []
components:
  schemas:
    AnthropicMessageRequest:
      type: object
      required:
        - model
        - max_tokens
        - messages
      properties:
        model:
          type: string
          example: zai-org/GLM-5.3-Flash
        max_tokens:
          type: integer
          example: 1024
        system:
          type: string
        stream:
          type: boolean
          default: false
        temperature:
          type: number
        messages:
          type: array
          items:
            type: object
            required:
              - role
              - content
            properties:
              role:
                type: string
                enum:
                  - user
                  - assistant
              content:
                oneOf:
                  - type: string
                  - type: array
                    items:
                      type: object
                      additionalProperties: true
      additionalProperties: true
    AnthropicMessageResponse:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          example: message
        role:
          type: string
          example: assistant
        model:
          type: string
          example: zai-org/GLM-5.3-Flash
        content:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
                example: text
              text:
                type: string
        stop_reason:
          type: string
          nullable: true
        usage:
          type: object
          properties:
            input_tokens:
              type: integer
            cache_read_input_tokens:
              type: integer
            output_tokens:
              type: integer
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
            code:
              type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Kunci API workspace CerasAI (format OpenAI: `Authorization: Bearer
        $CERASAI_API_KEY`).
    AnthropicKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Kunci API workspace CerasAI (format Anthropic: `x-api-key:
        $CERASAI_API_KEY`).

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.