สถานะ: 🟢 Complete | อัพเดท: 2026-06-27
Claude API Overview
Claude API (Anthropic API) ให้เข้าถึง Claude จาก code โดยตรง — สร้าง apps, agents, automations
เริ่มต้น
pip install anthropicfrom anthropic import Anthropic
client = Anthropic() # ใช้ ANTHROPIC_API_KEY env var
message = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}]
)
print(message.content[0].text)หมวดย่อย
- Model IDs — string สำหรับ
modelparameter - Pricing — ราคา input/output tokens
- Parameters — temperature, max_tokens ฯลฯ
- Streaming — real-time output
- Tool Use — function calling