Documentation Index
Fetch the complete documentation index at: https://docs.apigo.ai/llms.txt
Use this file to discover all available pages before exploring further.
권장 엔드포인트
최소한의 요청
{
"model": "claude-sonnet-4-20250514",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": [{ "type": "text", "text": "Extract order fields and return JSON only." }]
},
{
"role": "assistant",
"content": [{ "type": "text", "text": "{" }]
}
]
}
cURL 예
curl https://api.anthropic.com/v1/messages \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "claude-sonnet-4-20250514",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": [{ "type": "text", "text": "Extract order fields and return JSON only." }]
},
{
"role": "assistant",
"content": [{ "type": "text", "text": "{" }]
}
]
}'
파이썬 예제
from anthropic import Anthropic
client = Anthropic(api_key="<ANTHROPIC_API_KEY>")
response = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=1024,
messages=[
{
"role": "user",
"content": [{"type": "text", "text": "Extract order fields and return JSON only."}],
},
{
"role": "assistant",
"content": [{"type": "text", "text": "{"}],
},
],
)
print(response.content[0].text)
Node.js 예
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
apiKey: process.env.ANTHROPIC_API_KEY,
});
const response = await client.messages.create({
model: "claude-sonnet-4-20250514",
max_tokens: 1024,
messages: [
{
role: "user",
content: [{ type: "text", text: "Extract order fields and return JSON only." }]
},
{
role: "assistant",
content: [{ type: "text", text: "{" }]
}
]
});
console.log(response.content[0].text);
모범 사례
- Anthropic의 JSON 모드 지침을 따르십시오. 대상 구조를 정확하게 지정하십시오.
- 더 엄격한 출력 일관성이 필요한 경우 어시스턴트 응답을 미리 입력하세요.
- 더 큰 스키마의 경우 한 줄 지침에 의존하는 대신 예제를 추가하세요.