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

# GLM 전체 모델 인터페이스 - Messages 빠른 시작

> - Anthropic Messages 프로토콜로 GLM 시리즈 모델을 호출하며, `model` 파라미터로 구체적인 모델을 선택합니다
- 필요한 파라미터는 `model`, `max_tokens`, `messages` 세 가지뿐입니다(`max_tokens`는 Anthropic 프로토콜에서 필수)
- 전 시리즈 1M token 컨텍스트 윈도우, 최대 출력 131,072 tokens
- 전 시리즈가 **기본적으로 사고를 켜며**, 응답 `content`에 `type="thinking"` 블록이 포함되고 이 부분은 output 토큰에 계산됩니다
- 스트리밍 출력, 도구 호출, 이미지 입력 등의 기능은 '전체 매개변수' 페이지를 참조하세요

<Note>
  **BaseURL**: 기본 BaseURL은 `https://direct.evolink.ai`이며, 텍스트 모델과 장시간 연결을 더 잘 지원합니다. `https://api.evolink.ai`는 멀티모달 서비스의 기본 엔드포인트이자 텍스트 모델의 대체 주소 역할을 합니다.
</Note>

<Note>
  **GLM 시리즈는 기본적으로 사고가 켜져 있습니다.** 응답 `content` 배열에 `type="thinking"` 블록이 포함되며 이 부분은 output 토큰에 계산됩니다. 따라서 `max_tokens`를 너무 작게 잡지 말고 1024 이상을 권장합니다. 너무 작으면 사고가 끝나기 전에 잘려 본문을 받지 못할 수 있습니다.
</Note>


## OpenAPI

````yaml ko/api-manual/language-series/glm/messages/messages-quickstart.json POST /v1/messages
openapi: 3.1.0
info:
  title: GLM 전체 모델 인터페이스 - Messages 빠른 시작
  description: >-
    Anthropic Messages 프로토콜로 Zhipu GLM 시리즈 텍스트 모델을 호출하는 빠른 시작 예제입니다. `model`,
    `max_tokens`, `messages` 세 가지 파라미터만으로 대화를 시작할 수 있으며, 전체 파라미터는 '전체 매개변수' 페이지를
    참조하세요.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://direct.evolink.ai
    description: 프로덕션 (권장, 텍스트 모델 지원이 더 좋음)
  - url: https://api.evolink.ai
    description: 대체 URL
security:
  - bearerAuth: []
tags:
  - name: Messages
    description: Anthropic Messages 프로토콜 인터페이스
