중요합니다
Anthropic Messages API는 Anthropic의 토큰당 비용 지불 기반 모델 및 외부 모델과만 호환됩니다. 공급자 간에 작동하는 통합 API의 경우 Open Responses API 또는 채팅 완료 API를 사용합니다.
Anthropic Messages API는 Azure Databricks의 Claude 모델에 대한 네이티브 Anthropic SDK 호환성을 제공합니다. 인류별 기능이 필요하거나 기존 Anthropic SDK 코드를 마이그레이션하는 경우 이 API를 사용합니다.
Note
Anthropic Messages API를 사용해 Claude 출력을 JSON 스키마로 제한하려면 output_config의 format 필드를 사용하세요. 이는 databricks-claude-sonnet-5-5, databricks-claude-haiku-5-5 및 databricks-claude-opus-5-5에서 지원됩니다. 이 모델들과 databricks-claude-fable-5-1는 response_format의 매개변수를 지원하지 않으며, 이 매개변수를 사용하면 HTTP 400 오류가 반환됩니다. 지원되는 모델과 제약 조건에 대해서는 Azure Databricks의 구조화된 출력을 참조하세요.
Tip
지니 코드 가 이를 대신해 줄 수 있습니다. 다음 예제 프롬프트를 사용해 보세요.
Query the system.ai.claude-sonnet-4-5 model using the Anthropic Messages API with Bearer token auth and the workspace's anthropic base URL. Send a user message and print the response text.
요구 사항
- 요구 사항을 참조하세요.
- 컴퓨팅에
anthropic패키지를 설치합니다.
쿼리 예제
Note
다음 예시들은 Unity 게이트웨이와 모델 서비스를 기반으로 합니다. 모델 서비스 대신 엔드포인트를 제공하는 모델을 사용하는 경우 모델 서비스 이름을 엔드포인트 이름으로 바꿉니다. 사용 가능한 기초 모델과 그 모델 서비스 및 엔드포인트 이름 목록은 Databricks Foundation Model API에서 지원하는 모델 상세 목록을 참조하세요.
다음 예시들은 Anthropic Messages API를 사용하여 Foundation Model API 토큰당 과금 모델 서비스를 쿼리하는 방법을 보여줍니다.
Python
import anthropic
import os
DATABRICKS_TOKEN = os.environ.get('DATABRICKS_TOKEN')
client = anthropic.Anthropic(
api_key="unused",
base_url="https://example.staging.cloud.databricks.com/ai-gateway/anthropic",
default_headers={
"Authorization": f"Bearer {DATABRICKS_TOKEN}",
},
)
message = client.messages.create(
model="system.ai.claude-sonnet-4-5",
max_tokens=256,
messages=[
{"role": "user", "content": "What is a mixture of experts model?"},
],
)
print(message.content[0].text)
REST API
curl \
-u token:$DATABRICKS_TOKEN \
-X POST \
-H "Content-Type: application/json" \
-d '{
"model": "system.ai.claude-sonnet-4-5",
"max_tokens": 256,
"messages": [
{
"role": "user",
"content": "What is a mixture of experts model?"
}
]
}' \
https://<workspace_host>.databricks.com/ai-gateway/anthropic/v1/messages
지원되는 모델
Databricks 호스팅 기본 모델
system.ai.claude-opus-5-5system.ai.claude-fable-5-1system.ai.claude-opus-5system.ai.claude-sonnet-5-5system.ai.claude-sonnet-5system.ai.claude-opus-4-8system.ai.claude-opus-4-7system.ai.claude-opus-4-6system.ai.claude-sonnet-4-6system.ai.claude-sonnet-4-5system.ai.claude-haiku-5-5system.ai.claude-haiku-4-5system.ai.claude-opus-4-5system.ai.claude-opus-4-1
외부 모델
- 인류학적 모델 제공자
- Bedrock Anthropic 모델 제공자
지원되는 입력 유형
Azure Databricks Anthropic Claude 모델은 텍스트 및 이미지 입력을 허용합니다. 이미지 형식 및 크기 요구 사항은 Query Vision 모델을 참조하세요. 모델별 입력 유형에 대해서는 Databricks Foundation Model API가 지원하는 모델 상세 목록을 참조하세요.