Claude API 가이드
Anthropic Claude는 Anthropic이 개발한 대규모 언어 모델로, 안전성과 유용성으로 잘 알려져 있습니다.
설치
- Python
- JavaScript
- curl
pip install anthropic
npm install @anthropic-ai/sdk
# curl은 보통 시스템에 이미 있으므로 SDK 설치가 필요하지 않습니다
기본 사용법
- Python
- JavaScript
- curl
import anthropic
client = anthropic.Anthropic(
api_key="your-api-key",
base_url="https://aisupermarket.work",
)
message = client.messages.create(
model="claude-opus-4-7",
max_tokens=1024,
messages=[
{"role": "user", "content": "Hello, please introduce yourself"}
]
)
print(message.content[0].text)
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
apiKey: "your-api-key",
baseURL: "https://aisupermarket.work",
});
const message = await client.messages.create({
model: "claude-opus-4-7",
max_tokens: 1024,
messages: [{ role: "user", content: "Hello, please introduce yourself" }],
});
console.log(message.content[0].text);
curl https://aisupermarket.work/v1/messages \
-H "x-api-key: your-api-key" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "claude-opus-4-7",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Hello, please introduce yourself"}]
}'
주요 모델
| 모델 | 설명 |
|---|---|
claude-opus-4-7 | 복잡한 작업, 코딩, 에이전트에 적합한 최고 성능 모델 |
claude-opus-4-6 | 이전 세대 주력 모델 |
claude-sonnet-4-6 | 대부분의 시나리오에 적합한 속도와 성능의 균형 모델 |