Raon
문서

Messages

Anthropic Messages 형식의 API입니다. POST /v1/messages로 호출합니다.

SDK는 pip install anthropic 또는 npm install @anthropic-ai/sdk 명령으로 설치합니다. max_tokens는 필수 파라미터입니다. 시스템 프롬프트는 최상위 system 파라미터로 지정하며, messages에는 system 역할을 사용할 수 없습니다.

curl https://raon-api.krafton.ai/v1/messages \
  -H "x-api-key: $RAON_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "raon-1-mini-preview",
    "max_tokens": 1024,
    "system": "You are a helpful assistant.",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

응답의 content에는 thinking 블록이 먼저 오고, 이어서 text 블록이 옵니다. stop_reason은 답변 생성이 완료되면 end_turn, max_tokens에 도달하면 max_tokens입니다.

Anthropic SDK는 /v1을 자동으로 추가하므로 Base URL에 /v1을 포함하지 않습니다. Claude Code의 ANTHROPIC_BASE_URL도 마찬가지입니다.

도구 선택

tool_choice는 auto, any, none을 지원합니다. 특정 도구를 지정하면(tool_choice.type: "tool") 400 오류가 반환되므로, tool_choice를 생략하거나 any를 사용하세요.

이 페이지에서