---
title: Anthropic Messages | RunAPI
description: RunAPI의 Anthropic 호환 Messages 작업을 통해 요청을 전송합니다.
url: https://runapi.ai/ko/docs/api/anthropic/messages.md
canonical: https://runapi.ai/ko/docs/api/anthropic/messages
locale: ko
---

> HTML 버전: https://runapi.ai/ko/docs/api/anthropic/messages
> 에이전트용 사이트 색인: https://runapi.ai/llms.txt

# Anthropic Messages

## 개요

RunAPI의 Anthropic 호환 Messages 작업을 호환 모델과 해당 프로토콜의 요청 및 응답 형식으로 사용합니다.

### 빠른 시작

1. API 키를 만들고 RUNAPI_API_KEY로 설정합니다.
2. 호환되는 모델을 선택한 후 문서화된 경로 매개변수와 JSON 본문을 전송합니다.
3. 해당 작업에 대한 JSON 응답 또는 서버 전송 이벤트를 읽고 프로토콜 오류를 처리하세요.

## 엔드포인트

POST /v1/messages

Base URL: https://runapi.ai

계약 버전: v1

권장 인증 방식: x-api-key: YOUR_API_TOKEN

## 인증 정보 전달 방식

RunAPI는 아래 나열된 각 캐리어를 허용합니다. 생성된 샘플은 프로토콜의 기본 헤더를 사용합니다.

- `Authorization: Bearer YOUR_API_TOKEN`
- `x-api-key: YOUR_API_TOKEN` (권장)
- `x-goog-api-key: YOUR_API_TOKEN`
- `?key=YOUR_API_TOKEN`

## 호환 모델

현재 가격, 속도 제한 및 상업적 이용 세부 정보는 모델 페이지를 여십시오.

