메인 콘텐츠로 건너뛰기

빠른 시작

Python
from anthropic import Anthropic

client = Anthropic(
    base_url="https://api.orcarouter.ai",
    api_key="sk-orca-...",
)

response = client.messages.create(
    model="anthropic/claude-sonnet-4.6",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello"}],
)
print(response.content[0].text)
Anthropic SDK는 base_url에 자체적으로 /v1/messages를 추가하므로 베어 호스트(/v1 없이)가 올바른 형식입니다. 요청은 https://api.orcarouter.ai/v1/messages에 도달합니다 — OrcaRouter의 일급 Anthropic 인터페이스입니다. 네이티브 SSE 이벤트 (message_start, content_block_delta, message_stop, …)가 직접 흐르며 스트리밍, 도구 사용, 프롬프트 캐싱(cache_control), 비전이 모두 끝까지 작동합니다. SDK는 표준 x-api-key 헤더로 api_key를 보냅니다 — OrcaRouter의 인증 미들웨어가 Anthropic 형태 경로에서 이 형식을 인식하므로 헤더 조작은 필요 없습니다. 허용되는 인증 헤더의 전체 목록은 API 키 발급 을 참조하세요.

관련 항목