Skip to Content
모델 사용법Claude웹 검색

Claude 웹 검색

이 페이지에서는 Claude가 web_search 도구로 웹을 검색하도록 하는 방법을 설명합니다. 모델 ID, 엔드포인트 주소, 공급자 설명은 Claude 시리즈 개요를 참고하십시오.

요점웹 검색은 Anthropic 공급자를 지정해야 하며, Fable 5, Opus 4.8, Opus 4.7, Sonnet 5에서만, 그리고 Anthropic 네이티브 API에서만 지원됩니다.

tools에 공식 web_search 서버 도구를 추가하면 모델이 스스로 검색하고 답변에 출처를 인용합니다.

claude_web_search.py
import os import anthropic client = anthropic.Anthropic( base_url="https://api.ofox.io/anthropic", api_key=os.environ["OFOX_API_KEY"], default_headers={"X-OfoxAI-Provider-Type": "anthropic"}, ) message = client.messages.create( model="anthropic/claude-sonnet-5", max_tokens=1500, tools=[{"type": "web_search_20250305", "name": "web_search", "max_uses": 3}], messages=[{"role": "user", "content": "Python의 최신 안정 버전은 무엇입니까?"}], ) print("".join(b.text for b in message.content if b.type == "text")) print("검색 횟수:", message.usage.server_tool_use.web_search_requests)
  • 응답의 content에는 server_tool_use(검색어), web_search_tool_result(검색 결과), text(답변) 블록이 순서대로 나옵니다.
  • usage.server_tool_use.web_search_requests는 실제 검색 횟수입니다. 검색은 횟수 단위로 과금되며, 단가는 모델 페이지 를 참고하십시오.
  • max_uses는 요청 한 번에 수행할 수 있는 최대 검색 횟수를 제한합니다.

기타 오류는 자주 발생하는 오류를 참고하십시오.

마지막 업데이트