paths:
  /v1/messages:
    post:
      tags:
        - Messages
      summary: GLM 빠른 대화 (전체 모델, Anthropic 호환)
      description: >-
        - Anthropic Messages 프로토콜로 GLM 시리즈 모델을 호출하며, `model` 파라미터로 구체적인 모델을
        선택합니다

        - 필요한 파라미터는 `model`, `max_tokens`, `messages` 세 가지뿐입니다(`max_tokens`는
        Anthropic 프로토콜에서 필수)

        - 전 시리즈 1M token 컨텍스트 윈도우, 최대 출력 131,072 tokens

        - 전 시리즈가 **기본적으로 사고를 켜며**, 응답 `content`에 `type="thinking"` 블록이 포함되고 이
        부분은 output 토큰에 계산됩니다

        - 스트리밍 출력, 도구 호출, 이미지 입력 등의 기능은 '전체 매개변수' 페이지를 참조하세요
      operationId: glmMessagesQuick
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMessageQuickRequest'
            examples:
              simple:
                summary: 최소 호출
                value:
                  model: glm-5.3
                  max_tokens: 1024
                  messages:
                    - role: user
                      content: 안녕하세요, 한 문장으로 자기소개를 해 주세요
              flash:
                summary: 경량 모델로 전환
                description: '`glm-5.3-flash`는 `glm-5.3`보다 비용이 훨씬 낮아 고빈도 호출에 적합합니다.'
                value:
                  model: glm-5.3-flash
                  max_tokens: 1024
                  messages:
                    - role: user
                      content: HTTP가 무엇인지 한 문장으로 설명해 주세요
              multi_turn:
                summary: 멀티턴 대화
                value:
                  model: glm-5.3
                  max_tokens: 1024
                  messages:
                    - role: user
                      content: 입문하기 좋은 프로그래밍 언어를 추천해 주세요
                    - role: assistant
                      content: Python을 추천합니다. 문법이 간결하고 생태계가 풍부합니다.
                    - role: user
                      content: 그걸 배우려면 대략 얼마나 걸리나요?
      responses:
        '200':
          description: 메시지 객체
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageResponse'
              examples:
                with_thinking:
                  summary: 기본적으로 thinking content block 포함
                  value:
                    id: msg_0842a705-9d0b-4eaa-b12d-09a4106326c5
                    type: message
                    role: assistant
                    model: glm-5.3
                    content:
                      - type: thinking
                        thinking: 사용자가 한 단어로 인사해 달라고 요청했으니 "Hi"라고 답하면 됩니다.
                        signature: ''
                      - type: text
                        text: Hi.
                    stop_reason: end_turn
                    usage:
                      input_tokens: 18
                      output_tokens: 101
                      cache_creation_input_tokens: 0
                      cache_read_input_tokens: 0
                      prompt_tokens_details:
                        cached_tokens: 0
                tool_use:
                  summary: 도구 호출 트리거(stop_reason=tool_use)
                  value:
                    id: msg_067e85db-53df-43a1-bd38-09c53375f2f0
                    type: message
                    role: assistant
                    model: glm-5.3
                    content:
                      - type: tool_use
                        id: toolu_36b8a98e284c426799f08612
                        name: get_weather
                        input:
                          city: Tokyo
                    stop_reason: tool_use
                    usage:
                      input_tokens: 161
                      output_tokens: 11
                      cache_creation_input_tokens: 0
                      cache_read_input_tokens: 0
                      prompt_tokens_details:
                        cached_tokens: 0
        '400':
          description: 잘못된 요청 파라미터
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                type: error
                request_id: req_xxx
                error:
                  type: invalid_request_error
                  message: Invalid request
        '401':
          description: 인증 오류
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                type: error
                error:
                  type: authentication_error
                  message: Authentication error
        '402':
          description: 할당량 부족
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                type: error
                error:
                  type: billing_error
                  message: Insufficient quota
        '403':
          description: 권한 오류
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                type: error
                error:
                  type: permission_error
                  message: Permission denied
        '404':
          description: 모델 또는 리소스를 찾을 수 없음
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                type: error
                error:
                  type: not_found_error
                  message: Model not found
        '429':
          description: 속도 제한
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                type: error
                error:
                  type: rate_limit_error
                  message: Rate limited
        '500':
          description: 서버 내부 오류
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '502':
          description: 업스트림 서비스 오류
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: 서비스 일시적으로 사용 불가
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    CreateMessageQuickRequest:
      title: Create Message Quick Request
      type: object
      required:
        - model
        - max_tokens
        - messages
      properties:
        model:
          type: string
          description: >
            호출할 모델:


            | 모델 ID | 포지셔닝 |

            |---|---|

            | `glm-5.3` | 플래그십 모델, 복잡한 소프트웨어 엔지니어링과 에이전트 작업 능력이 전반적으로 향상; 1M
            컨텍스트 |

            | `glm-5.3-flash` | 경량 멀티모달 모델, 비용이 매우 낮고 이미지 입력을 기본 지원; 1M 컨텍스트 |

            | `glm-5.2` | 이전 세대 플래그십, 복잡한 추론과 초장문 컨텍스트; 1M 컨텍스트 |
          enum:
            - glm-5.3
            - glm-5.3-flash
            - glm-5.2
          default: glm-5.3
          example: glm-5.3
        max_tokens:
          type: integer
          description: >-
            이번 생성의 최대 토큰 수로, Anthropic 프로토콜에서는 **필수**입니다.


            참고: GLM 시리즈는 기본적으로 사고가 켜져 있고 사고 내용도 output 토큰을 차지하므로, 이 값을 너무 작게 잡지
            말고 1024 이상을 권장합니다.
          minimum: 1
          maximum: 131072
          default: 1024
          example: 1024
        messages:
          type: array
          description: 대화 메시지 목록으로, 시간 순서대로 배열합니다. 최소 1개의 메시지가 필요합니다.
          minItems: 1
          items:
            $ref: '#/components/schemas/MessageSimple'
    MessageResponse:
      type: object
      description: Anthropic 스타일의 메시지 응답
      properties:
        id:
          type: string
          description: '메시지 고유 ID(형식: `msg_<uuid>`)'
        type:
          type: string
          enum:
            - message
          description: 응답 객체 유형
        role:
          type: string
          enum:
            - assistant
        model:
          type: string
          description: 실제 사용된 모델
          example: glm-5.3
        content:
          type: array
          description: |-
            응답 콘텐츠 블록 목록

            **포함될 수 있는 block type**:
            - `thinking`: 추론 과정(사고가 켜져 있을 때, 기본적으로 켜짐)
            - `text`: 최종 답변 텍스트
            - `tool_use`: 모델이 발생시킨 도구 호출
          items:
            $ref: '#/components/schemas/OutputContentBlock'
        stop_reason:
          type: string
          description: |-
            중지 사유

            - `end_turn`: 자연스러운 종료(stop_sequences에 적중할 때도 이 값을 반환)
            - `max_tokens`: max_tokens 상한 도달
            - `tool_use`: 모델이 도구 호출을 트리거
          enum:
            - end_turn
            - max_tokens
            - tool_use
        usage:
          $ref: '#/components/schemas/AnthropicUsage'
    ErrorResponse:
      type: object
      properties:
        type:
          type: string
          enum:
            - error
        error:
          type: object
          properties:
            type:
              type: string
              description: >-
                오류 유형(예: invalid_request_error / authentication_error /
                billing_error 등)
            message:
              type: string
              description: 오류 설명
        request_id:
          type: string
          description: 요청 추적 ID
    MessageSimple:
      title: Message
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - user
            - assistant
          description: |-
            메시지 역할

            - `user`: 사용자 입력
            - `assistant`: 모델 응답 (멀티턴 대화 시 포함)

            시스템 프롬프트는 `messages` 안이 아니라 최상위 `system` 필드로 전달하세요.
          example: user
        content:
          type: string
          description: 메시지 내용 (일반 텍스트)
          example: 안녕하세요, 한 문장으로 자기소개를 해 주세요
    OutputContentBlock:
      type: object
      description: 응답 내의 콘텐츠 블록
      properties:
        type:
          type: string
          enum:
            - text
            - thinking
            - tool_use
        text:
          type: string
          description: type=`text`일 때의 텍스트
        thinking:
          type: string
          description: type=`thinking`일 때의 추론 과정 텍스트
        signature:
          type: string
          description: type=`thinking`일 때의 서명 (빈 문자열일 수 있음)
        id:
          type: string
          description: type=`tool_use`일 때의 도구 호출 ID
        name:
          type: string
          description: type=`tool_use`일 때의 도구 이름
        input:
          type: object
          description: type=`tool_use`일 때 모델이 생성한 JSON 입력 파라미터
    AnthropicUsage:
      type: object
      description: Token 사용 통계(Anthropic 규범)
      properties:
        input_tokens:
          type: integer
          description: 입력 token 수(캐시 미적중 부분)
          example: 18
        output_tokens:
          type: integer
          description: 출력 token 수(thinking 포함)
          example: 101
        cache_creation_input_tokens:
          type: integer
          description: 캐시 생성 입력 토큰 수 (GLM 시리즈에서는 항상 0)
          example: 0
        cache_read_input_tokens:
          type: integer
          description: 캐시 적중 입력 token 수(암묵적 캐시 적중 시 동일한 접두사의 길이와 대략 일치)
          example: 0
        prompt_tokens_details:
          type: object
          description: 입력 토큰 세부 정보 (캐시 적중 필드, GLM 시리즈에서도 함께 반환)
          properties:
            cached_tokens:
              type: integer
              description: 캐시에 적중한 입력 token 수
              example: 0
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        ##모든 인터페이스는 Bearer Token 인증이 필요합니다##


        **API Key 발급**:


        [API Key 관리 페이지](https://evolink.ai/dashboard/keys)에 방문하여 API Key를
        발급받으세요


        **요청 헤더에 추가**:

        ```

        Authorization: Bearer YOUR_API_KEY

        ```


        **참고**: EvoLink는 `/v1/messages`에 대해 일괄적으로 Bearer Token 인증을 사용합니다.

````