Messages첫 단계
Claude 시작하기
Claude에 첫 번째 API 호출을 보내고 간단한 웹 검색 어시스턴트를 만들어 보세요.
사전 요구 사항
API 호출하기
API 키 설정하기
API 키를 환경 변수로 내보내세요. SDK는
ANTHROPIC_API_KEY를 자동으로 읽어옵니다.export ANTHROPIC_API_KEY="your-api-key-here"프로젝트 생성 및 SDK 설치하기
mkdir claude-quickstart && cd claude-quickstart python3 -m venv .venv && source .venv/bin/activate pip install anthropic코드 작성하기
quickstart.py라는 파일을 만드세요:Pythonimport anthropic client = anthropic.Anthropic() message = client.messages.create( model="claude-opus-5", max_tokens=1000, messages=[ { "role": "user", "content": "What should I search for to find the latest developments in renewable energy?", } ], ) for block in message.content: if block.type == "text": print(block.text)코드 실행하기
python quickstart.pyOutputHere are some effective search strategies to find the latest developments in renewable energy: ## General Search Terms - "Renewable energy news 2025" - ...
다음 단계
첫 번째 API 호출을 완료했습니다. 다음으로, 모든 Claude 통합에서 사용하게 될 Messages API 패턴을 알아보세요.
멀티턴 대화, 시스템 프롬프트, 중지 이유 및 기타 핵심 패턴을 알아보세요.
기본 사항에 익숙해지면 더 자세히 살펴보세요:
Was this page helpful?