전제 조건
- Anthropic Console 계정
- API 키
API 호출
1
API 키 설정
Claude Console에서 API 키를 가져오고 환경 변수로 설정하세요:
2
첫 번째 API 호출 만들기
이 명령을 실행하여 간단한 웹 검색 어시스턴트를 만드세요:예제 출력:
Agent Skills are now available! Learn more about extending Claude's capabilities with Agent Skills.
Claude API에 첫 번째 호출을 하고 간단한 웹 검색 어시스턴트를 구축하세요
API 키 설정
export ANTHROPIC_API_KEY='your-api-key-here'
첫 번째 API 호출 만들기
curl https://api.anthropic.com/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "claude-sonnet-4-5",
"max_tokens": 1000,
"messages": [
{
"role": "user",
"content": "What should I search for to find the latest developments in renewable energy?"
}
]
}'
{
"id": "msg_01HCDu5LRGeP2o7s2xGmxyx8",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "Here are some effective search strategies to find the latest renewable energy developments:\n\n## Search Terms to Use:\n- \"renewable energy news 2024\"\n- \"clean energy breakthrough\"\n- \"solar/wind/battery technology advances\"\n- \"green energy innovations\"\n- \"climate tech developments\"\n- \"energy storage solutions\"\n\n## Best Sources to Check:\n\n**News & Industry Sites:**\n- Renewable Energy World\n- GreenTech Media (now Wood Mackenzie)\n- Energy Storage News\n- CleanTechnica\n- PV Magazine (for solar)\n- WindPower Engineering & Development..."
}
],
"model": "claude-sonnet-4-5",
"stop_reason": "end_turn",
"usage": {
"input_tokens": 21,
"output_tokens": 305
}
}
이 페이지가 도움이 되었나요?