- [claude-fable-5-1](https://runapi.ai/ko/models/claude)
- [claude-fable-5](https://runapi.ai/ko/models/claude)
- [claude-sonnet-5](https://runapi.ai/ko/models/claude)
- [claude-opus-5](https://runapi.ai/ko/models/claude)
- [claude-opus-4-8](https://runapi.ai/ko/models/claude)
- [claude-opus-4-7](https://runapi.ai/ko/models/claude)
- [claude-opus-4-6](https://runapi.ai/ko/models/claude)
- [claude-sonnet-4-6](https://runapi.ai/ko/models/claude)
- [claude-opus-4-5-20251101](https://runapi.ai/ko/models/claude)
- [claude-sonnet-4-5-20250929](https://runapi.ai/ko/models/claude)
- [claude-haiku-4-5-20251001](https://runapi.ai/ko/models/claude)
- [claude-opus-4-1-20250805](https://runapi.ai/ko/models/claude)
- [gpt-5.5](https://runapi.ai/ko/models/gpt)
- [gpt-5.5-pro](https://runapi.ai/ko/models/gpt)
- [gpt-5.4](https://runapi.ai/ko/models/gpt)
- [gpt-5.4-mini](https://runapi.ai/ko/models/gpt)
- [gpt-5.4-nano](https://runapi.ai/ko/models/gpt)
- [gpt-5.4-pro](https://runapi.ai/ko/models/gpt)
- [gpt-5.3-codex](https://runapi.ai/ko/models/gpt)
- [gpt-5.3-codex-spark](https://runapi.ai/ko/models/gpt)
- [gpt-5.2](https://runapi.ai/ko/models/gpt)
- [gpt-5.6-luna](https://runapi.ai/ko/models/gpt)
- [gpt-5.6-sol](https://runapi.ai/ko/models/gpt)
- [gpt-5.6-terra](https://runapi.ai/ko/models/gpt)
- [gpt-6-astra](https://runapi.ai/ko/models/gpt)
- [gemini-3.6-flash](https://runapi.ai/ko/models/gemini)
- [gemini-3.5-flash](https://runapi.ai/ko/models/gemini)
- [gemini-3.1-pro-preview](https://runapi.ai/ko/models/gemini)
- [gemini-3-flash-preview](https://runapi.ai/ko/models/gemini)
- [gemini-2.5-pro](https://runapi.ai/ko/models/gemini)
- [gemini-2.5-flash](https://runapi.ai/ko/models/gemini)
- [deepseek-v4-flash-vision-exp](https://runapi.ai/ko/models/deepseek)
- [deepseek-v4-pro](https://runapi.ai/ko/models/deepseek)
- [deepseek-v4-flash](https://runapi.ai/ko/models/deepseek)
- [glm-5.2](https://runapi.ai/ko/models/glm)
- [glm-5.1](https://runapi.ai/ko/models/glm)
- [glm-5-turbo](https://runapi.ai/ko/models/glm)
- [glm-5](https://runapi.ai/ko/models/glm)
- [glm-4.7](https://runapi.ai/ko/models/glm)
- [glm-4.6](https://runapi.ai/ko/models/glm)
- [glm-4.5](https://runapi.ai/ko/models/glm)
- [glm-4.5-air](https://runapi.ai/ko/models/glm)
- [kimi-k3](https://runapi.ai/ko/models/kimi)
- [kimi-k2.7-code](https://runapi.ai/ko/models/kimi)
- [kimi-k2.6](https://runapi.ai/ko/models/kimi)
- [kimi-k2.5](https://runapi.ai/ko/models/kimi)
- [MiniMax-M3](https://runapi.ai/ko/models/minimax)
- [MiniMax-M2.7](https://runapi.ai/ko/models/minimax)
- [MiniMax-M2.7-highspeed](https://runapi.ai/ko/models/minimax)
- [MiniMax-M2.5](https://runapi.ai/ko/models/minimax)
- [MiniMax-M2.5-highspeed](https://runapi.ai/ko/models/minimax)
- [MiniMax-M2.1](https://runapi.ai/ko/models/minimax)
- [MiniMax-M2](https://runapi.ai/ko/models/minimax)
- [mimo-v2.5-pro](https://runapi.ai/ko/models/mimo)
- [mimo-v2.5](https://runapi.ai/ko/models/mimo)
- [grok-4.20-0309-non-reasoning](https://runapi.ai/ko/models/grok)
- [grok-4.5](https://runapi.ai/ko/models/grok)
- [grok-4.3](https://runapi.ai/ko/models/grok)

## 요청 계약

공개 프로토콜과 RunAPI 지원이 모두 확인된 필드만 나열됩니다. 추가 JSON 본문 필드는 그대로 전달됩니다.

### JSON 본문

필수: `model`, `max_tokens`, `messages`

```json
{
  "max_tokens": {
    "description": "중지 전에 생성할 최대 토큰 수.",
    "type": "integer"
  },
  "messages": {
    "description": "Anthropic Messages 형식의 대화 턴.",
    "items": {
      "additionalProperties": true,
      "properties": {
        "content": {
          "type": [
            "string",
            "array"
          ]
        },
        "role": {
          "type": "string"
        }
      },
      "required": [
        "role",
        "content"
      ],
      "type": "object"
    },
    "type": "array"
  },
  "model": {
    "description": "호환 가능한 모델 카탈로그가 반환하는 RunAPI 모델 식별자.",
    "type": "string"
  },
  "stream": {
    "default": false,
    "description": "타입이 지정된 Messages 이벤트를 서버 전송 이벤트로 반환합니다.",
    "type": "boolean"
  },
  "system": {
    "description": "대화 메시지와 별도로 제공되는 시스템 지침.",
    "type": [
      "string",
      "array"
    ]
  },
  "temperature": {
    "description": "샘플링 온도; 모델 지원 여부는 다를 수 있습니다.",
    "type": "number"
  },
  "tools": {
    "description": "모델이 호출할 수 있는 도구.",
    "type": "array"
  },
  "top_p": {
    "description": "핵 샘플링 확률; 모델 지원 여부는 다를 수 있습니다.",
    "type": "number"
  }
}
```

### 요청 예시

```json
{
  "max_tokens": 64,
  "messages": [
    {
      "content": "Summarize one practical improvement for an API deployment.",
      "role": "user"
    }
  ],
  "model": "claude-sonnet-4-6"
}
```

## 동기 응답

HTTP 200

### 스키마

```json
{
  "additionalProperties": true,
  "properties": {
    "content": {
      "type": "array"
    },
    "id": {
      "type": "string"
    },
    "model": {
      "type": "string"
    },
    "role": {
      "const": "assistant",
      "type": "string"
    },
    "stop_reason": {
      "type": [
        "string",
        "null"
      ]
    },
    "type": {
      "const": "message",
      "type": "string"
    },
    "usage": {
      "additionalProperties": true,
      "properties": {
        "input_tokens": {
          "type": "integer"
        },
        "output_tokens": {
          "type": "integer"
        }
      },
      "required": [
        "input_tokens",
        "output_tokens"
      ],
      "type": "object"
    }
  },
  "required": [
    "id",
    "type",
    "role",
    "content",
    "model",
    "stop_reason",
    "usage"
  ],
  "type": "object"
}
```

### 예시

```json
{
  "content": [
    {
      "text": "Hello! How can I help today?",
      "type": "text"
    }
  ],
  "id": "msg_example",
  "model": "claude-sonnet-4-6",
  "role": "assistant",
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "type": "message",
  "usage": {
    "input_tokens": 12,
    "output_tokens": 8
  }
}
```

## SSE 이벤트: message_start

미디어 유형: `text/event-stream`

### 스키마

```json
{
  "additionalProperties": true,
  "properties": {
    "message": {
      "type": "object"
    },
    "type": {
      "const": "message_start",
      "type": "string"
    }
  },
  "required": [
    "type",
    "message"
  ],
  "type": "object"
}
```

### 예시

```json
{
  "message": {
    "content": [],
    "id": "msg_example",
    "model": "claude-sonnet-4-6",
    "role": "assistant",
    "stop_reason": null,
    "stop_sequence": null,
    "type": "message",
    "usage": {
      "input_tokens": 12,
      "output_tokens": 1
    }
  },
  "type": "message_start"
}
```

## SSE 이벤트: content_block_delta

미디어 유형: `text/event-stream`

### 스키마

```json
{
  "additionalProperties": true,
  "properties": {
    "delta": {
      "type": "object"
    },
    "index": {
      "type": "integer"
    },
    "type": {
      "const": "content_block_delta",
      "type": "string"
    }
  },
  "required": [
    "type",
    "index",
    "delta"
  ],
  "type": "object"
}
```

### 예시

```json
{
  "delta": {
    "text": "Hello",
    "type": "text_delta"
  },
  "index": 0,
  "type": "content_block_delta"
}
```

## SSE 이벤트: message_delta

미디어 유형: `text/event-stream`

### 스키마

```json
{
  "additionalProperties": true,
  "properties": {
    "delta": {
      "type": "object"
    },
    "type": {
      "const": "message_delta",
      "type": "string"
    },
    "usage": {
      "additionalProperties": true,
      "properties": {
        "output_tokens": {
          "type": "integer"
        }
      },
      "required": [
        "output_tokens"
      ],
      "type": "object"
    }
  },
  "required": [
    "type",
    "delta",
    "usage"
  ],
  "type": "object"
}
```

### 예시

```json
{
  "delta": {
    "stop_reason": "end_turn",
    "stop_sequence": null
  },
  "type": "message_delta",
  "usage": {
    "output_tokens": 8
  }
}
```

## SSE 이벤트: message_stop

미디어 유형: `text/event-stream`

### 스키마

```json
{
  "additionalProperties": true,
  "properties": {
    "type": {
      "const": "message_stop",
      "type": "string"
    }
  },
  "required": [
    "type"
  ],
  "type": "object"
}
```

### 예시

```json
{
  "type": "message_stop"
}
```

## 프로토콜 오류: invalid_request

HTTP 400

### 스키마

```json
{
  "additionalProperties": true,
  "properties": {
    "error": {
      "additionalProperties": true,
      "properties": {
        "message": {
          "type": "string"
        },
        "type": {
          "type": "string"
        }
      },
      "required": [
        "type",
        "message"
      ],
      "type": "object"
    },
    "request_id": {
      "type": "string"
    },
    "type": {
      "const": "error",
      "type": "string"
    }
  },
  "required": [
    "type",
    "error"
  ],
  "type": "object"
}
```

### 예시

```json
{
  "error": {
    "message": "max_tokens is required",
    "type": "invalid_request_error"
  },
  "request_id": "req_example",
  "type": "error"
}
```

## 사용량

### 스키마

```json
{
  "additionalProperties": true,
  "properties": {
    "input_tokens": {
      "type": "integer"
    },
    "output_tokens": {
      "type": "integer"
    }
  },
  "required": [
    "input_tokens",
    "output_tokens"
  ],
  "type": "object"
}
```

### 예시

```json
{
  "input_tokens": 12,
  "output_tokens": 8
}
```

## 생성된 코드 샘플

각 cURL, JavaScript, Python 예제는 프로토콜별 SDK 없이도 이 계약에서 검증된 요청을 전송합니다.

### curl

```curl
curl -X POST https://runapi.ai/v1/messages \
  -H x-api-key:\ YOUR_API_TOKEN \
  -H Content-Type:\ application/json \
  -d \{\"model\":\"claude-sonnet-4-6\",\"max_tokens\":64,\"messages\":\[\{\"role\":\"user\",\"content\":\"Summarize\ one\ practical\ improvement\ for\ an\ API\ deployment.\"\}\]\}
```

### javascript

```javascript
const response = await fetch("https://runapi.ai/v1/messages", {
  method: "POST",
  headers: {
  "x-api-key": "YOUR_API_TOKEN",
  "Content-Type": "application/json"
},
  body: JSON.stringify({
  "model": "claude-sonnet-4-6",
  "max_tokens": 64,
  "messages": [
    {
      "role": "user",
      "content": "Summarize one practical improvement for an API deployment."
    }
  ]
})
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();
console.log(data);
```

### python

#### 설치

```bash
pip install requests
```

```python
import requests

response = requests.post(
    "https://runapi.ai/v1/messages",
    headers={"x-api-key": "YOUR_API_TOKEN", "Content-Type": "application/json"},
    json={"model": "claude-sonnet-4-6", "max_tokens": 64, "messages": [{"role": "user", "content": "Summarize one practical improvement for an API deployment."}]}
)
response.raise_for_status()
print(response.json())
```

## 관련 가이드

- [인증](https://runapi.ai/ko/docs/guides/authentication.md)
- [빠른 시작](https://runapi.ai/ko/docs/guides/llm-api/quickstart.md)

---

## RunAPI의 더 많은 정보

- [홈](https://runapi.ai/ko/.md)
- [모델 카탈로그](https://runapi.ai/ko/models.md)
- [요금](https://runapi.ai/ko/pricing.md)
- [제공사](https://runapi.ai/ko/models)
- [문서](https://runapi.ai/ko/docs/guides)
- [SDK](https://runapi.ai/ko/sdk.md)
- [CLI](https://runapi.ai/ko/cli.md)
- [MCP Server](https://runapi.ai/ko/mcp.md)
- [Claude Code와 Cursor](https://runapi.ai/ko/claude-code-vs-cursor.md)
- [Cursor API 설정](https://runapi.ai/ko/cursor-api-setup.md)
- [RunAPI와 OpenRouter 비교](https://runapi.ai/ko/openrouter-alternative.md)
- [엔터프라이즈](https://runapi.ai/ko/contact.md)
- [문의](https://runapi.ai/ko/contact.md)
- [약관](https://runapi.ai/ko/terms.md)
- [개인정보](https://runapi.ai/ko/privacy.md)
- [에이전트용 사이트 색인](https://runapi.ai/llms.txt)

문의: contact@runapi.ai

## 구조화된 데이터

```json
[
  {
    "@context": "https://schema.org",
    "inLanguage": "ko",
    "@type": "WebSite",
    "name": "RunAPI",
    "url": "https://runapi.ai/ko",
    "potentialAction": {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://runapi.ai/ko/models?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    }
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "ko",
    "@type": "Organization",
    "name": "RunAPI",
    "url": "https://runapi.ai/ko",
    "logo": {
      "@type": "ImageObject",
      "url": "https://runapi.ai/koicon.svg"
    },
    "sameAs": [
      "https://github.com/runapi-ai"
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "ko",
    "@type": "TechArticle",
    "headline": "Anthropic Messages",
    "description": "RunAPI의 Anthropic 호환 Messages 작업을 통해 요청을 전송합니다.",
    "url": "https://runapi.ai/ko/docs/api/anthropic/messages",
    "mainEntityOfPage": "https://runapi.ai/ko/docs/api/anthropic/messages"
  }
]
```
